liumiao
2021-01-25 6ec4f2f27e572149716e56363a5fb6cbf5d9cbef
Merge remote-tracking branch 'origin/master'
2 files modified
44 ■■■■■ changed files
app/Http/Controllers/Api/v1/FaceController.php 42 ●●●●● patch | view | raw | blame | history
routes/api.php 2 ●●●●● patch | view | raw | blame | history
app/Http/Controllers/Api/v1/FaceController.php
@@ -57,15 +57,18 @@
        $faceList = $faceObj->GetFaceEntity($entityId);
        if(!isset($faceList['data']['Data']))
        {
            $res = $faceObj->AddFaceEntity($entityId);
            $res = $faceObj->AddFaceEntity($entityId, '学生');
        }
        else
        {
            // 删除人脸
            if(count($faceList['data']['Data']['Faces']) != 0)
            {
                $id = $faceList['data']['Data']['Faces'][0]['FaceId'];
                $faceObj->DeleteFace($id);
                foreach($faceList['data']['Data']['Faces'] as $k => $v)
                {
                    $id = $v['FaceId'];
                    $faceObj->DeleteFace($id);
                }
            }
        }
@@ -146,7 +149,9 @@
        }
        $faceObj = new ALiYunFace();
        $path = SHANGHAI_HTTPS . $request->httpUrl;
        $res = $faceObj->SearchFace($path);
        $res = $faceObj->SearchFace($path, 'default');
        print_r($res);
        die;
        if($res['status'] != 1)
        {
            return $this->_response([], ResponseCode::PARAM_ERROR, '未检测到该用户人脸');
@@ -159,11 +164,10 @@
        $entityId = $res['data']['Data']['MatchList'][0]['FaceItems'][0]['EntityId'];
        $score = $res['data']['Data']['MatchList'][0]['FaceItems'][0]['Score'];
        /* print_r($score);die;
         if($score < 0.98)
         {
             return $this->_response([], ResponseCode::PARAM_ERROR, '人脸比较模糊或存在多张人脸,请重新拍摄');
         }*/
        if($score < 0.5)
        {
            return $this->_response([], ResponseCode::PARAM_ERROR, '识别率太低,请重新拍摄');
        }
        if($score)
            $arr = explode('_', $entityId);
        $where = [
@@ -515,18 +519,28 @@
    public function searchPhoneStudent(Request $request)
    {
        $rule = [
            'classCode' => 'required|integer|min:1',
            #'classCode' => 'required|integer|min:1',
            'phone' => 'required|string',
            'type' => 'required|integer|min:1',
        ];
        $error = $this->_validate($request, $rule);
        if(!empty($error))
        {
            return $this->_response([], ResponseCode::PARAM_ERROR, $error);
        }
        $where = [
            'cs.classCode' => $request->classCode,
            's.phoneNumber' => $request->phone,
        ];
        if($request->type == 1)
        {
            $where = [
                'cs.classCode' => $request->classCode,
                's.phoneNumber' => $request->phone,
            ];
        }
        else
        {
            $where = [
                's.phoneNumber' => $request->phone,
            ];
        }
        $arr = DB::table('anni_classstudent as cs')
            ->select('s.id', 's.username', 's.phoneNumber', 's.name', 's.orgId', 's.englishName', 's.faceImg')
            ->leftJoin('anni_students as s', 's.username', '=', 'cs.username')
routes/api.php
@@ -77,6 +77,8 @@
        /******************************* start Cuiyb ****************************************/
        $api->post('/Usre/userList', 'UsreController@userList');#学员列表
        $api->post('/Usre/myUserList', 'UsreController@myUserList');#我的-学员列表
        $api->post('/Usre/userInfo', 'UsreController@userInfo');#学员详情
        $api->post('/Usre/userClassList', 'UsreController@userClassList');#学员班级列表
        /******************************* end Cuiyb ****************************************/
    });
});