|
@@ -0,0 +1,80 @@
|
|
|
|
|
+<?php
|
|
|
|
|
+
|
|
|
|
|
+namespace App\Http\Controllers\Api;
|
|
|
|
|
+
|
|
|
|
|
+use App\Http\Controllers\ApiController;
|
|
|
|
|
+use App\Models\Firm;
|
|
|
|
|
+use App\Servers\ESign\ESignFirmServer;
|
|
|
|
|
+use App\Servers\System\CommonServer;
|
|
|
|
|
+use App\Servers\System\JobServer;
|
|
|
|
|
+
|
|
|
|
|
+class FirmController extends ApiController
|
|
|
|
|
+{
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 添加&编辑用户
|
|
|
|
|
+ * @return \Illuminate\Http\JsonResponse
|
|
|
|
|
+ * @throws \Throwable
|
|
|
|
|
+ */
|
|
|
|
|
+ function saveFirm(){
|
|
|
|
|
+
|
|
|
|
|
+ $firm_name=request()->input('firm_name','');//姓名
|
|
|
|
|
+ $phone=request()->input('phone','');//电话
|
|
|
|
|
+ $license_number=request()->input('license_number','');//统一社会信用代码
|
|
|
|
|
+ $license_img=request()->input('license_img','');//营业执照
|
|
|
|
|
+ $registered_address=request()->input('registered_address','');//注册地址
|
|
|
|
|
+ $legal_identity_one=request()->input('legal_identity_one','');//法人身份证正明
|
|
|
|
|
+ $legal_identity_two=request()->input('legal_identity_two','');//法人身份证背面
|
|
|
|
|
+ $legal_id_number=request()->input('legal_id_number','');//身份证号
|
|
|
|
|
+
|
|
|
|
|
+ if (empty($firm_name)) return $this->apiResponseError('请填写姓名');
|
|
|
|
|
+ if (mb_strlen($firm_name) > 100) return $this->apiResponseError('姓名最大100');
|
|
|
|
|
+ if (empty($phone)) return $this->apiResponseError('请填写手机号');
|
|
|
|
|
+ if (!CommonServer::creatServer()->verifyPhoneNumber($phone)) return $this->apiResponseError('手机号错误');
|
|
|
|
|
+ if (empty($license_number)) return $this->apiResponseError('请填写统一社会信用代码');
|
|
|
|
|
+ if (empty($license_img)) return $this->apiResponseError('请上传营业执照');
|
|
|
|
|
+ if (empty($registered_address)) return $this->apiResponseError('注册地址不能为空');
|
|
|
|
|
+ if (empty($legal_identity_one)) return $this->apiResponseError('请传身份证正面');
|
|
|
|
|
+ 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');
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ $res = Firm::create($data);
|
|
|
|
|
+
|
|
|
|
|
+ $firm_id = $res->{'id'};
|
|
|
|
|
+ //查询个人认证信息
|
|
|
|
|
+ ESignFirmServer::creatServer()->organizationsIdentityInfo($firm_id,$firm_name);
|
|
|
|
|
+
|
|
|
|
|
+ if ($res) {
|
|
|
|
|
+ return $this->apiResponseSuccess('操作成功');
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return $this->apiResponseError('操作失败');
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取详情
|
|
|
|
|
+ * @return \Illuminate\Http\JsonResponse
|
|
|
|
|
+ */
|
|
|
|
|
+ function getFirmInfo()
|
|
|
|
|
+ {
|
|
|
|
|
+ $id = request()->input('id','');//获取需要删除的id
|
|
|
|
|
+ if(empty($id)) return $this->apiResponseError('缺少必要参数');
|
|
|
|
|
+
|
|
|
|
|
+ $info = Firm::where('id',$id)->select(['id','firm_name','phone','license_number','license_img','registered_address','authType','legal_identity_one','legal_identity_two','legal_id_number'])->first();
|
|
|
|
|
+ if (empty($info)) {
|
|
|
|
|
+ return $this->apiResponseError('该企业不存在');
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return $this->apiResponseSuccess('成功',$info);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+}
|