add:1.企业实名认证改为根据异步回调认证,如果失败记录认证失败原因。

This commit is contained in:
chenbo 2023-09-07 19:06:35 +08:00
parent edc20b92bd
commit d0dcded2f9
2 changed files with 18 additions and 27 deletions

View File

@ -201,15 +201,15 @@ class CompanyController extends BaseAdminController
if ($res->success == true) {
$email = substr(uniqid(),2,5).$res->data;
// 企业人脸上传
$company['master_email'] = $email; // 法人邮箱
$faceCreateRe = CompanyLogic::originationFaceCreate($company);
if ($faceCreateRe !== true) {
return $this->fail($faceCreateRe);
}
// 修改法人邮箱和公司认证状态
Db::name('company')->where('id', $params['id'])->update(['master_email' => $email,'is_authentication'=>1]);
return $this->success('认证成功',[],1, 1);
// return $this->success('系统认证中,请稍后刷新页面查看', ['email' => $res->data], 1, 1);
// $company['master_email'] = $email; // 法人邮箱
// $faceCreateRe = CompanyLogic::originationFaceCreate($company);
// if ($faceCreateRe !== true) {
// return $this->fail($faceCreateRe);
// }
// 修改法人邮箱
Db::name('company')->where('id', $params['id'])->update(['master_email' => $email]);
// return $this->success('认证成功',[],1, 1);
return $this->success('系统认证中,请稍后刷新页面查看', ['email' => $res->data], 1, 1);
} else {
return $this->fail($res->msg);
}
@ -248,25 +248,12 @@ class CompanyController extends BaseAdminController
{
$params = (new CompanyValidate())->goCheck('detail');
$company = Db::name('company')->where('id', $params['id'])->find();
// 公司数据合法性校验
$this->companyCheck($company);
$data = [
'company_name' => $company['company_name'],
'organization_code' => $company['organization_code'],
'master_name' => $company['master_name'],
'master_id_card' => $company['master_id_card'],
'master_email' => $company['master_email'],
'master_phone' => $company['master_phone'],
'id' => $company['id'],
];
$res = app(JunziqianController::class)->organizationFaceCreate($data);
if ($res->success == true && !empty($res->data)) {
return $this->success('成功',["faceCreateUrl"=>$res->data],1, 1);
$re = CompanyLogic::originationFaceCreate($company);
if ($re === true) {
return $this->success('成功',[],1, 1);
} else {
return $this->fail($res->msg);
return $this->fail($re);
}
}
private function companyCheck($company) {
if (empty($company)) {

View File

@ -429,8 +429,12 @@ class IndexController extends BaseApiController
try {
if ($parmas) {
$data=json_decode($parmas['data'],true);
if($data['status']==1){
Company::where('id', $parmas['id'])->update(['is_authentication' => 1]);
}
if($data['status']==2){
Company::where('id', $parmas['id'])->update(['is_authentication' => 2]);
// 记录认证失败原因
Db::name('company_authentication_fail_log')->insert(['company_id'=>$parmas['id'],'fail_reason'=>$data['msg']]);
}
return json(['success' => true, 'msg' => '成功']);
}