From 401b46cc20b33f80f308b98119822d5bec2d1bca Mon Sep 17 00:00:00 2001 From: XiaoLFeng Date: Sun, 11 Sep 2022 11:49:29 +0800 Subject: [PATCH] =?UTF-8?q?API=E6=A8=A1=E7=BB=84=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/signin/index.php | 76 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 api/signin/index.php diff --git a/api/signin/index.php b/api/signin/index.php new file mode 100644 index 0000000..2ddbe35 --- /dev/null +++ b/api/signin/index.php @@ -0,0 +1,76 @@ +'SUCCESS', + 'code'=>200, + 'info'=>'已签到', + ); + // 输出数据 + echo json_encode($data,JSON_UNESCAPED_UNICODE); + } + mysqli_query($conn,"UNLOCK TABLE"); + } else { + // 编译数据 + $data = array( + 'output'=>'USER_NONE', + 'code'=>403, + 'info'=>'缺少用户信息' + ); + // 输出数据 + echo json_encode($data,JSON_UNESCAPED_UNICODE); + header("HTTP/1.1 403 Forbidden"); + } + } elseif ($type == 'admin') { + $result_siginin_check = mysqli_query($conn,"SELECT * FROM ".$setting['SQL_DATA']['signin']." a LEFT JOIN ".$setting['SQL_DATA']['info']." b ON a.studentID=b.studentID"); + $num = 1; + while ($result_siginin_check_object = mysqli_fetch_object($result_siginin_check)) { + $array[$num] = array( + 'studentID'=>$result_siginin_check_object->studentID, + 'name'=>$result_siginin_check_object->name, + 'signin'=>$result_siginin_check_object->signin_20220911, + 'time'=>$result_siginin_check_object->time_20220911, + ); + $num ++; + } + // 编译数据 + $data = array( + 'output'=>'SUCCESS', + 'code'=>200, + 'info'=>'数据输出完毕', + 'data'=>$array, + ); + // 输出数据 + echo json_encode($data,JSON_UNESCAPED_UNICODE); + } +} else { + // 编译数据 + $data = array( + 'output'=>'KEY_ERROR', + 'code'=>403, + 'info'=>'密钥错误' + ); + // 输出数据 + echo json_encode($data,JSON_UNESCAPED_UNICODE); + header("HTTP/1.1 403 Forbidden"); +} \ No newline at end of file