This commit is contained in:
mkm 2023-07-19 17:42:15 +08:00
parent 5586293955
commit b54c53265c
2 changed files with 66 additions and 62 deletions

View File

@ -24,6 +24,7 @@ use think\facade\Request;
use app\api\controller\JunziqianController;
use app\api\logic\SmsLogic;
use Cls\Log;
use com\junziqian\sdk\util\RequestUtils;
use think\App;
use think\facade\Db;
use think\facade\Log as FacadeLog;
@ -123,7 +124,7 @@ class CompanyController extends BaseAdminController
$result = CompanyLogic::detail($params);
if ($result && $result['contract'] && $result['contract']['contract_type_two_url'] != '') {
$data = [
'name' => $result['company_name'].'合同',
'name' => $result['company_name'] . '合同',
'signatories' => [['fullName' => $result['company_name'], 'identityType' => 12, 'identityCard' => $result['organization_code'], 'mobile' => $result['master_phone'], 'email' => $result['master_email'], 'noNeedVerify' => 1, 'signLevel' => 1]],
'url' => $result['contract']['contract_type_two_url']
];
@ -132,10 +133,10 @@ class CompanyController extends BaseAdminController
Db::name('contract')->where('id', $result['contract']['id'])->update(['contract_no' => $res->data]);
$company = Db::name('company')->where('id', $params['id'])->find();
if ($company && $company['contract_id']) {
$find = Db::name('contract')->where('id',$company['contract_id'])
->withAttr('contract_type_two_name', function ($value, $data) {
return Db::name('dict_data')->where('id', $data['contract_type_two'])->value('name');
})->find();
$find = Db::name('contract')->where('id', $company['contract_id'])
->withAttr('contract_type_two_name', function ($value, $data) {
return Db::name('dict_data')->where('id', $data['contract_type_two'])->value('name');
})->find();
if ($find) {
$data = array(
"applyNo" => $find['contract_no'], //TODO *
@ -146,19 +147,19 @@ class CompanyController extends BaseAdminController
$res = app(JunziqianController::class)->SigningLink($data);
if ($res->success == true) {
Db::name('contract')->where('id', $company['contract_id'])->update(['url' => $res->data]);
$url=explode('https://h5.sandbox.junziqian.com/',$res->data);
$url = explode('https://h5.sandbox.junziqian.com/', $res->data);
//发送短信
$sms=[
'mobile'=>$company['master_phone'],
'name'=>$company['company_name'],
'type'=>'《'.$find['contract_type_two_name'].'》',
'code'=>$url[1],
'scene'=>'WQ'
$sms = [
'mobile' => $company['master_phone'],
'name' => $company['company_name'],
'type' => '《' . $find['contract_type_two_name'] . '》',
'code' => $url[1],
'scene' => 'WQ'
];
$result = SmsLogic::contractUrl($sms);
if (true === $result) {
return $this->success('发送成功');
}else{
} else {
return $this->fail(SmsLogic::getError());
}
} else {
@ -181,11 +182,11 @@ class CompanyController extends BaseAdminController
$params = (new CompanyValidate())->goCheck('detail');
$company = Db::name('company')->where('id', $params['id'])->find();
if ($company && $company['contract_id']) {
$find = Db::name('contract')->where('id',$company['contract_id'])
->withAttr('contract_type_two_name', function ($value, $data) {
return Db::name('dict_data')->where('id', $data['contract_type_two'])->value('name');
})
->find();
$find = Db::name('contract')->where('id', $company['contract_id'])
->withAttr('contract_type_two_name', function ($value, $data) {
return Db::name('dict_data')->where('id', $data['contract_type_two'])->value('name');
})
->find();
if ($find) {
$data = array(
"applyNo" => $find['contract_no'], //TODO *
@ -193,25 +194,10 @@ class CompanyController extends BaseAdminController
"identityCard" => $company['organization_code'], //TODO *
"identityType" => 12, //TODO *
);
$res = app(JunziqianController::class)->SigningLink($data);
if ($res->success == true) {
Db::name('contract')->where('id', $company['contract_id'])->update(['url' => $res->data]);
$url=explode('https://h5.sandbox.junziqian.com/',$res->data);
//发送短信
$sms=[
'mobile'=>$company['master_phone'],
'name'=>$company['company_name'],
'type'=>'《'.$find['contract_type_two_name'].'》',
'code'=>$url[1],
'scene'=>'WQ'
];
$result = SmsLogic::contractUrl($sms);
if (true === $result) {
return $this->success('发送成功');
}else{
return $this->fail(SmsLogic::getError());
}
} else {
$res = app(JunziqianController::class)->sms($data);
if($res->success == true){
return $this->success('发送成功');
}else{
return $this->fail($res->msg);
}
}
@ -219,44 +205,46 @@ class CompanyController extends BaseAdminController
}
//企业认证
public function authentication(){
public function authentication()
{
$params = (new CompanyValidate())->goCheck('detail');
$company = Db::name('company')->where('id', $params['id'])->find();
$qualification=json_decode($company['qualification'],true);
$qualification = json_decode($company['qualification'], true);
if ($company && $qualification['business_license']) {
$data=[
$data = [
'name' => $company['company_name'],
'organization_code' => $company['organization_code'],
'business_license' => 'https://lihai001.oss-cn-chengdu.aliyuncs.com/def/561f8202305171526091317.png',//$qualification['business_license'],
'master_name'=>$company['master_name'],
'master_email'=>$company['master_email'],
'business_license' => 'https://lihai001.oss-cn-chengdu.aliyuncs.com/def/561f8202305171526091317.png', //$qualification['business_license'],
'master_name' => $company['master_name'],
'master_email' => $company['master_email'],
];
$res = app(JunziqianController::class)->EnterpriseCertification($data);
if ($res->success == true) {
Db::name('company')->where('id', $params['id'])->update(['master_email' => $res->data]);
return $this->success('认证成功',['email'=>$res->data], 1, 1);
return $this->success('认证成功', ['email' => $res->data], 1, 1);
} else {
return $this->fail($res->msg);
}
}
}
//重新认证
public function organizationReapply(){
public function organizationReapply()
{
$params = (new CompanyValidate())->goCheck('detail');
$company = Db::name('company')->where('id', $params['id'])->find();
$qualification=json_decode($company['qualification'],true);
$qualification = json_decode($company['qualification'], true);
if ($company && $qualification['business_license']) {
$data=[
$data = [
'name' => $company['company_name'],
'organization_code' => $company['organization_code'],
'business_license' => 'https://lihai001.oss-cn-chengdu.aliyuncs.com/def/561f8202305171526091317.png',//$qualification['business_license'],
'master_name'=>$company['master_name'],
'master_email'=>$company['master_email'],
'business_license' => 'https://lihai001.oss-cn-chengdu.aliyuncs.com/def/561f8202305171526091317.png', //$qualification['business_license'],
'master_name' => $company['master_name'],
'master_email' => $company['master_email'],
];
$res = app(JunziqianController::class)->organizationReapply($data);
if ($res->success == true) {
Db::name('company')->where('id', $params['id'])->update(['master_email' => $res->data]);
return $this->success('重新认证成功',['em'], 1, 1);
return $this->success('重新认证成功', ['em'], 1, 1);
} else {
return $this->fail($res->msg);
}

View File

@ -29,10 +29,10 @@ class JunziqianController extends BaseApiController
public function index()
{
$data=[
'name'=>'我的合同',
'signatories'=>[ ['fullName' => '小米', 'identityType' => 1, 'identityCard' => '5002401XXXXXXXXX', 'mobile' => 18982406440,'noNeedVerify'=>1,'signLevel'=>1] ],
'url'=>"https://dev.lihaink.cn/storage/202307/acbba88e77392348d3a8a4a1fdf210f1.pdf"
$data = [
'name' => '我的合同',
'signatories' => [['fullName' => '小米', 'identityType' => 1, 'identityCard' => '5002401XXXXXXXXX', 'mobile' => 18982406440, 'noNeedVerify' => 1, 'signLevel' => 1]],
'url' => "https://dev.lihaink.cn/storage/202307/acbba88e77392348d3a8a4a1fdf210f1.pdf"
];
halt($this->Signing($data));
}
@ -78,8 +78,8 @@ class JunziqianController extends BaseApiController
//初始化合同参数
$request = new OrganizationCreateReq();
$request->name = $data['name'];
$request->identificationType = 1;//证件类型0多证,1多证合一
$request->organizationType = 0;//组织类型 0企业,1事业单位
$request->identificationType = 1; //证件类型0多证,1多证合一
$request->organizationType = 0; //组织类型 0企业,1事业单位
$request->organizationRegNo = $data['organization_code'];
$request->organizationRegImg = $data['business_license']; //new CURLFile('D:/tmp/test.png',null,"test.png");
$request->legalName = $data["master_name"]; //法人
@ -101,8 +101,8 @@ class JunziqianController extends BaseApiController
//初始化合同参数
$request = new OrganizationCreateReq();
$request->name = $data['name'];
$request->identificationType = 1;//证件类型0多证,1多证合一
$request->organizationType = 0;//组织类型 0企业,1事业单位
$request->identificationType = 1; //证件类型0多证,1多证合一
$request->organizationType = 0; //组织类型 0企业,1事业单位
$request->organizationRegNo = $data['organization_code'];
$request->organizationRegImg = $data['business_license']; //new CURLFile('D:/tmp/test.png',null,"test.png");
$request->legalName = $data["master_name"]; //法人
@ -149,14 +149,14 @@ class JunziqianController extends BaseApiController
//[ ['fullName' => '小米', 'identityType' => 1, 'identityCard' => '5002401XXXXXXXXX', 'mobile' => 18982406440,'noNeedVerify'=>1,'signLevel'=>1] ]
$request = new ApplySignReq();
$request->contractName = $data['name'];
$request->signatories = $data['signatories'];//签约方
$request->signatories = $data['signatories']; //签约方
$request->serverCa = 1; //是否需要服务端云证书
$request->fileType = 1;//合同上传方式 url
$request->fileType = 1; //合同上传方式 url
$request->url = $data['url'];
//发起PING请求
// halt($request);
$response = $requestUtils->doPost("/v2/sign/applySign", $request);
return $response;
return $response;
// return $this->success('', (array)$response);
}
@ -170,4 +170,20 @@ class JunziqianController extends BaseApiController
// return $this->success('', (array)$response);
}
public function sms($data)
{
$requestUtils = new RequestUtils($this->serviceUrl, $this->appkey, $this->appSecret);
//初始化请求参数
$request=array(
"applyNo" => $data['applyNo'], //TODO +
//"businessNo" => "0000XXXXXXXXX", //TODO +
"fullName" => $data['fullName'], //TODO *
"identityCard" => $data['identityCard'], //TODO *
"identityType" => 12, //TODO *
"signNotifyType" => 1 //默认为1
);
$response=$requestUtils->doPost("/v2/sign/notify",$request);
return $response;
}
}