Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2020-1-capstone-design1
/
KHY_Project1
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
Graduate
2020-06-09 22:16:10 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
8a6a1befbf46119ed14ba13f688ecd3dfaaef6d2
8a6a1bef
1 parent
b11f06e5
Change query checking method
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
5 additions
and
5 deletions
client/models/__pycache__/mtcnn.cpython-37.pyc
client/models/utils/__pycache__/detect_face.cpython-37.pyc
register/models/__pycache__/mtcnn.cpython-37.pyc
register/models/utils/__pycache__/detect_face.cpython-37.pyc
register/register.py
server/server.py
client/models/__pycache__/mtcnn.cpython-37.pyc
View file @
8a6a1be
No preview for this file type
client/models/utils/__pycache__/detect_face.cpython-37.pyc
View file @
8a6a1be
No preview for this file type
register/models/__pycache__/mtcnn.cpython-37.pyc
View file @
8a6a1be
No preview for this file type
register/models/utils/__pycache__/detect_face.cpython-37.pyc
View file @
8a6a1be
No preview for this file type
register/register.py
View file @
8a6a1be
...
...
@@ -30,7 +30,7 @@ async def send_face(face_list, image_list):
async
with
websockets
.
connect
(
uri
)
as
websocket
:
for
face
,
image
in
zip
(
face_list
,
image_list
):
#type: np.float32
send
=
json
.
dumps
({
'action'
:
'register'
,
'student_id'
:
'201410
4149'
,
'student_name'
:
'정해갑
'
,
'MTCNN'
:
face
.
tolist
()})
send
=
json
.
dumps
({
'action'
:
'register'
,
'student_id'
:
'201410
1898'
,
'student_name'
:
'김다솜
'
,
'MTCNN'
:
face
.
tolist
()})
await
websocket
.
send
(
send
)
recv
=
await
websocket
.
recv
()
data
=
json
.
loads
(
recv
)
...
...
server/server.py
View file @
8a6a1be
...
...
@@ -86,10 +86,10 @@ async def thread(websocket, path):
# 학생을 찾음
sql
=
"SELECT student_id FROM student WHERE student_id =
%
s;"
cursor
.
execute
(
sql
,
(
student_id
))
rows_count
=
cursor
.
execute
(
sql
,
(
student_id
))
# DB에 학생이 없으면 등록
if
not
cursor
.
fetchone
()
:
if
rows_count
==
0
:
sql
=
"INSERT INTO student(student_id, student_name) VALUES (
%
s,
%
s)"
cursor
.
execute
(
sql
,
(
student_id
,
student_name
))
sql
=
"INSERT INTO lecture_students(lecture_id, student_id) VALUES (
%
s,
%
s)"
...
...
@@ -141,10 +141,10 @@ async def thread(websocket, path):
# 인증 성공
# 오늘 이미 출석 됐는지 확인
sql
=
"SELECT DATE(timestamp) FROM student_attendance WHERE (lecture_id=
%
s) AND (student_id=
%
s) AND (DATE(timestamp) = CURDATE());"
cursor
.
execute
(
sql
,
(
'0'
,
verified_id
))
rows_count
=
cursor
.
execute
(
sql
,
(
'0'
,
verified_id
))
# 출석 기록이 없는 경우에만
if
not
cursor
.
fetchone
()
:
if
rows_count
==
0
:
# 테이블 맨 뒤에 datetime attribute가 있음. 서버 시간 가져오게 default로 설정해둠.
sql
=
"INSERT INTO student_attendance(lecture_id, student_id, status) VALUES (
%
s,
%
s,
%
s)"
# TODO: attend / late 처리
...
...
Please
register
or
login
to post a comment