cuiyebiao
2021-02-03 b05803beb187774c3914db8b1616e31a88cc03cb
Merge remote-tracking branch 'origin/master'
6 files modified
251 ■■■■■ changed files
.env 6 ●●●●● patch | view | raw | blame | history
app/Exceptions/Handler.php 42 ●●●● patch | view | raw | blame | history
app/Http/Controllers/Api/v1/ClassScheduleController.php 67 ●●●●● patch | view | raw | blame | history
app/Http/Controllers/Api/v1/FaceController.php 130 ●●●●● patch | view | raw | blame | history
app/Http/Controllers/Api/v1/PersonController.php 1 ●●●● patch | view | raw | blame | history
app/Models/CourseTableModel.php 5 ●●●●● patch | view | raw | blame | history
.env
@@ -23,12 +23,6 @@
DB_USERNAME=anniekids_root
DB_PASSWORD=Anniekids@2020
# 数据库名配置
DB_ANNIEPORTAL = annieportal.
DB_ANNIPROJECT = anniproject.
DB_ANNIEHOMEWORK = anniehomework.
DB_ANNIMINIPROGRAM = annieminiprogram.
NOMALPATH = 'testnormal'
BROADCAST_DRIVER=log
app/Exceptions/Handler.php
@@ -102,13 +102,13 @@
            return apiResponse([], $e->getCode(), $e->getMessage());
        }
//        elseif($routeSystem == 'api' && $e instanceof QueryException)
//        {
//            return $this->responseAndLog(ResponseCode::SERVER_ERROR, '服务器内部错误');
//        }
        elseif($routeSystem == 'api' && $e instanceof QueryException)
        {
            return $this->responseAndLog(ResponseCode::SERVER_ERROR, '服务器内部错误');
        }
        elseif($routeSystem == 'api')
        {
            return apiResponse('', ResponseCode::SERVER_ERROR, $e->getMessage(). ' file :' . $e->getFile(). ' line :' .  $e->getLine());
            return apiResponse('', ResponseCode::SERVER_ERROR, $e->getMessage() . ' file :' . $e->getFile() . ' line :' . $e->getLine());
        }
        elseif($e instanceof ResponseException)
        {
@@ -188,8 +188,8 @@
        $routeArr = explode('/', ltrim($request->getRequestUri(), '/'));
        $routeSystem = isset($routeArr[0]) ? $routeArr[0] : '';                //系统名称
        $routeUrl = isset($routeArr[1]) ? $routeArr[1] : '';                 //路由地址
        $routeSystem = $routeArr[0];                //系统名称
        $routeUrl = $routeArr[1];                   //路由地址
        $url = $routeSystem . '/' . $routeUrl;      //完整路径
        $errInfo['code'] = $e->getCode();           //错误code
@@ -211,15 +211,32 @@
            }
            elseif($e instanceof QueryException)
            {
//                return $this->responseAndLogV2(ResponseCode::SERVER_ERROR, '数据库错误', $errInfo, 'error');
                $message = '';
                if(strpos($e, 'insert'))
                {
                    $message = '数据插入错误';
                }
                if(strpos($e, 'update'))
                {
                    $message = '数据更新错误';
                }
                if(strpos($e, 'delete'))
                {
                    $message = '数据删除错误';
                }
                if(strpos($e, 'select'))
                {
                    $message = '数据查询错误';
                }
                return $this->responseAndLogV2(ResponseCode::SERVER_ERROR, $message, $errInfo, 'error');
            }
            elseif($e instanceof ApiException)
            {
                return $this->responseAndLogV2($errInfo['code'],$errInfo['message'], $errInfo, 'error');
                return $this->responseAndLogV2($errInfo['code'], $errInfo['message'], $errInfo, 'error');
            }
            else
            {
//                return $this->responseAndLogV2(ResponseCode::SERVER_ERROR, '系统内部错误', $errInfo);
                return $this->responseAndLogV2(ResponseCode::SERVER_ERROR, '系统内部错误', $errInfo);
            }
        }
        else
@@ -251,7 +268,7 @@
         * debug        调试
         */
        //文件记录
        $this->recordLogByFile($logLevel,$errInfo);
        $this->recordLogByFile($logLevel, $errInfo);
//        //ES记录
//        $this->recordLogByES($errInfo);
@@ -268,7 +285,8 @@
     */
    private function recordLogByFile($logLevel, $errInfo)
    {
        if(is_array($errInfo)) {
        if(is_array($errInfo))
        {
            $errInfo['request'] = \Request::url();
        }
        Log::$logLevel(json_encode($errInfo));
app/Http/Controllers/Api/v1/ClassScheduleController.php
@@ -36,11 +36,11 @@
        {
            return $this->_response(null, ResponseCode::PARAM_ERROR, $message);
        }
        $signInSet = (new FaceController())->getSignInDetails($request->orgId);
        //根据学员查询当天的所有课次
        $username = $request->post("username");
        $startTime = $request->post("startTime");
        $where = ["s.username" => $username, "s.status" => 1, "s.courseStatus" => 1, "s.isDelete" => 0,
        $where = ["s.username" => $username, "s.status" => 1, "s.isDelete" => 0,
            "ct.isDelete" => 0, "ct.status" => 1, "ct.startTime" => $startTime];
        $select = ["ct.classNumber", "ctt.contentTime", "c.className", "ct.classCode", "s.id as studentId", "ct.id as coursetableId", "c.classHour"];
        $list = StudentsModel::getDataJoinList(StudentsModel::studentCourseList(), $where, $select);
@@ -53,11 +53,18 @@
            $mapFace[$f_val["classCode"] . "-" . $f_val["classNumber"] . "-" . $f_val["contentTime"]] = $f_val;
        }
        $mapList = [];
        $date = date("Y-m-d H:i");
        foreach($list as $l_val)
        {
            if(empty($mapFace[$l_val["classCode"] . "-" . $l_val["classNumber"] . "-" . $l_val["contentTime"]]))
            $classNumberArr = explode('-', $l_val["contentTime"]);
            $lastMinute = $signInSet['lastMinute'] > 0 ? $signInSet['lastMinute'] : 0;
            $beginsTime = $startTime . ' ' . date("H:i", strtotime("$classNumberArr[0] -" . $lastMinute . " min"));
            if($beginsTime <= $date)
            {
                $mapList[] = $l_val;
                if(empty($mapFace[$l_val["classCode"] . "-" . $l_val["classNumber"] . "-" . $l_val["contentTime"]]))
                {
                    $mapList[] = $l_val;
                }
            }
        }
        return $this->_response($mapList);
@@ -82,7 +89,7 @@
        $courseTableId = $request->post("courseTableId");
        $classCode = $request->post("classCode");
        $classNumber = $request->post("classNumber");
        $where = ["fa.classCode" => $classCode, "fa.classNumber" => $classNumber, "s.status" => 1, "s.isDelete" => 0, "s.courseStatus" => 1];
        $where = ["fa.classCode" => $classCode, "fa.classNumber" => $classNumber, "s.status" => 1, "s.isDelete" => 0];
        $select = ["s.name", "s.englishName", "fa.faceImg", "fa.createdTime", "s.id as studentId", "s.username"];
        $list = AttendRecordModel::getDataJoinList(AttendRecordModel::getFaceStudentsList(), $where, $select);
        $mapList = [];
@@ -232,8 +239,8 @@
        //学员签到记录
        $recordMap = $this->getRecordClassNumberList($courseTableId);
        //获取班级学员
        $coWhere = ["cs.classCode" => $classCode, "cs.status" => 1, "cs.isDelete" => 0, "cs.courseStatus" => 1, "cs.isDeleteReason" => 0,
            "s.status" => 1, "s.courseStatus" => 1, "s.isDelete" => 0];
        $coWhere = ["cs.classCode" => $classCode, "cs.status" => 1, "cs.isDelete" => 0, "cs.isDeleteReason" => 0,
            "s.status" => 1, "s.isDelete" => 0];
        $coSelect = ["s.username", "s.name", "s.englishName", "s.phoneNumber", "s.faceImg as headPhoto"];
        $query = StudentsModel::getClassStudentsList();
        $classStudents = StudentsModel::getDataJoinList($query, $coWhere, $coSelect);
@@ -277,13 +284,14 @@
    public function signInRecord($courseTableId, $classCode, $classNumber, $contentTime)
    {
        //获取班级人脸签到记录学员
        $coWhere = ["cs.classCode" => $classCode, "cs.status" => 1, "cs.isDelete" => 0, "cs.courseStatus" => 1, "cs.isDeleteReason" => 0, "s.status" => 1, "s.courseStatus" => 1, "s.isDelete" => 0];
        $coSelect = ["s.username", "s.name", "s.englishName", "s.phoneNumber as phone", "s.faceImg as headPhoto", "fa.faceImg", "fa.createdTime", "fa.type as signInType"];
        $coWhere = ["cs.classCode" => $classCode, "cs.status" => 1, "cs.isDelete" => 0, "cs.isDeleteReason" => 0, "s.status" => 1, "s.isDelete" => 0];
        $coSelect = ["s.username", "s.name", "s.englishName", "s.phoneNumber as phone", "s.faceImg as headPhoto", "fa.faceImg", "fa.createdTime", "fa.type as signInType", "fa.courseTableId"];
        $query = CombineOrdersModel::getClassStudentsSignInList($classNumber, $contentTime);
        $classStudents = CombineOrdersModel::getDataJoinList($query, $coWhere, $coSelect);
        $classMap = [];
        foreach($classStudents as $csKey => $csVal)
        {
            $name = "";
            if($csVal["englishName"] && $csVal["name"])
            {
@@ -302,6 +310,10 @@
            $csVal["headPhoto"] = $this->fun->getFacePath($csVal["headPhoto"]);
            $csVal["faceImg"] = $this->fun->getFacePath($csVal["faceImg"]);
            $csVal["createdTime"] = !empty($csVal["createdTime"]) ? substr($csVal["createdTime"], 11, 16) : '';
            if(!empty($csVal['courseTableId']) && $courseTableId != $csVal['courseTableId'])
            {
                continue;
            }
            $classMap[] = $csVal;
        }
        return array_values(array_unique($classMap, SORT_REGULAR));
@@ -370,10 +382,6 @@
            case 2:
                $tWhere = ["UserId" => $teacherId, "isDelete" => 0];
                $teacherList = CourseTableTeacherModuleModel::getRecordListCondition($tWhere, ["classNumber", "classCode"])->toArray();
                if(empty($teacherList))
                {
                    return $this->_response(null, ResponseCode::COMMON_ERROR, "数据为空");
                }
                $classNumberMap = "";
                $classCodeMap = [];
                foreach($teacherList as $val)
@@ -381,15 +389,16 @@
                    $classNumberMap .= "'" . $val["classNumber"] . "',";
                    $classCodeMap[] = $val["classCode"];
                }
                $classNumber = implode(',', array_unique(explode(',', rtrim($classNumberMap, ','))));
                $classCode = implode(',', array_unique($classCodeMap));
                $where .= " and ct.classNumber in ({$classNumber}) and ct.classCode in ({$classCode})";
                $classNumber = !empty($classNumberMap) ? implode(',', array_unique(explode(',', rtrim($classNumberMap, ',')))) : '""';
                $classCode = !empty($classCodeMap) ? implode(',', array_unique($classCodeMap)) : 0;
                $where .= " and (ct.classNumber in ({$classNumber}) and ct.classCode in ({$classCode}) or (ct.hometeacherId = '{$teacherId}'))";
                $list = CourseTableModel::queryRoleJoinList($where);
                break;
            case 3:
                $where .= " and ct.hometeacherId =" . $teacherId;
                $list = CourseTableModel::queryRoleJoinList($where);
                break;
//                $where .= " and ct.hometeacherId = '{$teacherId}'";
//                $list = CourseTableModel::queryRoleJoinList($where);
                return $this->_response();
            default:
                return $this->_response("", ResponseCode::PARAM_ERROR, "参数错误");
        }
@@ -427,9 +436,16 @@
        $mapList = [];
        foreach($list as $val)
        {
            $contentTime = explode('-', $val["contentTime"]);
            //判断结课以后的班级不在展示数据
            if(!empty($val["endTime"]) && $val["startTime"] . " " . $contentTime[0] . ":00" > $val['endTime'] && $val['classstatus'] == 2)
            {
                continue;
            }
            //班级人数
            $classStudentsNum = !empty($students[$val["classCode"]]) ? count($students[$val["classCode"]]) : 0;
            $signIn = !empty($faceList[$val["classCode"] . "-" . $val["classNumber"] . "-" . $val["contentTime"]]) ? count($faceList[$val["classCode"] . "-" . $val["classNumber"] . "-" . $val["contentTime"]]) : 0; //人脸签到
            $signIn = !empty($faceList[$val["classCode"] . "-" . $val["classNumber"] . "-" . $val["contentTime"] . "-" . $val["courseTableId"]]) ? count($faceList[$val["classCode"] . "-" . $val["classNumber"] . "-" . $val["contentTime"] . "-" . $val["courseTableId"]]) : 0; //人脸签到
            //学员签到记录
            $recordList = !empty($recordMap[$val["courseTableId"]]) ? $recordMap[$val["courseTableId"]] : [];
            $actualNum = 0; //出勤
@@ -463,7 +479,6 @@
            $val["numTypes"] = $actualNum . "/" . $leaveNum . "/" . $signIn . "/" . $classStudentsNum;//出勤/请假/人脸/应到
            $val["remind"] = 0;//代办提醒
            $val["courseName"] = !empty($courseMap[$val["classCode"]]) ? $courseMap[$val["classCode"]] : '';//课程名字
            $contentTime = explode('-', $val["contentTime"]);
            $val["startContentTime"] = $contentTime[0];
            $val["endContentTime"] = $contentTime[1];
            $dayTime = explode('-', $val["startTime"]);
@@ -479,12 +494,11 @@
    public function getFaceList($classCodeArr)
    {
        $faceMap = [];
        $list = FaceAttendanceModel::getRecordListCondition(["classCode" => ["wherein" => $classCodeArr]], ["classCode", "classNumber", "contentTime"])->toArray();
        $list = FaceAttendanceModel::getRecordListCondition(["classCode" => ["wherein" => $classCodeArr]], ["classCode", "classNumber", "contentTime", "courseTableId"])->toArray();
        foreach($list as $val)
        {
            $faceMap[$val["classCode"] . "-" . $val["classNumber"] . "-" . $val["contentTime"]][] = $val;
            $faceMap[$val["classCode"] . "-" . $val["classNumber"] . "-" . $val["contentTime"] . "-" . $val['courseTableId']][] = $val;
        }
        return $faceMap;
    }
@@ -550,7 +564,6 @@
            "status" => 1,
            "isDelete" => 0,
            "isDeleteReason" => 0,
            "courseStatus" => 1,
        ];
        $list = ClassStudentsModel::getRecordListCondition($where, $select);
        $mapList = [];
@@ -623,11 +636,11 @@
        {
            $roleType = 1;
        }
        else if(in_array(2020, $roleIdList))
        else if(in_array(2020, $roleIdList) || in_array(3085, $roleIdList))
        {
            $roleType = 2;
        }
        else if(in_array(3085, $roleIdList))
        else
        {
            $roleType = 3;
        }
app/Http/Controllers/Api/v1/FaceController.php
@@ -25,9 +25,11 @@
class FaceController extends ApiController
{
    public function getFaceUrl($httpUrl) {
        return SHANGHAI_HTTPS . $httpUrl."?x-oss-process=style/thumb";
    public function getFaceUrl($httpUrl)
    {
        return SHANGHAI_HTTPS . $httpUrl . "?x-oss-process=style/thumb";
    }
    /**
     * 注册人脸
     * @param Request $request
@@ -48,7 +50,7 @@
        }
        $faceObj = new ALiYunFace();
        $path = $this->getFaceUrl( $request->httpUrl);
        $path = $this->getFaceUrl($request->httpUrl);
        $res = $this->checkFace($path);
        if($res != 'success')
@@ -57,45 +59,60 @@
        }
        $entityId = 'student_' . $request->studentId . '_' . $request->username;
        if(!isset($res['data']['Data']['MatchList']) || count($res['data']['Data']['MatchList']) == 0)
        // 样体人脸列表
        $faceList = $faceObj->GetFaceEntity($entityId);
        if($faceList['status'] != 1)
        {
            $res = $faceObj->SearchFace($path);
            return $this->_response([], ResponseCode::PARAM_ERROR, $faceList['data']);
        }
        //人脸搜索
        $search = $faceObj->SearchFace($path);
        if(!isset($faceList['data']['Data']))
        {
            if(!isset($search['data']['Data']['MatchList']) || count($search['data']['Data']['MatchList']) == 0)
            {
                return $this->_response([], ResponseCode::PARAM_ERROR, '采集失败,未检测到用户人脸');
            }
            if(!isset($res['data']['Data']['MatchList']) || count($res['data']['Data']['MatchList']) == 0)
            if(isset($search['data']['Data']['MatchList'][0]['FaceItems'][0]['Score']))
            {
                return $this->_response([], ResponseCode::PARAM_ERROR, '未检测到用户人脸');
            }
            if(isset($res['data']['Data']['MatchList'][0]['FaceItems'][0]['Score']))
            {
                $score = $res['data']['Data']['MatchList'][0]['FaceItems'][0]['Score'];
                if($score > 0.65)
                $score = $search['data']['Data']['MatchList'][0]['FaceItems'][0]['Score'];
                if($score > 0.68)
                {
                    return $this->_response([], ResponseCode::PARAM_ERROR, '人脸已存在,请更改');
                    return $this->_response([], ResponseCode::PARAM_ERROR, '采集失败,人脸已绑定其他账号,请更改');
                }
            }
            // 人脸列表
            $faceList = $faceObj->GetFaceEntity($entityId);
            if(!isset($faceList['data']['Data']))
            $res = $faceObj->AddFaceEntity($entityId, '学生');
            if($res['status'] != 1)
            {
                $res = $faceObj->AddFaceEntity($entityId, '学生');
            }
            else
            {
                // 删除人脸
                if(count($faceList['data']['Data']['Faces']) != 0)
                {
                    $id = $faceList['data']['Data']['Faces'][0]['FaceId'];
                    $faceObj->DeleteFace($id);
                }
                return $this->_response([], ResponseCode::PARAM_ERROR, $res['data']);
            }
        }
        else
        {
            if(isset($search['data']['Data']['MatchList'][0]['FaceItems'][0]['EntityId']))
            {
                $entityIdUp = $search['data']['Data']['MatchList'][0]['FaceItems'][0]['EntityId'];
                $score = $search['data']['Data']['MatchList'][0]['FaceItems'][0]['Score'];
                if($entityIdUp != $entityId && $score > 0.68)
                {
                    return $this->_response([], ResponseCode::PARAM_ERROR, '采集失败,人脸已绑定其他账号,请更改');
                }
            }
            // 删除人脸
            if(count($faceList['data']['Data']['Faces']) != 0)
            {
                $id = $faceList['data']['Data']['Faces'][0]['FaceId'];
                $faceObj->DeleteFace($id);
            }
        }
        // 添加人脸
        $res = $faceObj->AddFace($entityId, $path);
        if($res['status'] != 1)
        {
            return $this->_response([], ResponseCode::PARAM_ERROR, '人脸不符合');
            return $this->_response([], ResponseCode::PARAM_ERROR, '采集失败,人脸不符合规范');
        }
        $where = [
            'id' => $request->studentId
@@ -104,9 +121,9 @@
        $res = StudentsModel::where($where)->update(['faceImg' => $faceImg]);
        if($res)
        {
            return $this->_response([], ResponseCode::SUCCESS, '录入成功');
            return $this->_response([], ResponseCode::SUCCESS, '采集成功');
        }
        return $this->_response([], ResponseCode::SUCCESS, '录入失败');
        return $this->_response([], ResponseCode::SUCCESS, '采集失败');
    }
@@ -135,8 +152,8 @@
            return $this->_response([], ResponseCode::SUCCESS, '未录入人脸无法比对');
        }
        $path = $this->getFaceUrl( $info->faceImg);
        $httpUrl = $this->getFaceUrl( $request->httpUrl);
        $path = $this->getFaceUrl($info->faceImg);
        $httpUrl = $this->getFaceUrl($request->httpUrl);
        $res = $this->checkFace($httpUrl);
        if($res != 'success')
        {
@@ -175,7 +192,7 @@
        {
            if(!isset($res['data']['Data']['FaceCount']) || $res['data']['Data']['FaceCount'] > 1)
            {
                return $this->_response([], ResponseCode::PARAM_ERROR, '区域范围内只能包含1张人脸,请重新录入');
                return $this->_response([], ResponseCode::PARAM_ERROR, '采集失败,区域范围内只能包含1张人脸,请重新录入');
            }
        }
        else
@@ -217,6 +234,11 @@
            return $this->_response([], ResponseCode::PARAM_ERROR, $error);
        }
        $paramArr = json_decode($request->paramJson, true);
        if(count($paramArr)!=0) {
            if(count($paramArr[0])!=4) {
                return $this->_response([], ResponseCode::PARAM_ERROR, '格式错误');
            }
        }
        foreach($paramArr as $k => $v)
        {
@@ -356,7 +378,7 @@
            return $this->_response([], ResponseCode::PARAM_ERROR, '签到失败,不在排课时间范围');
        }
        $faceObj = new ALiYunFace();
        $httpUrl = $this->getFaceUrl( $request->httpUrl);
        $httpUrl = $this->getFaceUrl($request->httpUrl);
        if($request->type == 1)
        {
@@ -369,18 +391,24 @@
            $res = $faceObj->SearchFace($httpUrl);
            if($res['status'] != 1)
            {
                return $this->_response([], ResponseCode::PARAM_ERROR, '未检测到人脸');
                return $this->_response([], ResponseCode::PARAM_ERROR, '签到失败,未识别到人脸信息,请联系老师处理');
            }
            if(!isset($res['data']['Data']['MatchList']) || count($res['data']['Data']['MatchList']) == 0)
            {
                return $this->_response([], ResponseCode::PARAM_ERROR, '未检测到人脸信息');
                return $this->_response([], ResponseCode::PARAM_ERROR, '签到失败,未识别到人脸信息,请联系老师处理');
            }
            $entityId = $res['data']['Data']['MatchList'][0]['FaceItems'][0]['EntityId'];
            $score = $res['data']['Data']['MatchList'][0]['FaceItems'][0]['Score'];
            if($score < 0.65)
            if($score < 0.30)
            {
                return $this->_response([], ResponseCode::PARAM_ERROR, '人脸识别率太低或更换注册人脸后请重新拍摄');
                return $this->_response([], ResponseCode::PARAM_ERROR, '签到失败,未识别到人脸信息,请联系老师处理');
            }
            if($score < 0.68)
            {
                return $this->_response([], ResponseCode::PARAM_ERROR, '签到失败,未识别到人脸信息,请联系老师处理');
            }
            $entityIdArr = explode('_', $entityId);
            $studentId = $entityIdArr[1];
@@ -406,14 +434,15 @@
        $userInfo = StudentsModel::where(['id' => $studentId])->select("id", "name", "faceImg")->first();
        if(!$userInfo)
        {
            return $this->_response([], ResponseCode::SUCCESS, $userInfo['name'] . '未注册人脸无法打卡');
            return $this->_response([], ResponseCode::SUCCESS, '签到失败,'.$userInfo['name'] . '未注册人脸,请联系老师处理');
        }
        if($request->type == 1)
        {
            $path = $this->getFaceUrl( $userInfo['faceImg']);
            $comStatus = $faceObj->CompareFace($path,$httpUrl);
            if(!$comStatus) {
                return $this->_response([], ResponseCode::SUCCESS, $userInfo['name'] . '人脸比对失败,请重新拍摄');
            $path = $this->getFaceUrl($userInfo['faceImg']);
            $comStatus = $faceObj->CompareFace($path, $httpUrl);
            if(!$comStatus)
            {
                return $this->_response([], ResponseCode::SUCCESS, '签到失败,'.$userInfo['name'] . '人脸比对失败,请联系老师处理');
            }
        }
@@ -421,7 +450,7 @@
        $res = DB::table('anni_classstudent')->where($where)->first();
        if(!$res)
        {
            return $this->_response([], ResponseCode::SUCCESS, $userInfo['name'] . '不在此班级');
            return $this->_response([], ResponseCode::SUCCESS, '签到失败,'.$userInfo['name'] . '不在此班级,请联系老师处理');
        }
        $where = [
@@ -430,7 +459,7 @@
        $info = StudentsModel::where($where)->select('id', 'faceImg')->first();
        if(empty($info->faceImg))
        {
            return $this->_response([], ResponseCode::SUCCESS, $userInfo['name'] . '未录入人脸');
            return $this->_response([], ResponseCode::SUCCESS, '签到失败,'.$userInfo['name'] . '未录入人脸,请联系老师处理');
        }
        $where = [
@@ -445,7 +474,7 @@
        $res = FaceAttendanceModel::where($where)->first();
        if(!empty($res))
        {
            return $this->_response([], ResponseCode::PARAM_ERROR, $userInfo['name'] . '已签到,请勿重复签到');
            return $this->_response([], ResponseCode::PARAM_ERROR, '已签到,'.$userInfo['name'] . '已签到,请勿重复签到');
        }
        DB::beginTransaction(); //开启事务
        try
@@ -507,6 +536,7 @@
            'dates' => 'required|string',
            'classCode' => 'required|integer|min:1',
            'classNumber' => 'required|string',
            'courseTableId' => 'required|integer|min:1',
            'orgId' => 'required|integer|min:1',
        ];
        $error = $this->_validate($request, $rule);
@@ -522,7 +552,7 @@
            'fa.orgId' => $request->orgId
        ];
        $list = DB::table('anni_face_attendance as fa')
            ->select('s.orgId', 's.username', 's.name', 's.englishName', 's.faceImg', 'fa.createdTime', 'fa.classNumber', 'fa.contentTime', 'fa.type')
            ->select('s.orgId', 's.username', 's.name', 's.englishName', 'fa.faceImg', 'fa.createdTime', 'fa.classNumber', 'fa.contentTime', 'fa.type')
            ->leftJoin('anni_students as s', 'fa.studentId', '=', 's.id')
            ->where($where)
            ->orderBy('fa.createdTime', 'desc')
@@ -652,6 +682,12 @@
            ->select('s.id', 's.username', 's.phoneNumber', 's.name', 's.orgId', 's.englishName', 's.faceImg')
            ->leftJoin('anni_students as s', 's.username', '=', 'cs.username')
            ->where($where)
            /* ->where(function ($query) use ($request) {
                 $query->where('s.phoneNumber', '=', $request->phone)
                     ->orWhere('s.name', 'like', '%' . trim($request->phone) . '%')
                     ->orWhere('s.englishName', 'like', '%' . trim($request->phone) . '%')
                     ->orWhere('s.username', 'like', '%' . trim($request->phone) . '%');
             })*/
            ->groupBy('s.username')->get()->toArray();
        foreach($arr as $k => $v)
        {
app/Http/Controllers/Api/v1/PersonController.php
@@ -64,7 +64,6 @@
        $myMenu = MyMenuModel::getDataJoinList($query, $where, $select, $order)->toArray();
        foreach($myMenu as $key => $value)
        {
            $value['imageUrl'] = $this->fun->stitchingPath($value['imageUrl']);
            if(empty($roleInfo) && $value["jumpModule"] == 5001)
            {
app/Models/CourseTableModel.php
@@ -30,13 +30,14 @@
     */
    public static function queryRoleJoinList($where)
    {
        $date = date("Y-m-d H:i:s");
        $sql = "
                select  ct.id as courseTableId,ct.staffId,ct.orgId,ct.classNumber,ct.classCode,ct.sectionid,ct.week,ct.hometeacherId,
                  ctt.contentTime,cr.roomname,c.teacherName,c.classMode,left(ct.startTime,10) AS startTime,c.className,c.classHour,ctt.id as cTimeId  from anni_coursetable as ct
                  ctt.contentTime,cr.roomname,c.teacherName,c.classMode,left(ct.startTime,10) AS startTime,c.className,ct.classHour,ctt.id as cTimeId,c.classstatus,c.endTime  from anni_coursetable as ct
                left join anni_coursetabletime as ctt on ct.classCode = ctt.classCode and ct.week = ctt.week
                left join anni_classroom as cr on  ct.orgId = cr.orgId and ct.sectionid = cr.id
                left join anni_class as c on  ct.classCode = c.classCode
                where ct.status = 1 and ct.isDelete = 0 and c.classstatus = 1 and ct.courseStatus = 0 and ctt.isDelete = 0 " . $where;
                where ct.status = 1 and ct.isDelete = 0 and ct.courseStatus = 0 and ctt.isDelete = 0 " . $where;
        return DB::select($sql);
    }