|
|
@@ -75,15 +75,16 @@ class FirmController extends AdminController
|
|
|
if (empty($legal_identity_two)) return $this->apiResponseError('请传身份证反面');
|
|
|
if (empty($legal_id_number)) return $this->apiResponseError('请填身份证号码');
|
|
|
|
|
|
- //检查该统一社会信用代码是否存在
|
|
|
- $firm = Firm::where('license_number',$license_number)->where('is_del',0)->select(['id'])->first();
|
|
|
- if (!empty($firm)){
|
|
|
- return $this->apiResponseError('统一社会信用代码已存在');
|
|
|
- }
|
|
|
+
|
|
|
$authType = 'ORG';
|
|
|
$data = compact('firm_name','phone','license_number','license_img','registered_address','authType','legal_identity_one','legal_identity_two','legal_id_number');
|
|
|
|
|
|
if(empty($id)){//不存在id就创建
|
|
|
+ //检查该统一社会信用代码是否存在
|
|
|
+ $firm = Firm::where('license_number',$license_number)->where('is_del',0)->select(['id'])->first();
|
|
|
+ if (!empty($firm)){
|
|
|
+ return $this->apiResponseError('统一社会信用代码已存在');
|
|
|
+ }
|
|
|
|
|
|
$res = Firm::create($data);
|
|
|
}else{//存在就更新
|
|
|
@@ -91,6 +92,12 @@ class FirmController extends AdminController
|
|
|
if (empty($info)) {
|
|
|
return $this->apiResponseError('没有找到该记录');
|
|
|
}
|
|
|
+ //检查该统一社会信用代码是否存在
|
|
|
+ $firm = Firm::where('license_number',$license_number)->where('id','<>',$id)->where('is_del',0)->select(['id'])->first();
|
|
|
+ if (!empty($firm)){
|
|
|
+ return $this->apiResponseError('统一社会信用代码已存在');
|
|
|
+ }
|
|
|
+
|
|
|
$res = $info->update($data);
|
|
|
}
|
|
|
$firm_id = $res->{'id'};
|