提交更新
This commit is contained in:
parent
b136f22c48
commit
5586293955
@ -22,8 +22,12 @@ use app\adminapi\logic\CompanyLogic;
|
|||||||
use app\adminapi\validate\CompanyValidate;
|
use app\adminapi\validate\CompanyValidate;
|
||||||
use think\facade\Request;
|
use think\facade\Request;
|
||||||
use app\api\controller\JunziqianController;
|
use app\api\controller\JunziqianController;
|
||||||
|
use app\api\logic\SmsLogic;
|
||||||
|
use Cls\Log;
|
||||||
use think\App;
|
use think\App;
|
||||||
use think\facade\Db;
|
use think\facade\Db;
|
||||||
|
use think\facade\Log as FacadeLog;
|
||||||
|
use think\Log as ThinkLog;
|
||||||
use think\view\driver\Think;
|
use think\view\driver\Think;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -112,49 +116,150 @@ class CompanyController extends BaseAdminController
|
|||||||
return $this->data($result);
|
return $this->data($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// /**生成合同 */iHMb7rVj@service.ebaoquan.org
|
||||||
public function Draftingcontracts()
|
public function Draftingcontracts()
|
||||||
{
|
{
|
||||||
|
|
||||||
$params = (new CompanyValidate())->goCheck('detail');
|
$params = (new CompanyValidate())->goCheck('detail');
|
||||||
$result = CompanyLogic::detail($params);
|
$result = CompanyLogic::detail($params);
|
||||||
if ($result && $result['contract'] && $result['contract']['contract_type_two_url'] != '') {
|
if ($result && $result['contract'] && $result['contract']['contract_type_two_url'] != '') {
|
||||||
$data = [
|
$data = [
|
||||||
'name' => $result['company_name'],
|
'name' => $result['company_name'].'合同',
|
||||||
'signatories' => [['fullName' => $result['master_name'], 'identityType' => 12, 'identityCard' => $result['organization_code'], 'mobile' => $result['master_phone'], 'email' => $result['master_email'], 'noNeedVerify' => 1, 'signLevel' => 1]],
|
'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']
|
'url' => $result['contract']['contract_type_two_url']
|
||||||
];
|
];
|
||||||
$res = app(JunziqianController::class)->Signing($data);
|
$res = app(JunziqianController::class)->Signing($data);
|
||||||
if ($res->success == true) {
|
if ($res->success == true) {
|
||||||
Db::name('contract')->where('id', $result['contract']['id'])->update(['contract_no' => $res->data]);
|
Db::name('contract')->where('id', $result['contract']['id'])->update(['contract_no' => $res->data]);
|
||||||
return $this->success('起草合同成功', [], 1, 1);
|
$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();
|
||||||
|
if ($find) {
|
||||||
|
$data = array(
|
||||||
|
"applyNo" => $find['contract_no'], //TODO *
|
||||||
|
"fullName" => $company['company_name'], //TODO *
|
||||||
|
"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 {
|
||||||
|
return $this->fail($res->msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $this->success('生成合同成功', [], 1, 1);
|
||||||
} else {
|
} else {
|
||||||
return $this->fail($res->msg);
|
return $this->fail($res->msg);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return $this->fail('起草合同失败,联系管理员');
|
return $this->fail('生成合同成功失败,联系管理员');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//**发送短信 */
|
||||||
public function postsms()
|
public function postsms()
|
||||||
{
|
{
|
||||||
$params = (new CompanyValidate())->goCheck('detail');
|
$params = (new CompanyValidate())->goCheck('detail');
|
||||||
$company = Db::name('company')->where('id', $params['id'])->find();
|
$company = Db::name('company')->where('id', $params['id'])->find();
|
||||||
if ($company && $company['contract_id']) {
|
if ($company && $company['contract_id']) {
|
||||||
$find = Db::name('contract')->where('id',$company['contract_id'])->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) {
|
if ($find) {
|
||||||
$data = array(
|
$data = array(
|
||||||
"applyNo" => $find['contract_no'], //TODO *
|
"applyNo" => $find['contract_no'], //TODO *
|
||||||
"fullName" => $company['master_name'], //TODO *
|
"fullName" => $company['company_name'], //TODO *
|
||||||
"identityCard" => $company['organization_code'], //TODO *
|
"identityCard" => $company['organization_code'], //TODO *
|
||||||
"identityType" => 12, //TODO *
|
"identityType" => 12, //TODO *
|
||||||
);
|
);
|
||||||
$res = app(JunziqianController::class)->SigningLink($data);
|
$res = app(JunziqianController::class)->SigningLink($data);
|
||||||
if ($res->success == true) {
|
if ($res->success == true) {
|
||||||
return $this->success('发生成功', [], 1, 1);
|
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 {
|
} else {
|
||||||
return $this->fail($res->msg);
|
return $this->fail($res->msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//企业认证
|
||||||
|
public function authentication(){
|
||||||
|
$params = (new CompanyValidate())->goCheck('detail');
|
||||||
|
$company = Db::name('company')->where('id', $params['id'])->find();
|
||||||
|
$qualification=json_decode($company['qualification'],true);
|
||||||
|
if ($company && $qualification['business_license']) {
|
||||||
|
$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'],
|
||||||
|
];
|
||||||
|
$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);
|
||||||
|
} else {
|
||||||
|
return $this->fail($res->msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//重新认证
|
||||||
|
public function organizationReapply(){
|
||||||
|
$params = (new CompanyValidate())->goCheck('detail');
|
||||||
|
$company = Db::name('company')->where('id', $params['id'])->find();
|
||||||
|
$qualification=json_decode($company['qualification'],true);
|
||||||
|
if ($company && $qualification['business_license']) {
|
||||||
|
$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'],
|
||||||
|
];
|
||||||
|
$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);
|
||||||
|
} else {
|
||||||
|
return $this->fail($res->msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -71,23 +71,46 @@ class JunziqianController extends BaseApiController
|
|||||||
|
|
||||||
//企业实名认证上传
|
//企业实名认证上传
|
||||||
|
|
||||||
public function EnterpriseCertification()
|
public function EnterpriseCertification($data)
|
||||||
{
|
{
|
||||||
$requestUtils = new RequestUtils($this->serviceUrl, $this->appkey, $this->appSecret);
|
$requestUtils = new RequestUtils($this->serviceUrl, $this->appkey, $this->appSecret);
|
||||||
//CURLFile 可以传url或filePath,但必须保证文件存在且有效,否则php不会报错,只会导致http请求返回null(并没有调到服务端)。
|
//CURLFile 可以传url或filePath,但必须保证文件存在且有效,否则php不会报错,只会导致http请求返回null(并没有调到服务端)。
|
||||||
//初始化合同参数
|
//初始化合同参数
|
||||||
$request = new OrganizationCreateReq();
|
$request = new OrganizationCreateReq();
|
||||||
$request->name = "泸州市海之农科技有限公司";
|
$request->name = $data['name'];
|
||||||
$request->identificationType = 1;
|
$request->identificationType = 1;//证件类型:0多证,1多证合一
|
||||||
$request->organizationType = 0;
|
$request->organizationType = 0;//组织类型 0企业,1事业单位
|
||||||
$request->organizationRegNo = "91510502MAC6KM5Q8M";
|
$request->organizationRegNo = $data['organization_code'];
|
||||||
$request->organizationRegImg = 'https://lihai001.oss-cn-chengdu.aliyuncs.com/def/561f8202305171526091317.png'; //new CURLFile('D:/tmp/test.png',null,"test.png");
|
$request->organizationRegImg = $data['business_license']; //new CURLFile('D:/tmp/test.png',null,"test.png");
|
||||||
$request->legalName = "宋其学"; //法人
|
$request->legalName = $data["master_name"]; //法人
|
||||||
$request->legalIdentityCard = "5002401XXXXXXXXX"; //法人证件号
|
if (isset($data['master_email'])) {
|
||||||
$request->legalMobile = "18982406440";
|
$request->emailOrMobile = $data['master_email']; //邮箱
|
||||||
|
}
|
||||||
|
// $request->emailOrMobile = ; //邮箱
|
||||||
//发起创建企业请求
|
//发起创建企业请求
|
||||||
$response = $requestUtils->doPost("/v2/user/organizationCreate", $request);
|
$response = $requestUtils->doPost("/v2/user/organizationCreate", $request);
|
||||||
return $this->success('', (array)$response);
|
return $response;
|
||||||
|
// return $this->success('', (array)$response);
|
||||||
|
}
|
||||||
|
|
||||||
|
//重新提交企业实名认证
|
||||||
|
public function organizationReapply($data)
|
||||||
|
{
|
||||||
|
$requestUtils = new RequestUtils($this->serviceUrl, $this->appkey, $this->appSecret);
|
||||||
|
//CURLFile 可以传url或filePath,但必须保证文件存在且有效,否则php不会报错,只会导致http请求返回null(并没有调到服务端)。
|
||||||
|
//初始化合同参数
|
||||||
|
$request = new OrganizationCreateReq();
|
||||||
|
$request->name = $data['name'];
|
||||||
|
$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"]; //法人
|
||||||
|
$request->emailOrMobile = $data['master_email']; //邮箱
|
||||||
|
//发起创建企业请求
|
||||||
|
$response = $requestUtils->doPost("/v2/user/organizationReapply", $request);
|
||||||
|
return $response;
|
||||||
|
// return $this->success('', (array)$response);
|
||||||
}
|
}
|
||||||
|
|
||||||
//企业实名认证状态查询
|
//企业实名认证状态查询
|
||||||
@ -126,11 +149,12 @@ class JunziqianController extends BaseApiController
|
|||||||
//[ ['fullName' => '小米', 'identityType' => 1, 'identityCard' => '5002401XXXXXXXXX', 'mobile' => 18982406440,'noNeedVerify'=>1,'signLevel'=>1] ]
|
//[ ['fullName' => '小米', 'identityType' => 1, 'identityCard' => '5002401XXXXXXXXX', 'mobile' => 18982406440,'noNeedVerify'=>1,'signLevel'=>1] ]
|
||||||
$request = new ApplySignReq();
|
$request = new ApplySignReq();
|
||||||
$request->contractName = $data['name'];
|
$request->contractName = $data['name'];
|
||||||
$request->signatories = json_encode($data['signatories']);//签约方
|
$request->signatories = $data['signatories'];//签约方
|
||||||
$request->serverCa = 1; //是否需要服务端云证书
|
$request->serverCa = 1; //是否需要服务端云证书
|
||||||
$request->fileType = 1;//合同上传方式 url
|
$request->fileType = 1;//合同上传方式 url
|
||||||
$request->url = $data['url'];
|
$request->url = $data['url'];
|
||||||
//发起PING请求
|
//发起PING请求
|
||||||
|
// halt($request);
|
||||||
$response = $requestUtils->doPost("/v2/sign/applySign", $request);
|
$response = $requestUtils->doPost("/v2/sign/applySign", $request);
|
||||||
return $response;
|
return $response;
|
||||||
// return $this->success('', (array)$response);
|
// return $this->success('', (array)$response);
|
||||||
|
@ -57,4 +57,29 @@ class SmsLogic extends BaseLogic
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function contractUrl($params)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$scene = NoticeEnum::getSceneByTag($params['scene']);
|
||||||
|
if (empty($scene)) {
|
||||||
|
throw new \Exception('场景值异常');
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = event('Notice', [
|
||||||
|
'scene_id' => $scene,
|
||||||
|
'params' => [
|
||||||
|
'mobile' => $params['mobile'],
|
||||||
|
'name' => $params['name'],
|
||||||
|
'type' => $params['type'],
|
||||||
|
'code' => $params['code']
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
|
||||||
|
return $result[0];
|
||||||
|
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
self::$error = $e->getMessage();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -36,6 +36,7 @@ class NoticeEnum
|
|||||||
const BIND_MOBILE_CAPTCHA = 102;
|
const BIND_MOBILE_CAPTCHA = 102;
|
||||||
const CHANGE_MOBILE_CAPTCHA = 103;
|
const CHANGE_MOBILE_CAPTCHA = 103;
|
||||||
const FIND_LOGIN_PASSWORD_CAPTCHA = 104;
|
const FIND_LOGIN_PASSWORD_CAPTCHA = 104;
|
||||||
|
const WQ = 105;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -89,6 +90,7 @@ class NoticeEnum
|
|||||||
self::BIND_MOBILE_CAPTCHA => '绑定手机验证码',
|
self::BIND_MOBILE_CAPTCHA => '绑定手机验证码',
|
||||||
self::CHANGE_MOBILE_CAPTCHA => '变更手机验证码',
|
self::CHANGE_MOBILE_CAPTCHA => '变更手机验证码',
|
||||||
self::FIND_LOGIN_PASSWORD_CAPTCHA => '找回登录密码验证码',
|
self::FIND_LOGIN_PASSWORD_CAPTCHA => '找回登录密码验证码',
|
||||||
|
self::WQ => '网签短信',
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($flag) {
|
if ($flag) {
|
||||||
@ -117,6 +119,8 @@ class NoticeEnum
|
|||||||
'BGSJHM' => self::CHANGE_MOBILE_CAPTCHA,
|
'BGSJHM' => self::CHANGE_MOBILE_CAPTCHA,
|
||||||
// 找回登录密码
|
// 找回登录密码
|
||||||
'ZHDLMM' => self::FIND_LOGIN_PASSWORD_CAPTCHA,
|
'ZHDLMM' => self::FIND_LOGIN_PASSWORD_CAPTCHA,
|
||||||
|
|
||||||
|
'WQ'=>self::WQ,
|
||||||
];
|
];
|
||||||
return $scene[$tag] ?? '';
|
return $scene[$tag] ?? '';
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user