收藏
回答

人脸合身前端校验成功,后端验证时返回错误:name or id_card_number empty?

APPID:wx2365bd3927cb4d23

服务端验证时的错误信息:

{"errcode":84006,"errmsg":"name or id_card_number empty hint: [_02W0a09883230][2023-10-20 15:46:28] rid: 65323054-6ddb04d2-0bdbf0ab"}"

小程序端代码

//小程序端人脸核身
let res = await wepy.wx.startFacialRecognitionVerify({
  name:_this.name,
  idCardNumber:_this.card,
})
if(res.errCode !== 0){
Dialog.alert({
  title: '错误',
  message: res.errmsg,
}).then(() => {
  // on close
})
return
}

//后端人脸核身
let resp = await request('authorizations/facial', {
  method: 'post',
  data: {
	'name':_this.name,
	'card':_this.card,
	'verify_result':res.verifyResult
  }
})

console.log(resp)

服务端代码(PHP easywecht 6 版本)

public function facial(Request $request){
    $validator = Validator::make($request->all(), [
        'name' => 'required|string',
        'card' => 'required|string',
        'verify_result' => 'required|string',
    ]);

    if ($validator->fails()) {
        return $this->errorBadRequest('参数错误');
    }

    $app = new Application(config('wechat.mini_program'));
    $api = $app->getClient();
    
    $response = $api->postJson('/cityservice/face/identify/getuseridkey', [
        "verify_result" => $request->verify_result,
    ]);
    dd($response->getContent());
}


最后一次编辑于  2023-10-20
回答关注问题邀请回答
收藏

1 个回答

登录 后发表内容