修复代码
This commit is contained in:
parent
d4fe5e76a5
commit
d9649e18ed
@ -25,7 +25,7 @@ class HetongController extends BaseApiController
|
||||
$id = Request()->get('id');
|
||||
$type = Request()->get('tyep');
|
||||
$msg='合同不存在';
|
||||
if(empty($type)){
|
||||
if(!empty($type)){
|
||||
$msg='参数错误';
|
||||
}
|
||||
if ($id && $type) {
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
namespace app\common\logic\contract;
|
||||
|
||||
|
||||
use app\api\controller\JunziqianController;
|
||||
use app\common\model\contract\Contract;
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\Company;
|
||||
@ -117,13 +117,13 @@ class ContractLogic extends BaseLogic
|
||||
* @author likeadmin
|
||||
* @date 2023/07/18 14:28
|
||||
*/
|
||||
public static function detail($params): array
|
||||
public static function detail($params)
|
||||
{
|
||||
$data = Db::name('contract')->where('id', $params['id'])
|
||||
->withAttr('party_b_info', function ($value, $data) {
|
||||
if ($data['type'] == 1) {
|
||||
$field = ['id,company_name,company_type,company_type company_type_name,organization_code,
|
||||
province,city,area,street,village,brigade,address,province province_name,city city_name,area area_name,street street_name,village village_name,brigade brigade_name,
|
||||
province,city,area,street,village,brigade,address,province province_name,city city_name,area area_name,street street_name,village village_name,brigade brigade_name,master_phone,
|
||||
qualification'];
|
||||
$company = Company::where(['id' => $data['party_b']])->field($field)->find();
|
||||
$company['qualification'] = json_decode($company['qualification'], true);
|
||||
@ -139,7 +139,7 @@ class ContractLogic extends BaseLogic
|
||||
})
|
||||
->withAttr('party_a_info', function ($value, $data) {
|
||||
$field = ['id,company_name,company_type,company_type company_type_name,organization_code,
|
||||
province,city,area,street,village,brigade,address,province province_name,city city_name,area area_name,street street_name,village village_name,brigade brigade_name,
|
||||
province,city,area,street,village,brigade,address,province province_name,city city_name,area area_name,street street_name,village village_name,brigade brigade_name,master_phone,
|
||||
qualification'];
|
||||
$company = Company::where(['id' => $data['party_a']])->field($field)->find();
|
||||
$company['qualification'] = json_decode($company['qualification'], true);
|
||||
@ -158,7 +158,6 @@ class ContractLogic extends BaseLogic
|
||||
return $data['status'] == 1 ? '已签约' : '未签约';
|
||||
})
|
||||
->find();
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
@ -180,27 +179,42 @@ class ContractLogic extends BaseLogic
|
||||
// /**发送合同 */
|
||||
public static function Draftingcontracts($params,$type=1)
|
||||
{
|
||||
self::postsms(['id'=>158]);
|
||||
return true;
|
||||
if($type==1){
|
||||
$result = CompanyLogic::detail($params);
|
||||
}else{
|
||||
$result = UserLogic::detail($params['id']);
|
||||
}
|
||||
if ($result && isset($result['contract']) && isset($result['contract']['file']) && $result['contract']['file'] != '') {
|
||||
if ($result['contract']['check_status'] == 3) {
|
||||
return self::setError('你已经生成过合同,请问重复生成');
|
||||
// if ($result['contract']['check_status'] == 3) {
|
||||
// return self::setError('你已经生成过合同,请问重复生成');
|
||||
// }
|
||||
if($type==1){
|
||||
$name=$result['company_name'];
|
||||
$data = [
|
||||
'name' => $name . '的合同',
|
||||
'signatories' => [
|
||||
['fullName' => $name, 'identityType' => 12, 'identityCard' => $result['organization_code'], 'email' => $result['master_email'], 'noNeedVerify' => 1, 'signLevel' => 1],
|
||||
['fullName' => $result['contract']['party_a_info']['company_name'], 'identityType' => 12, 'identityCard' => $result['contract']['party_a_info']['organization_code'], 'email' => $result['contract']['party_a_info']['master_email'], 'noNeedVerify' => 1, 'signLevel' => 1]
|
||||
],
|
||||
'url' => $result['contract']['file']
|
||||
];
|
||||
}else{
|
||||
$name=$result['nickname'];
|
||||
$data = [
|
||||
'name' => $name . '的合同',
|
||||
'signatories' => [
|
||||
['fullName' => $name, 'identityType' => 1, 'identityCard' => $result['id_card'], 'mobile' => $result['mobile'], 'noNeedVerify' => 1, 'signLevel' => 1],
|
||||
['fullName' => $result['contract']['party_a_info']['company_name'], 'identityType' => 12, 'identityCard' => $result['contract']['party_a_info']['organization_code'], 'email' => $result['contract']['party_a_info']['master_email'], 'noNeedVerify' => 1, 'signLevel' => 1]
|
||||
],
|
||||
'url' => $result['contract']['file']
|
||||
];
|
||||
}
|
||||
$data = [
|
||||
'name' => $result['nickname'] . '的合同',
|
||||
'signatories' => [
|
||||
['fullName' => $result['nickname'], 'identityType' => 1, 'identityCard' => $result['id_card'], 'mobile' => $result['mobile'], 'noNeedVerify' => 1, 'signLevel' => 1],
|
||||
['fullName' => $result['contract']['party_a_info']['company_name'], 'identityType' => 12, 'identityCard' => $result['contract']['party_a_info']['organization_code'], 'email' => $result['contract']['party_a_info']['master_email'], 'noNeedVerify' => 1, 'signLevel' => 1]
|
||||
],
|
||||
'url' => $result['contract']['file']
|
||||
];
|
||||
$res = app(JunziqianController::class)->Signing($data, $result['contract']['id']);
|
||||
if ($res->success == true) {
|
||||
Db::name('contract')->where('id', $result['contract']['id'])->update(['contract_no' => $res->data, 'check_status' => 3]);
|
||||
self::postsms($params);
|
||||
self::postsms(['id'=>$result['contract']['id']]);
|
||||
return true;
|
||||
} else {
|
||||
return self::setError($res->msg);
|
||||
@ -214,31 +228,47 @@ class ContractLogic extends BaseLogic
|
||||
public static function postsms($params)
|
||||
{
|
||||
$result = self::detail($params);
|
||||
if ($result && $result['contract'] && $result['contract']['file'] != '') {
|
||||
if ($result && $result['file'] != '') {
|
||||
//发送短信
|
||||
$data = [
|
||||
[
|
||||
"applyNo" => $result['contract_no'], //TODO *
|
||||
"fullName" => $result['contract']['party_a_info']['company_name'], //TODO *
|
||||
"identityCard" => $result['contract']['party_a_info']['organization_code'], //TODO *
|
||||
"fullName" => $result['party_a_info']['company_name'], //TODO *
|
||||
"identityCard" => $result['party_a_info']['organization_code'], //TODO *
|
||||
"identityType" => 12, //TODO *
|
||||
"master_phone" => $result['contract']['party_a_info']['master_phone']
|
||||
"master_phone" => $result['party_a_info']['master_phone'],
|
||||
"type"=>"party_a"
|
||||
],
|
||||
[
|
||||
"applyNo" => $result['contract_no'], //TODO *
|
||||
"fullName" => $result['company_name'], //TODO *
|
||||
"identityCard" => $result['organization_code'], //TODO *
|
||||
"identityType" => 12, //TODO *
|
||||
"master_phone" => $result['master_phone']
|
||||
]
|
||||
];
|
||||
$find = Db::name('contract')->where('party_b', $params['id'])
|
||||
if($result['type']==1){
|
||||
$data[]= [
|
||||
"applyNo" => $result['contract_no'], //TODO *
|
||||
"fullName" => $result['party_b_info']['company_name'], //TODO *
|
||||
"identityCard" => $result['party_b_info']['organization_code'], //TODO *
|
||||
"identityType" => 12, //TODO *
|
||||
"master_phone" => $result['party_b_info']['master_phone'],
|
||||
"type"=>"party_b"
|
||||
|
||||
];
|
||||
}else{
|
||||
$data[]= [
|
||||
"applyNo" => $result['contract_no'], //TODO *
|
||||
"fullName" => $result['party_b_info']['nickname'], //TODO *
|
||||
"identityCard" => $result['party_b_info']['id_card'], //TODO *
|
||||
"identityType" => 1, //TODO *
|
||||
"master_phone" => $result['party_b_info']['mobile'],
|
||||
"type"=>"party_b"
|
||||
|
||||
];
|
||||
}
|
||||
$find = Db::name('contract')->where('id', $params['id'])
|
||||
->withAttr('contract_type_name', function ($value, $data) {
|
||||
return Db::name('dict_data')->where('id', $data['contract_type'])->value('name');
|
||||
})->find();
|
||||
|
||||
$url = [];
|
||||
foreach ($data as $k => $v) {
|
||||
$res = app(JunziqianController::class)->SigningLink($data);
|
||||
$url = [];
|
||||
$res = app(JunziqianController::class)->SigningLink($v);
|
||||
if ($res->success == true) {
|
||||
if ($v['type'] == 'party_a') {
|
||||
$url['party_a'] =$res->data;
|
||||
@ -260,8 +290,8 @@ class ContractLogic extends BaseLogic
|
||||
} else {
|
||||
return self::setError($res->msg);
|
||||
}
|
||||
Db::name('contract')->where('id', $find['id'])->update(['url' => json_encode($url)]);
|
||||
}
|
||||
Db::name('contract')->where('id', $find['id'])->update(['url' => json_encode($url)]);
|
||||
}else{
|
||||
return self::setError('没找到合同,联系管理员');
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user