| xqd
@@ -375,12 +375,9 @@ class UserController extends Controller
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 人脸对比
|
|
|
- * @param Request $request
|
|
|
- * @return \Illuminate\Http\JsonResponse|void
|
|
|
+ * 认证中心
|
|
|
*/
|
|
|
- public function check_auth(Request $request){
|
|
|
- $apiFace = new \AipFace(env('BAI_DU_YUN_APP_ID'),env('BAI_DU_YUN_API_KEY'),env('BAI_DU_YUN_SECRET_KEY'));
|
|
|
+ public function auth_center(Request $request){
|
|
|
try {
|
|
|
if(empty($request->avatar)){
|
|
|
throw new Exception("请上传头像");
|
| xqd
@@ -388,21 +385,61 @@ class UserController extends Controller
|
|
|
if(empty($request->photo)){
|
|
|
throw new Exception("请上传生活照");
|
|
|
}
|
|
|
+ $user = auth('api')->user();
|
|
|
+
|
|
|
+ $userinfo = UserInfoModel::query()->where('user_id',$user->id)->first();
|
|
|
+
|
|
|
+ $new_arr = [
|
|
|
+ "url" => $request->post('photo'),
|
|
|
+ "state" => 0
|
|
|
+ ];
|
|
|
+ //图片
|
|
|
+ $user_photo = json_decode($userinfo->photo,true);
|
|
|
+ $user_photo []= $new_arr;
|
|
|
+ $userinfo->photo = json_encode($user_photo);
|
|
|
+ $userinfo->avatar =$request->avatar;
|
|
|
+
|
|
|
+
|
|
|
+ }catch (\Exception $exception){
|
|
|
+ return $this->response->errorForbidden($exception->getMessage());
|
|
|
+ }
|
|
|
+ return response()->json(['message'=>""]);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 人脸对比
|
|
|
+ * @param Request $request
|
|
|
+ * @return \Illuminate\Http\JsonResponse|void
|
|
|
+ */
|
|
|
+ public function check_auth(Request $request){
|
|
|
+ $apiFace = new \AipFace(env('BAI_DU_YUN_APP_ID'),env('BAI_DU_YUN_API_KEY'),env('BAI_DU_YUN_SECRET_KEY'));
|
|
|
+ try {
|
|
|
+ $user = auth('api')->user();
|
|
|
+ $userinfo = UserInfoModel::query()->where('user_id',$user->id)->first();
|
|
|
+// if(empty($request->auth_pic)){
|
|
|
+// throw new Exception("参数错误");
|
|
|
+// }
|
|
|
|
|
|
$images = array(
|
|
|
array(
|
|
|
- 'image' => base64_encode(file_get_contents($request->avatar)),
|
|
|
+// 'image' => base64_encode(file_get_contents($userinfo->avatar)),
|
|
|
+ 'image' => base64_encode(file_get_contents("https://zhengda.oss-cn-chengdu.aliyuncs.com/chengluApp/image_picker2618603974587821313.jpg")),
|
|
|
'image_type' => 'BASE64',
|
|
|
'liveness_control'=>'NORMAL',
|
|
|
),
|
|
|
array(
|
|
|
- 'image' => base64_encode(file_get_contents($request->photo)),
|
|
|
+// 'image' => base64_encode(file_get_contents($request->auth_pic)),
|
|
|
+ 'image' => base64_encode(file_get_contents("https://zhengda.oss-cn-chengdu.aliyuncs.com/chengluApp/image_picker2618603974587821313.jpg")),
|
|
|
'image_type' => 'BASE64',
|
|
|
//'liveness_control'=>'NORMAL',
|
|
|
),
|
|
|
);
|
|
|
$res = $apiFace->match($images);
|
|
|
|
|
|
+ if($res){
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
|
|
|
|