diff --git a/app/adminapi/controller/contract/ContractController.php b/app/adminapi/controller/contract/ContractController.php
deleted file mode 100644
index b167f5f1..00000000
--- a/app/adminapi/controller/contract/ContractController.php
+++ /dev/null
@@ -1,101 +0,0 @@
-dataLists(new ContractLists());
- }
-
- public function detail(): Json
- {
- $params = $this->request->get(['id']);
- $result = ContractLogic::detail($params);
- return $this->data($result);
- }
-
- public function wind_control(): Json
- {
- $params = $this->request->param();
- $file = $params['file'];
- $res = Contract::where('id', $params['id'])->update(['file' => $file, 'check_status' => 2]);
- if ($res) {
- $find = Contract::where('id', $params['id'])->with(['party_a_info'])->field('type,party_b,party_a')
- ->find()->toArray();
- if ($find['type'] == 1) {
- $find['party_b_info'] = Company::where('id', $find['party_b'])->field('company_name name,master_phone phone')->find()->toArray();
- } else {
- $find['party_b_info'] = WorkerUser::where('id', $find['party_b'])->field('nickname name,mobile phone')->find()->toArray();
- }
- $a = [
- 'mobile' => $find['party_a_info']['master_phone'],
- 'name' => $find['party_a_info']['company_name'],
- 'scene' => 'WQTZ'
- ];
- SmsLogic::contractUrl($a);
- $b = [
- 'mobile' => $find['party_b_info']['phone'],
- 'name' => $find['party_b_info']['name'],
- 'scene' => 'WQTZ'
- ];
- SmsLogic::contractUrl($b);
- return $this->success('上传成功', [], 1, 1);
- } else {
- if ($res == 0) {
- return $this->success('没有更新', [], 1, 1);
- }
- return $this->fail('上传失败');
- }
- }
-
- public function postsms()
- {
- $params = $this->request->param();
- $find = Db::connect('mysql2')->name('la_contract')->where('id', $params['id'])
- ->withAttr('contract_type_name', function ($value, $data) {
- return Db::connect('mysql2')->name('la_dict_data')->where('id', $data['contract_type'])->value('name');
- })
- ->withAttr('user_info', function ($value, $data) {
- if ($data['type'] == 1) {
- return Db::connect('mysql2')->name('la_admin')->where('id', $data['party_b'])->field('name,phone')->find();
- } else {
- return Db::connect('mysql2')->name('la_user')->where('id', $data['party_b'])->field('nickname name,mobile phone')->find();
- }
- })
- ->find();
- if ($find && $find['url'] != '') {
- //发送短信
- $sms = [
- 'mobile' => $find['user_info']['phone'],
- 'name' => $find['user_info']['name'],
- 'type' => '《' . $find['contract_type_name'] . '》',
- 'code' => 'api/Hetong/url?id=' . $find['id'],
- 'scene' => 'WQ'
- ];
- $result = SmsLogic::contractUrl($sms);
- if (true === $result) {
- return $this->success('发送成功');
- } else {
- return $this->fail(SmsLogic::getError());
- }
- }
- }
-
- }
diff --git a/app/adminapi/controller/contract/VehicleContractController.php b/app/adminapi/controller/contract/VehicleContractController.php
deleted file mode 100644
index a8c8a1bf..00000000
--- a/app/adminapi/controller/contract/VehicleContractController.php
+++ /dev/null
@@ -1,300 +0,0 @@
-request->post(['id','file','cars']);
- if(empty($params['id']) || empty($params['file'])){
- return $this->fail('缺少必要参数');
- }
- //获取合同信息
- $vehicle_contract = VehicleContract::where('id',$params['id'])->findOrEmpty();
- if($vehicle_contract->isEmpty()){
- return $this->fail('合同信息错误');
- }
- if($vehicle_contract['type']==0 && $vehicle_contract['contract_logistic_id'] != 0){
- if(empty($params['cars'])){
- return $this->fail('缺少必要参数cars');
- }
- $cars = json_decode($params['cars'],true);
- if(empty($cars)){
- return $this->fail('参数cars无效');
- }
- }
- if($vehicle_contract['status'] != 0){
- return $this->fail('合同状态错误');
- }
- //更新本地
- try {
- $data = [
- 'id' => $vehicle_contract['contract_logistic_id'],
- 'file' => $params['file'],
- 'status' => 1,
- ];
- //判断合同类型
- if($vehicle_contract['type'] == 0 && $vehicle_contract['contract_logistic_id'] != 0){
- $data['cars_info'] = $params['cars'];
- }
- if(!empty($vehicle_contract['contract_logistic_id'])){
- //更新物流系统
- curl_post(env('project.logistic_domain').'/api/contractUpdate',$data);
- }
- unset($data['id']);
- VehicleContract::where('id', $params['id'])->update($data);
-
- }catch (\Exception $e){
- return $this->fail($e->getMessage());
- }
- return $this->success('上传成功', [], 1, 1);
- }
-
- //风控中心发起合同
- public function initiatingRentCarContract(): Json
- {
- //获取参数
- $params = $this->request->post(['id']);
- if(empty($params['id'])){
- return $this->fail('缺少必要参数');
- }
- //获取数据
- $contract = VehicleContract::where('id',$params['id'])->findOrEmpty();
- if($contract->isEmpty()){
- return $this->fail('数据不存在');
- }
- if(!($contract['status'] == 1 || ($contract['status'] == 2 && $contract['signing_timer'] != 2))){
- return $this->fail('合同状态错误');
- }
- $signData = [
- 'name' => $contract['company_a_name'] . '的合同',
- 'signatories' => [
- ['fullName' => $contract['company_a_name'], 'identityType' => 12, 'identityCard' => $contract['company_a_code'], 'email' => $contract['company_a_email'], 'noNeedVerify' => 1, 'signLevel' => 1],
- ['fullName' => $contract['company_b_name'], 'identityType' => 12, 'identityCard' => $contract['company_b_code'], 'email' => $contract['company_b_email'], 'noNeedVerify' => 1, 'signLevel' => 1]
- ],
- 'url' => $contract['file']
- ];
- $notify_url = '';
- if($contract['type'] == 0){
- $smsTitle = '《租赁合同》';
- if(empty($contract['contract_logistic_id'])){
- $notify_url = env('project.web_domain').'/api/notify/systemCarRent';
- }else{
- $notify_url = env('project.web_domain').'/api/notify/townCarRent';
- }
- }elseif($contract['type'] == 1){
- $smsTitle = '《自有车辆上传合同》';
- $notify_url = env('project.web_domain').'/api/notify/selfCarRent';
- }elseif($contract['type'] == 2){
- $smsTitle = '《解约合同》';
- $notify_url = env('project.web_domain').'/api/notify/cancelRent';
- }elseif($contract['type'] == 3){
- $smsTitle = '《购买合同》';
- $notify_url = env('project.web_domain').'/api/notify/buyCar';
- }
- $signRes = app(JunziqianController::class)->VehicleRentSigning($signData, $params['id'],$notify_url);
- if ($signRes->success) {
- $contract->save([
- 'id' => $contract['id'],
- 'contract_no' => $signRes->data,
- 'status' => 2,
- 'signing_timer' => 0
- ]);
- if(!empty($contract['contract_logistic_id'])){
- curl_post(env('project.logistic_domain').'/api/contractUpdate',[
- 'id' => $contract['contract_logistic_id'],
- 'contract_no' => $signRes->data,
- 'status' => 2,
- 'signing_timer' => 0
- ]);
- }
- $this->sendSms($params['id'],$smsTitle);
- return $this->success('合同发送成功');
- } else {
- return $this->fail($signRes->msg);
- }
- }
-
- public function sendSmsAgain(): Json
- {
- //获取参数
- $id = $this->request->post('id');
- if(empty($id)){
- return $this->fail('参数错误');
- }
- //获取数据
- $contract = VehicleContract::where('id',$id)->find();
- if(empty($contract)){
- return $this->fail('数据错误');
- }
- if($contract['type'] == 0){
- $smsTitle = '《租赁合同》';
- }elseif($contract['type'] == 1){
- $smsTitle = '《自有车辆上传合同》';
- }elseif($contract['type'] == 2){
- $smsTitle = '《解约合同》';
- }else{
- $smsTitle = '《购买合同》';
- }
- $this->sendSms($id,$smsTitle);
- return $this->success('发送成功');
- }
-
- public function sendSms($id,$title): bool{
- //获取合同数据
- $contract = VehicleContract::where('id',$id)->findOrEmpty();
- if (!$contract->isEmpty() && $contract['file'] != '') {
- //发送短信
- $data = [
- //甲方
- [
- "applyNo" => $contract['contract_no'],
- "fullName" => $contract['company_a_name'],
- "identityCard" => $contract['company_a_code'],
- "identityType" => 12,
- "master_phone" => $contract['company_a_phone'],
- "type"=>"party_a"
- ],
- //乙方
- [
- "applyNo" => $contract['contract_no'],
- "fullName" => $contract['company_b_name'],
- "identityCard" => $contract['company_b_code'],
- "identityType" => 12,
- "master_phone" => $contract['company_b_phone'],
- "type"=>"party_b"
-
- ],
- ];
-
- $url = [];
- foreach ($data as $v) {
- $res = app(JunziqianController::class)->SigningLink($v);
- if (!$res->success) {
- return false;
- }
- if ($v['type'] == 'party_a') {
- $url['party_a'] =$res->data;
- } else {
- $url['party_b'] =$res->data;
- }
- //发送短信
- $sms = [
- 'mobile' => $v['master_phone'],
- 'name' => $v['fullName'],
- 'type' => $title,
- 'code' => 'api/Hetong/info?id='.$id.'&type='.$v['type'],
- 'scene' => 'WQ'
- ];
- $scene = NoticeEnum::getSceneByTag($sms['scene']);
- if (empty($scene)) {
- throw new \Exception('场景值异常');
- }
- //发送短信
- event('Notice', [
- 'scene_id' => $scene,
- 'params' => $sms
- ]);
- }
- VehicleContract::where('id', $id)->update(['url' => json_encode($url)]);
- return true;
- }else{
- return false;
- }
- }
-
- public function lists(): Json
- {
- $param = $this->request->get();
- $where = [];
- if(isset($param['company_name'])){
- $where[] = ['company_b_name','like','%'.$param['company_name'].'%'];
- }
- if(isset($param['contract_no'])){
- $where[] = ['contract_no','like','%'.$param['contract_no'].'%'];
- }
- if(isset($param['status']) && in_array($param['status'],[0,1])){
- if($param['status'] == 1){
- $where[] = ['status','in', '1,2,3'];
- }else{
- $where[] = ['status','=', $param['status']];
- }
- }else{
- $where[] = ['status','in', '0,1,2,3'];
- }
- $pageNo = !empty($param['page_no']) ? $param['page_no'] : 1;
- $pageSize = !empty($param['page_size']) ? $param['page_size'] : 15;
- $data = VehicleContract::where($where)
- ->page($pageNo, $pageSize)
- ->order('create_time desc')
- ->select()->each(function($item){
- $item['cars_info'] = json_decode($item['cars_info'],true);
- });
- return $this->success('success',['lists'=>$data->toArray(),'page_no'=>$pageNo,'page_size'=>$pageSize,'count'=>$data->count()]);
- }
-
- public function detail(): Json
- {
- $id = $this->request->get('id');
- if(empty($id)){
- $this->fail('参数错误');
- }
- $data = VehicleContract::where('id',$id)->findOrEmpty();
- if($data->isEmpty()){
- return $this->fail('未查找到数据');
- }
- $cars = json_decode($data['cars_info'],true);
- //判断合同类型
- if(!empty($data['contract_logistic_id']) && $data['type'] == 0){
- $carList = curl_get(env('project.logistic_domain').'/api/getAvailableVehicles');
- $data['car_list'] = $carList&&$carList['code']==1 ? $carList['data'] : [];
- }
- if(!empty($cars)){
- foreach ($cars as $k=>$v) {
- if($data['type'] == 0){
- $cars[$k]['type'] = 0;
- }
- if($data['type'] == 1){
- if(empty($v['id'])){
- $cars[$k]['type'] = 1;
- }else{
- $rentInfo = VehicleRent::where('car_id',$v['id'])->findOrEmpty();
- if($rentInfo->isEmpty()){
- $cars[$k]['type'] = 0;
- }else{
- $cars[$k]['type'] = $rentInfo['type'];
- }
- }
- }
- if($data['type'] == 2){
- $rentInfo = VehicleRent::where('car_id',$v['id'])->findOrEmpty();
- if($rentInfo->isEmpty()){
- $cars[$k]['type'] = 0;
- }else{
- $cars[$k]['type'] = $rentInfo['type'];
- }
- }
- if($data['type'] == 3){
- $rentInfo = VehicleRent::where('car_id',$v['id'])->findOrEmpty();
- if($rentInfo->isEmpty()){
- $cars[$k]['type'] = 2;
- }else{
- $cars[$k]['type'] = $rentInfo['type'];
- }
- }
- $cars[$k]['rent_time'] = $data['update_time'];
- }
- }
- $data['cars_info'] = $cars;
- return $this->success('success',$data->toArray());
- }
- }
\ No newline at end of file
diff --git a/app/adminapi/lists/contract/ContractLists.php b/app/adminapi/lists/contract/ContractLists.php
deleted file mode 100644
index cac56965..00000000
--- a/app/adminapi/lists/contract/ContractLists.php
+++ /dev/null
@@ -1,96 +0,0 @@
- ['contract_type', 'contract_no', 'status'],
- ];
- }
-
-
- /**
- * @notes 获取列表
- * @return array
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\DbException
- * @throws \think\db\exception\ModelNotFoundException
- * @author likeadmin
- * @date 2023/07/18 14:28
- */
- public function lists(): array
- {
- $params=$this->request->param();
- $where=[];
- if(isset($params['company_id']) && $params['company_id']!=''){
- $arr= Company::where('company_name','like','%'.$params['company_id'].'%')->column('id');
- if($arr){
- $where[]=['party_a|party_b','in',$arr];
- }
- }
- if(isset($params['area_manager']) && $params['area_manager']!=''){
- $arr= WorkerAdmin::where('name','like','%'.$params['area_manager'].'%')->column('id');
- if($arr){
- $where[]=['area_manager','in',$arr];
- }
- }
- return Contract::where($this->searchWhere)->where($where)->with(['companyName','party_a_info','contractType'])
- ->limit($this->limitOffset, $this->limitLength)
- ->order(['id' => 'desc'])
- ->select()->each(function ($item, $key) {
- if($item->type==1){
- $item->party_b_name=Db::connect('mysql2')->name('la_company')->where('id',$item->party_b)->value('company_name');
- }else{
- $item->party_b_name=Db::connect('mysql2')->name('la_user')->where('id',$item->party_b)->value('nickname');
- }
- if(!empty($item->party_a_info)){
- $area_manager_name=Db::connect('mysql2')->name('la_admin')->where('id',$item->party_a_info->area_manager)->value('name');
- if($area_manager_name){
- $item->area_manager_name=$area_manager_name;
- }else{
- $item->area_manager_name='暂无片区经理';
- }
- }else{
- $item->area_manager_name='暂无片区经理';
- }
- $item->contract_type_name=Db::connect('mysql2')->name('la_dict_data')->where('id',$item->contract_type)->value('name');
- $item->status_name=$item->status==1?'已签约':'未签约';
- })
- ->toArray();
- }
-
-
- /**
- * @notes 获取数量
- * @return int
- * @author likeadmin
- * @date 2023/07/18 14:28
- */
- public function count(): int
- {
- return Contract::where($this->searchWhere)->count();
- }
-
- }
\ No newline at end of file
diff --git a/app/api/controller/HetongController.php b/app/api/controller/HetongController.php
deleted file mode 100644
index 84e8a2b9..00000000
--- a/app/api/controller/HetongController.php
+++ /dev/null
@@ -1,92 +0,0 @@
-get('id');
- $type = Request()->get('type');
- $params = Request()->param();
- $msg='合同不存在';
- if(empty($type)){
- $msg='参数错误';
- }
- if (isset($params['t']) && $params['t'] == 1) {
- $find = Db::name('shop_contract')->where('id', $id)->find();
- if ($find && $find['url']) {
- $url = json_decode($find['url'], true);
- if(isset($url[$type])){
- return redirect($url[$type]);
- }
- }
- }
- if ($id && $type) {
- $find = Db::name('contract')->where('id', $id)->find();
- if ($find && $find['url']) {
- $url = json_decode($find['url'], true);
- if(isset($url[$type])){
- return redirect($url[$type]);
- }
- }
- }
- return '
';
- }
-
- public function info(): \think\response\Json|string|\think\response\Redirect
- {
- $params = $this->request->get(['id','type']);
- if(empty($params['id']) || empty($params['type'])){
- return $this->fail('缺少必要参数');
- }
- $find = VehicleContract::where('id', $params['id'])->find();
- if (!empty($find) && $find['url']) {
- $url = json_decode($find['url'], true);
- if(isset($url[$params['type']])){
- return redirect($url[$params['type']]);
- }
- }
- return ' ';
- }
-
- // 用户做人脸识别时,作跳板的短信链接
- public function toFaceCreate(): string|\think\response\Redirect
- {
- $id = Request()->get('id');
- $msg='地址不存在';
- if ($id) {
- $find = Db::name('company')->where('id', $id)->find();
- if ($find && $find['face_create_url']) {
- return redirect($find['face_create_url']);
- } else {
- $msg='参数错误';
- }
- }
- return ' ';
- }
-
- public function notifyOrganizationFaceCreate(): string
- {
- $parmas = Request()->param();
- Log::info(['人脸识别采集校验回调:',$parmas]);
- $result = json_decode($parmas['data'], true);
- $msg = '人脸采集成功';
- if (isset($result['status']) && $result['status'] == 1) {
- // 修改人脸采集状态
- Company::where(['organization_code'=>$result['organizationRegNo']])->update(['face_create_status'=>1]);
- } else {
- $msg = '采集失败,原因:'.$result['msg'];
- // 记录错误日志
- Db::name('company_authentication_fail_log')->insert(['company_id'=>$result['orderNo'], 'log_type'=>2,'fail_reason'=>$msg, 'create_time'=>time()]);
- }
- return ' ';
- }
- }
\ No newline at end of file
diff --git a/app/api/controller/NotifyController.php b/app/api/controller/NotifyController.php
deleted file mode 100644
index 69348e89..00000000
--- a/app/api/controller/NotifyController.php
+++ /dev/null
@@ -1,516 +0,0 @@
-get('id');
- if(empty($id)){
- return json(['success' => false, 'msg' => '缺少参数']);
- }
- //获取合同数据
- $contract = VehicleContract::where('id', $id)->find();
- if (empty($contract)) {
- return json(['success' => false, 'msg' => '获取数据失败']);
- }
- if($contract['status'] != 2){
- return json(['success' => false, 'msg' => '合同状态错误']);
- }
- if ($contract['signing_timer'] == 0) {
- //更新本地合同状态
- $updateLocalRes = VehicleContract::where('id',$contract['id'])->update(['signing_timer'=>1]);
- //更新远程
- $updateSverRes =curl_post(env('project.logistic_domain').'/api/contractUpdate',[
- 'id' => $contract['contract_logistic_id'],
- 'signing_timer' => 1,
- ]);
- if(!$updateLocalRes || $updateSverRes['code']==0){
- return json(['success' => false, 'msg' => '更新失败11']);
- }
- return json(['success' => true, 'msg' => '成功']);
- }else if($contract['signing_timer'] == 1){
- //获取签约后的合同
- $signContractFile = app(JunziqianController::class)->downloadVehicleContractFile($contract['contract_no']);
- $signContractFile = $signContractFile ?? '';
- //获取签约后的证据
- $signContractEvidenceToPartyA = app(JunziqianController::class)->downloadVehicleContractEvidence($contract['contract_no'],$contract['company_a_name'],$contract['company_a_code']);
- $signContractEvidenceToPartyA = $signContractEvidenceToPartyA ?? '';
- $signContractEvidenceToPartyB = app(JunziqianController::class)->downloadVehicleContractEvidence($contract['contract_no'],$contract['company_b_name'],$contract['company_b_code']);
- $signContractEvidenceToPartyB = $signContractEvidenceToPartyB ?? '';
- $contractEvidence = json_encode([
- 'party_a' => $signContractEvidenceToPartyA,
- 'party_b' => $signContractEvidenceToPartyB
- ]);
- //更新本地合同状态
- $updateLocalRes = VehicleContract::where('id',$contract['id'])->update(['signing_timer'=>2,'status' => 3,'contract_url'=>$signContractFile,'contract_evidence'=>$contractEvidence]);
- //将车辆加入到本地租赁列表
- $cars = json_decode($contract['cars_info'], true);
- $data = [];
- foreach ($cars as $k => $v) {
- $hasCar = VehicleRent::where('car_id',$v['id'])->findOrEmpty();
- if($hasCar->isEmpty()){
- $data[$k]['contract_id'] = $contract['id'];
- $data[$k]['company_id'] = $contract['company_b_id'];
- $data[$k]['car_id'] = $v['id'];
- $data[$k]['car_license'] = $v['license'];
- $data[$k]['type'] = 0;
- $data[$k]['status'] = 0;
- $data[$k]['rent_contract_id'] = 0;
- $data[$k]['rent_company_id'] = 0;
- $data[$k]['rent_time'] = 0;
- $data[$k]['create_time'] = strtotime($contract['create_time']);
- }
- }
- $vehicleRent = new VehicleRent();
- $vehicleRent->saveAll($data);
- //更新远程
- $updateSverRes = curl_post(env('project.logistic_domain').'/api/contractUpdate',[
- 'id' => $contract['contract_logistic_id'],
- 'signing_timer' => 2,
- 'status' => 3,
- 'contract_url'=>$signContractFile,
- 'contract_evidence'=>$contractEvidence
- ]);
- if(!$updateLocalRes || $updateSverRes['code']==0){
- return json(['success' => false, 'msg' => '更新失败22']);
- }else{
- return json(['success' => true, 'msg' => '更新成功']);
- }
- }
- return json(['success' => true, 'msg' => '更新成功@']);
- }
-
- //系统车辆租赁回来
- public function systemCarRent(): Json
- {
- //获取参数
- $id = $this->request->get('id');
- if (empty($id)) {
- return json(['success' => false, 'msg' => '失败1.1']);
- }
- //获取合同数据
- $contract = VehicleContract::where('id', $id)->find();
- if (empty($contract)) {
- return json(['success' => false, 'msg' => '失败1.2']);
- }
- if ($contract['type'] != 0) {
- return json(['success' => false, 'msg' => '失败1.3']);
- }
- if ($contract['status'] != 2) {
- return json(['success' => false, 'msg' => '失败1.4']);
- }
- //判断签约方
- if ($contract['signing_timer'] == 0) {
- //更新合同的签约次数
- $res = VehicleContract::where('id', $id)->update(['signing_timer' => 1]);
- if (!$res) {
- return json(['success' => false, 'msg' => '失败1.5']);
- }
- return json(['success' => true, 'msg' => '成功']);
- } else if ($contract['signing_timer'] == 1) {
- //获取签约后的合同
- $signContractFile = app(JunziqianController::class)->downloadVehicleContractFile($contract['contract_no']);
- $signContractFile = $signContractFile ?? '';
- //获取签约后的证据
- $signContractEvidenceToPartyA = app(JunziqianController::class)->downloadVehicleContractEvidence($contract['contract_no'],$contract['company_a_name'],$contract['company_a_code']);
- $signContractEvidenceToPartyA = $signContractEvidenceToPartyA ?? '';
- $signContractEvidenceToPartyB = app(JunziqianController::class)->downloadVehicleContractEvidence($contract['contract_no'],$contract['company_b_name'],$contract['company_b_code']);
- $signContractEvidenceToPartyB = $signContractEvidenceToPartyB ?? '';
- $contractEvidence = json_encode([
- 'party_a' => $signContractEvidenceToPartyA,
- 'party_b' => $signContractEvidenceToPartyB
- ]);
- //更改合同状态
- VehicleContract::where('id', $id)->update(['signing_timer' => 2, 'status' => 3,'contract_url'=>$signContractFile,'contract_evidence'=>$contractEvidence]);
- //添加车辆到租赁列表
- $vehicle = json_decode($contract['cars_info'], true);
- VehicleRent::where('car_id', $vehicle[0]['id'])->update([
- 'status' => 2,
- 'rent_contract_id' => $contract['id'],
- 'rent_company_id' => $contract['company_b_id'],
- 'rent_time' => time(),
- ]);
- $party_b = Company::where('id', $contract['company_b_id'])->find();
- //通知物流系统跟新
- curl_post(env('project.logistic_domain').'/api/updateVehicleRent', [
- 'car_id' => $vehicle[0]['id'],
- 'use_user_id' => $party_b['user_id'],
- 'use_user_name' => $party_b['master_name'],
- 'use_user_phone' => $party_b['master_phone']
- ]);
- return json(['success' => true, 'msg' => '成功']);
- } else {
- return json(['success' => true, 'msg' => '成功']);
- }
- }
-
- //自有车辆租赁回答
- public function selfCarRent(): Json
- {
- //获取参数
- $id = $this->request->get('id');
- if (empty($id)) {
- return json(['success' => false, 'msg' => '失败2.1']);
- }
- //获取合同数据
- $contract = VehicleContract::where('id', $id)->find();
- if (empty($contract)) {
- return json(['success' => false, 'msg' => '失败2.2']);
- }
- if ($contract['type'] != 1) {
- return json(['success' => false, 'msg' => '失败2.3']);
- }
- if ($contract['status'] != 2) {
- return json(['success' => false, 'msg' => '失败2.4']);
- }
- //判断签约方
- if ($contract['signing_timer'] == 0) {
- $res = VehicleContract::where('id', $id)->update(['signing_timer' => 1]);
- if (!$res) {
- return json(['success' => false, 'msg' => '失败2.5']);
- }
- return json(['success' => true, 'msg' => '成功']);
- } else if ($contract['signing_timer'] == 1) {
- //添加车辆到物流系统
- $vehicle = json_decode($contract['cars_info'], true);
- $curl_res = curl_post(env('project.logistic_domain').'/api/addSelfCar', [
- 'license' => $vehicle[0]['license'],
- 'pic' => $vehicle[0]['pic'],
- 'company_id' => $contract['company_a_id'],
- 'company_name' => $contract['company_a_name'],
- 'company_user' => $contract['company_a_user'],
- 'company_phone' => $contract['company_a_phone'],
- ]);
- if (!$curl_res || $curl_res['code'] == 0) {
- return json(['success' => false, 'msg' => '失败2.6']);
- }
- $cars_info = json_encode([['id' => $curl_res['data']['car_id'], 'license' => $vehicle[0]['license']]]);
- //获取签约后的合同
- $signContractFile = app(JunziqianController::class)->downloadVehicleContractFile($contract['contract_no']);
- $signContractFile = $signContractFile ?? '';
- //获取签约后的证据
- $signContractEvidenceToPartyA = app(JunziqianController::class)->downloadVehicleContractEvidence($contract['contract_no'],$contract['company_a_name'],$contract['company_a_code']);
- $signContractEvidenceToPartyA = $signContractEvidenceToPartyA ?? '';
- $signContractEvidenceToPartyB = app(JunziqianController::class)->downloadVehicleContractEvidence($contract['contract_no'],$contract['company_b_name'],$contract['company_b_code']);
- $signContractEvidenceToPartyB = $signContractEvidenceToPartyB ?? '';
- $contractEvidence = json_encode([
- 'party_a' => $signContractEvidenceToPartyA,
- 'party_b' => $signContractEvidenceToPartyB
- ]);
- VehicleContract::where('id', $id)->update(['cars_info'=>$cars_info,'update_time'=>time(),'signing_timer'=>2,'status'=>3,'contract_url'=>$signContractFile,'contract_evidence'=>$contractEvidence]);
- VehicleRent::create([
- 'car_id' => $curl_res['data']['car_id'],
- 'contract_id' => $contract['id'],
- 'company_id' => $contract['company_a_id'],
- 'car_license' => $vehicle[0]['license'],
- 'status' => 2,
- 'rent_time' => time(),
- 'rent_contract_id' => $contract['id'],
- 'rent_company_id' => $contract['company_b_id'],
- 'create_time' => time(),
- 'type' => 1
- ]);
- $car_id = $curl_res['data']['car_id'];
- $party_b = Company::where('id', $contract['company_b_id'])->find();
- //通知物流系统跟新
- curl_post(env('project.logistic_domain').'/api/updateVehicleRent', [
- 'car_id' => $car_id,
- 'use_user_id' => $party_b['user_id'],
- 'use_user_name' => $party_b['master_name'],
- 'use_user_phone' => $party_b['master_phone']
- ]);
- return json(['success' => true, 'msg' => '成功']);
- } else {
- return json(['success' => true, 'msg' => '成功']);
- }
- }
-
- //解除合同回调
- public function cancelRent()
- {
- //获取参数
- $id = $this->request->get('id');
- if (empty($id)) {
- return json(['success' => false, 'msg' => '失败3.1']);
- }
- //获取合同数据
- $contract = VehicleContract::where('id', $id)->find();
- if (empty($contract)) {
- return json(['success' => false, 'msg' => '失败3.2']);
- }
- if ($contract['type'] != 2) {
- return json(['success' => false, 'msg' => '失败3.3']);
- }
- if ($contract['status'] != 2) {
- return json(['success' => false, 'msg' => '失败3.4']);
- }
- if ($contract['signing_timer'] == 0) {
- $res = VehicleContract::where('id', $id)->update(['signing_timer' => 1]);
- if (!$res) {
- return json(['success' => false, 'msg' => '失败3.5']);
- }
- return json(['success' => true, 'msg' => '成功']);
- } else if ($contract['signing_timer'] == 1) {
- //获取签约后的合同
- $signContractFile = app(JunziqianController::class)->downloadVehicleContractFile($contract['contract_no']);
- $signContractFile = $signContractFile ?? '';
- //获取签约后的证据
- $signContractEvidenceToPartyA = app(JunziqianController::class)->downloadVehicleContractEvidence($contract['contract_no'],$contract['company_a_name'],$contract['company_a_code']);
- $signContractEvidenceToPartyA = $signContractEvidenceToPartyA ?? '';
- $signContractEvidenceToPartyB = app(JunziqianController::class)->downloadVehicleContractEvidence($contract['contract_no'],$contract['company_b_name'],$contract['company_b_code']);
- $signContractEvidenceToPartyB = $signContractEvidenceToPartyB ?? '';
- $contractEvidence = json_encode([
- 'party_a' => $signContractEvidenceToPartyA,
- 'party_b' => $signContractEvidenceToPartyB
- ]);
- $cars = json_decode($contract['cars_info'],true);
- $cars_ids = array_column($cars,'id');
- //更改合同状态
- VehicleContract::where('id', $id)->update(['signing_timer'=>2,'status'=>3,'contract_url'=>$signContractFile,'contract_evidence'=>$contractEvidence]);
- if(!empty($contract['contract_logistic_id'])){
- curl_post(env('project.logistic_domain').'/api/contractUpdate',[
- 'id' => $contract['contract_logistic_id'],
- 'signing_timer' => 2,
- 'status' => 3,
- 'contract_url'=>$signContractFile,
- 'contract_evidence'=>$contractEvidence,
- ]);
- }
- //判断合同是否存在购买记录表中
- $vehicleBuyRecord = VehicleBuyRecord::where('contract_id',$contract['id'])->findOrEmpty();
- if(!$vehicleBuyRecord->isEmpty()){
- //小组公司与镇街公司解约
- if($vehicleBuyRecord['status'] == 1){
- //获取租赁车辆信息
- $rentCarsInfo = VehicleRent::where('car_id',$cars_ids[0])->findOrEmpty();
- if($rentCarsInfo['type'] == 0){
- //修改租赁车俩状态
- VehicleRent::where('id',$rentCarsInfo['id'])->update(['status'=>0,'rent_company_id'=>0,'rent_contract_id'=>0,'rent_time'=>0]);
- }
- if($rentCarsInfo['type'] == 1){
- //修改租赁车俩状态
- VehicleRent::where('id',$rentCarsInfo['id'])->delete();
- }
- //删除原合同
- VehicleContract::where('id',$rentCarsInfo['rent_contract_id'])->delete();
- //修改物流系统车辆租赁信息
- curl_post(env('project.logistic_domain').'/api/Vehicle/delRentUseInfo', [
- 'car_id' => $cars_ids[0]
- ]);
- //发送购买合同给物流系统
- $curl_result = curl_post(env('project.logistic_domain').'/api/signContract',[
- 'num' => $vehicleBuyRecord['num'],
- 'company_id' => $vehicleBuyRecord['company_id'],
- 'company_name' => $vehicleBuyRecord['company_name'],
- 'company_code' => $vehicleBuyRecord['company_code'],
- 'company_user' => $vehicleBuyRecord['company_user'],
- 'company_phone' => $vehicleBuyRecord['company_phone'],
- 'company_email' => $vehicleBuyRecord['company_email'],
- 'cars_info' => $vehicleBuyRecord['cars_info'],
- 'type' => 3
- ]);
- if(empty($curl_result)){
- return $this->fail('null return from logistic');
- }
- if($curl_result['code'] == 0){
- return $this->fail($curl_result['msg'].' from logistic');
- }
- //生成本地合同
- VehicleContract::create($curl_result['data']);
- VehicleBuyRecord::where('id',$vehicleBuyRecord['id'])->update(['status'=>4]);
- return json(['success' => true, 'msg' => '成功']);
- }
- //小组公司与镇街公司解约,然后镇街公司与平台公司解约
- if($vehicleBuyRecord['status'] == 2){
- //获取租赁车辆信息
- $rentCarsInfo = VehicleRent::where('car_id',$cars_ids[0])->findOrEmpty();
- if($rentCarsInfo['type'] == 0){
- //修改租赁车俩状态
- VehicleRent::where('id',$rentCarsInfo['id'])->update(['status'=>0,'rent_company_id'=>0,'rent_contract_id'=>0,'rent_time'=>0]);
- }
- if($rentCarsInfo['type'] == 1){
- //修改租赁车俩状态
- VehicleRent::where('id',$rentCarsInfo['id'])->delete();
- }
- //删除原合同
- VehicleContract::where('id',$rentCarsInfo['rent_contract_id'])->delete();
- //修改物流系统车辆租赁信息
- curl_post(env('project.logistic_domain').'/api/Vehicle/delRentUseInfo', [
- 'car_id' => $cars_ids[0]
- ]);
- //获取镇街公司信息
- $zjCompany = Company::where('id',$rentCarsInfo['company_id'])->findOrEmpty();
- //判断购买车辆中是否包含镇街公司租赁的车辆
- $car_ids = array_column(json_decode($vehicleBuyRecord['cars_info'],true),'id');
- $zjRentCars = VehicleRent::field('car_id as id,car_license as license')->where('company_id',$zjCompany['id'])->where('car_id','in',$car_ids)->where('status',0)->where('type',0)->select();
- //发送镇公司与平台公司的解约合同
- $curl_result = curl_post(env('project.logistic_domain').'/api/signContract',[
- 'num' => count($zjRentCars),
- 'company_id' => $zjCompany['id'],
- 'company_name' => $zjCompany['company_name'],
- 'company_code' => $zjCompany['organization_code'],
- 'company_user' => $zjCompany['master_name'],
- 'company_phone' => $zjCompany['master_phone'],
- 'company_email' => $zjCompany['master_email'],
- 'cars_info' => json_encode($zjRentCars),
- 'type' => 2
- ]);
- if(empty($curl_result)){
- return $this->fail('null return from logistic');
- }
- if($curl_result['code'] == 0){
- return $this->fail($curl_result['msg'].' from logistic');
- }
- //生成本地合同
- $res = VehicleContract::create($curl_result['data']);
- VehicleBuyRecord::where('id',$vehicleBuyRecord['id'])->update(['status'=>3,'contract_id'=>$res->id]);
- return json(['success' => true, 'msg' => '成功']);
- }
- //镇街公司与平台公司解约
- if($vehicleBuyRecord['status'] == 3){
- //删除本地租赁信息
- VehicleRent::where('car_id','in',$cars_ids)->delete();
- //删除物流系统租赁信息
- curl_post(env('project.logistic_domain').'/api/cancelRent', [
- 'car_ids' => implode(',',$cars_ids)
- ]);
- //发送购买合同给物流系统
- $curl_result = curl_post(env('project.logistic_domain').'/api/signContract',[
- 'num' => $vehicleBuyRecord['num'],
- 'company_id' => $vehicleBuyRecord['company_id'],
- 'company_name' => $vehicleBuyRecord['company_name'],
- 'company_code' => $vehicleBuyRecord['company_code'],
- 'company_user' => $vehicleBuyRecord['company_user'],
- 'company_phone' => $vehicleBuyRecord['company_phone'],
- 'company_email' => $vehicleBuyRecord['company_email'],
- 'cars_info' => $vehicleBuyRecord['cars_info'],
- 'type' => 3
- ]);
- if(empty($curl_result)){
- return $this->fail('null return from logistic');
- }
- if($curl_result['code'] == 0){
- return $this->fail($curl_result['msg'].' from logistic');
- }
- //生成本地合同
- VehicleContract::create($curl_result['data']);
- VehicleBuyRecord::where('id',$vehicleBuyRecord['id'])->update(['status'=>4]);
- return json(['success' => true, 'msg' => '成功']);
- }
- }else{
- //更改租赁列表车辆状态
- $vehicle = json_decode($contract['cars_info'], true);
- //获取租赁车辆信息
- $vehicleRentInfo = VehicleRent::where('car_id', $vehicle[0]['id'])->find();
- //更新原始合同类型
- VehicleContract::where('id', $vehicleRentInfo['rent_contract_id'])->delete();
- VehicleRent::where('car_id', $vehicle[0]['id'])->delete();
- //通知物流系统跟新
- curl_post(env('project.logistic_domain').'/api/Vehicle/delRentUseInfo', [
- 'car_id' => $vehicle[0]['id']
- ]);
- return json(['success' => true, 'msg' => '成功']);
- }
- } else {
- return json(['success' => true, 'msg' => '成功']);
- }
- }
-
- //购买合同回调
- public function buyCar(): Json
- {
- //获取参数
- $id = $this->request->get('id');
- if (empty($id)) {
- return json(['success' => false, 'msg' => '失败4.1']);
- }
- //获取合同数据
- $contract = VehicleContract::where('id', $id)->find();
- if (empty($contract)) {
- return json(['success' => false, 'msg' => '失败4.2']);
- }
- if ($contract['type'] != 3) {
- return json(['success' => false, 'msg' => '失败4.3']);
- }
- if ($contract['status'] != 2) {
- return json(['success' => false, 'msg' => '失败4.4']);
- }
- if ($contract['signing_timer'] == 0) {
- $res = VehicleContract::where('id', $id)->update(['signing_timer' => 1]);
- if (!$res) {
- return json(['success' => false, 'msg' => '失败4.5']);
- }
- return json(['success' => true, 'msg' => '成功']);
- }else if ($contract['signing_timer'] == 1) {
- //获取签约后的合同
- $signContractFile = app(JunziqianController::class)->downloadVehicleContractFile($contract['contract_no']);
- $signContractFile = $signContractFile ?? '';
- //获取签约后的证据
- $signContractEvidenceToPartyA = app(JunziqianController::class)->downloadVehicleContractEvidence($contract['contract_no'],$contract['company_a_name'],$contract['company_a_code']);
- $signContractEvidenceToPartyA = $signContractEvidenceToPartyA ?? '';
- $signContractEvidenceToPartyB = app(JunziqianController::class)->downloadVehicleContractEvidence($contract['contract_no'],$contract['company_b_name'],$contract['company_b_code']);
- $signContractEvidenceToPartyB = $signContractEvidenceToPartyB ?? '';
- $contractEvidence = json_encode([
- 'party_a' => $signContractEvidenceToPartyA,
- 'party_b' => $signContractEvidenceToPartyB
- ]);
- //更新本地合同状态
- $updateLocalRes = VehicleContract::where('id',$contract['id'])->update(['signing_timer'=>2,'status' => 3,'contract_url'=>$signContractFile,'contract_evidence'=>$contractEvidence]);
- //判断是否有监管车辆
- $jgCars = VehicleRent::where('rent_company_id',$contract['company_b_id'])->where('status',2)->where('type',2)->findOrEmpty();
- if($jgCars->isEmpty()){
- //获取镇街公司信息
- $zjCompany = Contract::field('party_a')->where('party_b',$contract['company_b_id'])->where('signing_timer',2)->findOrEmpty();
- //将车辆加入到本地租赁列表
- $cars = json_decode($contract['cars_info'], true);
- //写入数据
- $data = [
- 'car_id' => $cars[0]['id'],
- 'car_license' => $cars[0]['license'],
- 'type' => 2,
- 'status' => 2,
- 'company_id' => $zjCompany['party_a'],
- 'rent_time' => time(),
- 'rent_company_id' => $contract['company_b_id'],
- 'contract_id' => $contract['id'],
- 'create_time' => time()
- ];
- $vehicleRent = new VehicleRent();
- $vehicleRent->save($data);
- }
- //获取签约公司信息
- $compay = Company::where('id',$contract['company_b_id'])->findOrEmpty();
- //更新远程
- $updateSverRes = curl_post(env('project.logistic_domain').'/api/contractUpdate',[
- 'id' => $contract['contract_logistic_id'],
- 'signing_timer' => 2,
- 'status' => 3,
- 'contract_url'=>$signContractFile,
- 'contract_evidence'=>$contractEvidence,
- 'use_user_id' =>$compay['user_id'],
- 'use_user_name' =>$compay['master_name'],
- 'use_user_phone' =>$compay['master_phone'],
- ]);
- if(!$updateLocalRes || $updateSverRes['code']==0){
- return json(['success' => false, 'msg' => '更新失败']);
- }else{
- return json(['success' => true, 'msg' => '更新成功']);
- }
- }else{
- return json(['success' => true, 'msg' => '成功']);
- }
- }
- }
\ No newline at end of file
diff --git a/app/api/logic/SmsLogic.php b/app/api/logic/SmsLogic.php
index c8a580a8..9eaef117 100644
--- a/app/api/logic/SmsLogic.php
+++ b/app/api/logic/SmsLogic.php
@@ -1,21 +1,9 @@
$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;
- }
- }
}
\ No newline at end of file
diff --git a/app/common/controller/JunziqianController.php b/app/common/controller/JunziqianController.php
deleted file mode 100644
index 5a4a2620..00000000
--- a/app/common/controller/JunziqianController.php
+++ /dev/null
@@ -1,491 +0,0 @@
-serviceUrl=env('junzi.url_prefix');
- $this->appkey=env('junzi.app_key');
- $this->appSecret=env('junzi.app_secret');
-
- parent::initialize();
-
- }
- /**请求地址*/
- // private $serviceUrl = 'https://api.junziqian.com';
- // /**appkey*/
- // private $appkey = '62dc4ab579153712';
- // /**secret*/
- // private $appSecret = 'b7f65acc62dc4ab579153712fc9ebfc5';
- /**默认加密方式:不输入使用sha256,其它可选择项md5,sha1,sha3-256*/
- private $encryMethod;
- /**默认ts单位:1毫秒,2秒*/
- private $tsType;
- /**
- * 填充签名数据
- * @param $req array
- */
- public function fillSign($req)
- {
- /**默认加密方式:不输入使用sha256,其它可选择项md5,sha1,sha3-256*/
- $ts = time();
- if ($this->tsType == 1) {
- $ts = $ts * 1000;
- }
- $sign = null;
- $nonce = md5($ts . "");
- $signSrc = "nonce" . $nonce . "ts" . $ts . "app_key" . $this->appkey . "app_secret" . $this->appSecret;
- if ($this->encryMethod == null || $this->encryMethod == "sha256") {
- $sign = ShaUtils::getSha256($signSrc);
- } else if ($this->encryMethod == "sha1") {
- $sign = ShaUtils::getSha1($signSrc);
- } else if ($this->encryMethod == "md5") {
- $sign = md5($signSrc);
- } else {
- throw new ResultInfoException($this->encryMethod . ",必须为md5,sha1,sha256之一", "PARAM_ERROR");
- }
- $req['ts'] = $ts;
- $req['app_key'] = $this->appkey;
- $req['sign'] = $sign;
- $req['nonce'] = $nonce; //这只是为了生成一个随机值
- if ($this->encryMethod != null) {
- $req['encry_method'] = $this->encryMethod; //为''也不能传
- }
- return $req;
- }
-
- //企业实名认证上传
-
- public function EnterpriseCertification($data)
- {
- $requestUtils = new RequestUtils($this->serviceUrl, $this->appkey, $this->appSecret);
- $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->legalIdentityCard = $data["master_id_card"]; // 法人身份证 签约时人脸识别需要
- // $request->legalMobile = $data["master_phone"]; // 法人手机号 预留 签约时短信验证需要
-
- if (isset($data['master_email'])) {
- $request->emailOrMobile = $data['master_email']; //邮箱
- }
- // $request->notifyUrl = env('url.url_prefix').'/notifyAuthentication?ids=22222';
- $request->notifyUrl = env('url.url_prefix') . '/notifyAuthentication?id=' . $data['id'];
- // halt($request);
- //发起创建企业请求
- $response = $requestUtils->doPost("/v2/user/organizationCreate", $request);
- return $response;
- }
-
- /**
- * @param $data
- * @return object
- * 商城商户入驻,实名认证
- */
- public function ShopMerchantCertification($data)
- {
- $requestUtils = new RequestUtils($this->serviceUrl, $this->appkey, $this->appSecret);
- $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'];
- $request->legalName = $data["master_name"]; //法人
- if (isset($data['master_email'])) {
- $request->emailOrMobile = $data['master_email']; //邮箱
- }
- $request->notifyUrl = env('url.url_prefix') . '/notifyAuthentication?id=' . $data['id'].'&type=shop_merchant'; // 回调增加type参数,用于回调是辨别是商户认证会带
- //发起创建企业请求
- $response = $requestUtils->doPost("/v2/user/organizationCreate", $request);
- return $response;
- }
-
- //重新提交企业实名认证
- public function organizationReapply($data)
- {
- $requestUtils = new RequestUtils($this->serviceUrl, $this->appkey, $this->appSecret);
- $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->legalIdentityCard = $data["master_id_card"]; // 法人身份证 签约时人脸识别需要
- // $request->legalMobile = $data["master_phone"]; // 法人手机号 预留 短信验证需要
- $request->emailOrMobile = $data['master_email']; //邮箱
- //发起创建企业请求
- $response = $requestUtils->doPost("/v2/user/organizationReapply", $request);
- return $response;
- // return $this->success('', (array)$response);
- }
-
- //企业实名认证状态查询
- public function StatusQuery()
- {
- $param = Request()->param();
- $requestUtils = new RequestUtils($this->serviceUrl, $this->appkey, $this->appSecret);
- //初始化合同参数
- $request = array(
- "emailOrMobile" => $param['master_email'], //TODO *
- );
- //发起请求
- $response = $requestUtils->doPost("/v2/user/organizationAuditStatus", $request);
- return $response;
- }
-
- public function shopMerchantStatusQuery($email)
- {
- $param = Request()->param();
- $requestUtils = new RequestUtils($this->serviceUrl, $this->appkey, $this->appSecret);
- //初始化合同参数
- $request = array(
- "emailOrMobile" => $email, //TODO *
- );
- //发起请求
- $response = $requestUtils->doPost("/v2/user/organizationAuditStatus", $request);
- return $response;
- }
-
- //企业自定义公章
- public function Custom_seal()
- {
- $requestUtils = new RequestUtils($this->serviceUrl, $this->appkey, $this->appSecret);
- //初始化合同参数
- $request = array(
- "signName" => "500XXXXXXXXXXXX", //TODO *
- "email" => "500XXXXXXXXXXXX", //TODO 不传则保存在商户下,传入注册的邮箱则上传到指定邮箱企业名下
- "signImgFile" => new CURLFile('D:/tmp/test.png', null, "test.png"),
- );
- $response = $requestUtils->doPost("/v2/user/uploadEntSign", $request);
- return $this->success('', (array)$response);
- }
- //签约
- public function Signing($data, $id, $notify = '')
- {
- if ($notify == '') {
- $notify = env('url.url_prefix') . '/notify_url';
- }
- $requestUtils = new RequestUtils($this->serviceUrl, $this->appkey, $this->appSecret);
- $request = new ApplySignReq();
- $request->contractName = $data['name'];
- $request->signatories = $data['signatories']; //签约方
- // $request->faceThreshold = 79; // 人脸识别阀值:默认等级(1-100之间整数),建议范围(60-79)
- $request->serverCa = 1; //是否需要服务端云证书
- $request->fileType = 1; //合同上传方式 url
- $request->url = $data['url'];
- $request->notifyUrl = $notify . '?id=' . $id;
- $request->needQifengSign = 1;
- //发起PING请求
- // halt($request);
- $response = $requestUtils->doPost("/v2/sign/applySign", $request);
- return $response;
- }
- public function shopContractSigning($data, $id, $notify = '')
- {
- if ($notify == '') {
- $notify = env('url.url_prefix') . '/shop_contract_notify_url';
- }
- $requestUtils = new RequestUtils($this->serviceUrl, $this->appkey, $this->appSecret);
- $request = new ApplySignReq();
- $request->contractName = $data['name'];
- $request->signatories = $data['signatories']; //签约方
- // $request->faceThreshold = 79; // 人脸识别阀值:默认等级(1-100之间整数),建议范围(60-79)
- $request->serverCa = 1; //是否需要服务端云证书
- $request->fileType = 1; //合同上传方式 url
- $request->url = $data['url'];
- $request->notifyUrl = $notify . '?id=' . $id;
- $request->needQifengSign = 1;
- //发起PING请求
- // halt($request);
- $response = $requestUtils->doPost("/v2/sign/applySign", $request);
- return $response;
- }
-
- // 企业人脸校验上传
- public function OrganizationFaceCreate($data)
- {
- $requestUtils = new RequestUtils($this->serviceUrl, $this->appkey, $this->appSecret);
- $request = new OrganizationFaceCreateReq();
- $request->orderNo = $data['id'];
- $request->email = $data['master_email'];
- $request->enterpriseName = $data['company_name'];
- $request->identityNo = $data['organization_code'];
- // $request-> facePerType = 0;
- $request->legalPersonName = $data['master_name'];
- $request->legalIdentityCard = $data['master_id_card']; //法人证件号
- $request->legalMobile = $data['master_phone'];
- $request->faceAgantIdenName = $data['master_name'];
- $request->faceAgantIdenCard = $data['master_id_card'];
- $request->backUrl = env('url.url_prefix') . '/api/Hetong/notifyOrganizationFaceCreate';
- $response = $requestUtils->doPost("/v2/user/organizationFaceCreate", $request);
- return $response;
- }
-
- public function VehicleRentSigning($data, $id, $notify)
- {
- $requestUtils = new RequestUtils($this->serviceUrl, $this->appkey, $this->appSecret);
- $request = new ApplySignReq();
- $request->contractName = $data['name'];
- $request->signatories = $data['signatories']; //签约方
- $request->serverCa = 1; //是否需要服务端云证书
- $request->fileType = 1; //合同上传方式 url
- $request->url = $data['url'];
- $request->notifyUrl = $notify . '?id=' . $id;
- $request->needQifengSign = 1;
- //发起PING请求
- // halt($request);
- $response = $requestUtils->doPost("/v2/sign/applySign", $request);
- Log::write('三轮车签约:'.json_encode(['result'=>$response,'notify'=>$notify]),'notice');
- return $response;
- }
-
- public function downloadVehicleContractFile($applyNo)
- {
- $requestUtils = new RequestUtils($this->serviceUrl, $this->appkey, $this->appSecret);
- $contract_url = VehicleContract::where('contract_no', $applyNo)->value('contract_url');
- if ($contract_url && !empty($contract_url)) {
- return $contract_url;
- }
- //初始化请求参数
- $request = array(
- "applyNo" => $applyNo, //TODO +
- );
- $response = $requestUtils->doPost("/v2/sign/linkFile", $request);
- if ($response->success) {
- $this->getDownload($response->data, root_path() . 'public/uploads/vehicle_contract/' . $applyNo . '.pdf');
- return env('project.website_domain') . '/uploads/vehicle_contract/' . $applyNo . '.pdf';
- } else {
- return false;
- }
- }
-
- public function downloadVehicleContractEvidence($applyNo, $companyName, $companyCode)
- {
- //构建请求工具
- $requestUtils = new RequestUtils($this->serviceUrl, $this->appkey, $this->appSecret);
- //初始化合同参数
- $request = array(
- "applyNo" => $applyNo,
- "fullName" => $companyName, //签约人名称(合同发起接口中传入的签署人姓名)
- "identityCard" => $companyCode, //统一社会信用代码
- "identityType" => 12, //证件类型 1身份证, 2护照, 3台胞证, 4港澳居民来往内地通行证, 11营业执照, 12统一社会信用代码, 20子账号, 99其他
- "dealType" => 1
- );
- $response = $requestUtils->doPost("/v2/sign/presLinkFile", $request);
- if ($response->success) {
- $this->getDownload($response->data, root_path().'public/uploads/vehicle_contract_evidence/'.$applyNo.'_'.$companyCode.'.zip');
- return env('project.website_domain').'/uploads/vehicle_contract_evidence/'.$applyNo.'_'.$companyCode.'.zip';;
- } else {
- return false;
- }
- }
-
- public function SigningLink($data)
- {
- //构建请求工具
- $requestUtils = new RequestUtils($this->serviceUrl, $this->appkey, $this->appSecret);
- //初始化合同参数
- $response = $requestUtils->doPost("/v2/sign/link", $data);
- return $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;
- }
-
- //html模板
- public function html_contract($data, $id)
- {
- $requestUtils = new RequestUtils($this->serviceUrl, $this->appkey, $this->appSecret);
- //CURLFile 可以传url或filePath,但必须保证文件存在且有效,否则php不会报错,只会导致http请求返回null(并没有调到服务端)。
- //初始化合同参数
- $request = new ApplySignReq();
- $request->contractName = $data['name'];
- $request->signatories = $data['signatories']; //签约方
- $request->serverCa = 1; //是否需要服务端云证书
- $request->fileType = 3;
- $request->htmlContent = $data['content'];
- $request->notifyUrl = env('url.url_prefix') . '/notify_url?id=' . $id;
- $request->needQifengSign = 1;
-
- //发起PING请求
- $response = $requestUtils->doPost("/v2/sign/applySign", $request);
- return $response;
- }
-
- /**
- * 下载合同
- */
- public function download_file($applyNo)
- {
- $requestUtils = new RequestUtils($this->serviceUrl, $this->appkey, $this->appSecret);
- $find = Db::connect('mysql2')->name('la_contract')->where('contract_no', $applyNo)->value('contract_url');
- if ($find) {
- return $this->success('获取成功', ['url' => env('url.url_prefix') . $find]);
- }
- //初始化请求参数
- $request = array(
- "applyNo" => $applyNo, //TODO +
- );
- $response = $requestUtils->doPost("/v2/sign/linkFile", $request);
- if ($response->success == true) {
- $this->getDownload($response->data, root_path() . 'public/uploads/contract/' . $applyNo . '.pdf');
- Db::connect('mysql2')->name('la_contract')->where('contract_no', $applyNo)->update(['contract_url' => '/uploads/contract/' . $applyNo . '.pdf']);
- return $this->success('获取成功', ['url' => env('url.url_prefix') . '/uploads/contract/' . $applyNo . '.pdf']);
- } else {
- return $this->fail('获取失败');
- }
- }
- public function download_shop_file($applyNo)
- {
- $requestUtils = new RequestUtils($this->serviceUrl, $this->appkey, $this->appSecret);
- $find = Db::connect('mysql2')->name('la_contract')->where('contract_no', $applyNo)->value('contract_url');
- if ($find) {
- return $this->success('获取成功', ['url' => env('url.url_prefix') . $find]);
- }
- //初始化请求参数
- $request = array(
- "applyNo" => $applyNo, //TODO +
- );
- $response = $requestUtils->doPost("/v2/sign/linkFile", $request);
- if ($response->success == true) {
- $this->getDownload($response->data, root_path() . 'public/uploads/contract/' . $applyNo . '.pdf');
- Db::connect('mysql2')->name('la_shop_contract')->where('contract_no', $applyNo)->update(['contract_url' => '/uploads/contract/' . $applyNo . '.pdf']);
- return $this->success('获取成功', ['url' => env('url.url_prefix') . '/uploads/contract/' . $applyNo . '.pdf']);
- } else {
- return $this->fail('获取失败');
- }
- }
- /**
- * 保全后合同文件及证据包下载
- */
- public function EvidenceDownload($param)
- {
- //初始化请求参数
- $requestUtils = new RequestUtils($this->serviceUrl, $this->appkey, $this->appSecret);
-
- $request = array(
- "applyNo" => $param['applyNo'],
- "fullName" => $param['fullName'],
- "identityCard" => $param['identityCard'],
- "identityType" => 12,
- "dealType" => 1,
- );
- $response = $requestUtils->doPost("/v2/sign/presLinkFile", $request);
- if ($response->success == true) {
- $this->getDownload($response->data, root_path() . 'public/uploads/evidence/' . $param['applyNo'] . '.zip');
- Db::connect('mysql2')->name('la_contract')->where('contract_no', $param['applyNo'])->update(['evidence_url' => '/uploads/evidence/' . $param['applyNo'] . '.zip']);
- return $this->success('获取成功', ['url' => env('url.url_prefix') . '/uploads/evidence/' . $param['applyNo'] . '.zip']);
- } else {
- return $this->fail('获取失败');
- }
- }
-
- /**
- * 保全后合同文件及证据包下载
- */
- public function EvidenceShopDownload($param)
- {
- //初始化请求参数
- $requestUtils = new RequestUtils($this->serviceUrl, $this->appkey, $this->appSecret);
-
- $request = array(
- "applyNo" => $param['applyNo'],
- "fullName" => $param['fullName'],
- "identityCard" => $param['identityCard'],
- "identityType" => 12,
- "dealType" => 1,
- );
- $response = $requestUtils->doPost("/v2/sign/presLinkFile", $request);
- if ($response->success == true) {
- $this->getDownload($response->data, root_path() . 'public/uploads/evidence_shop_contract/' . $param['applyNo'] . '.zip');
- Db::connect('mysql2')->name('la_shop_contract')->where('contract_no', $param['applyNo'])->update(['evidence_url' => '/uploads/evidence_shop_contract/' . $param['applyNo'] . '.zip']);
- return $this->success('获取成功', ['url' => env('url.url_prefix') . '/uploads/evidence_shop_contract/' . $param['applyNo'] . '.zip']);
- } else {
- return $this->fail('获取失败');
- }
- }
-
-
- public function getDownload($url, $publicDir = '', $fileName = '', $type = 0)
- {
-
- //获取文件路径
- $newOneDir = substr($publicDir, 0, strrpos($publicDir, "/"));
- if (trim($url) == '') {
- return false;
- }
- //检验访问url是否有效
- $array = get_headers($url, 1);
- if (!preg_match('/200/', $array[0])) {
- return false;
- }
- if (trim($publicDir) == '') {
- return false;
- }
- //创建保存目录
- if (!file_exists($newOneDir) && !mkdir($newOneDir, 0777, true)) {
- return false;
- }
- //获取远程文件所采用的方法
- if ($type) {
- $ch = curl_init();
- $timeout = 5;
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
- $content = curl_exec($ch);
- curl_close($ch);
- } else {
- ob_start();
- readfile($url);
- $content = ob_get_contents();
- ob_end_clean();
- }
- $size = strlen($content);
- //文件大小
- $fp2 = @fopen($publicDir, 'a');
- fwrite($fp2, $content);
- fclose($fp2);
- unset($content, $url);
- }
-}
diff --git a/app/common/logic/company/CompanyLogic.php b/app/common/logic/company/CompanyLogic.php
deleted file mode 100644
index 5859afbd..00000000
--- a/app/common/logic/company/CompanyLogic.php
+++ /dev/null
@@ -1,8 +0,0 @@
- $params['company_id'],
- 'contract_type' => $params['contract_type'],
- 'contract_no' => $params['contract_no'],
- 'file' => $params['file'],
- 'status' => $params['status'],
- 'party_a' => $params['party_a'],
- 'party_b' => $params['party_b'],
- 'area_manager' => $params['area_manager']
- ]);
-
- Db::commit();
- return true;
- } catch (\Exception $e) {
- Db::rollback();
- self::setError($e->getMessage());
- return false;
- }
- }
-
-
- /**
- * @notes 编辑
- * @param array $params
- * @return bool
- * @author likeadmin
- * @date 2023/07/18 14:28
- */
- public static function edit(array $params): bool
- {
- Db::startTrans();
- try {
- Contract::where('id', $params['id'])->update([
- 'company_id' => $params['company_id'],
- 'contract_type' => $params['contract_type'],
- 'contract_no' => $params['contract_no'],
- 'file' => $params['file'],
- 'status' => $params['status'],
- 'party_a' => $params['party_a'],
- 'party_b' => $params['party_b'],
- 'area_manager' => $params['area_manager']
- ]);
-
- Db::commit();
- return true;
- } catch (\Exception $e) {
- Db::rollback();
- self::setError($e->getMessage());
- return false;
- }
- }
-
-
- /**
- * @notes 删除
- * @param array $params
- * @return bool
- * @author likeadmin
- * @date 2023/07/18 14:28
- */
- public static function delete(array $params): bool
- {
- return Contract::destroy($params['id']);
- }
-
-
- /**
- * @notes 获取详情
- * @param $params
- * @return array
- * @author likeadmin
- * @date 2023/07/18 14:28
- */
- public static function detail($params)
- {
- $data = Db::connect('mysql2')->name('la_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,master_phone,master_name,
- qualification'];
- $company = Company::where(['id' => $data['party_b']])->field($field)->find();
- if(empty($company)){
- return [];
- }else{
- $company=$company->toArray();
- }
- $company['qualification'] = json_decode($company['qualification'], true);
- if($company['qualification'] && isset($company['qualification']['other_qualifications'])){
- $company['qualification']['other_qualifications']=json_decode($company['qualification']['other_qualifications'],true);
- }
- return $company;
- } else {
- $filed = ['id,id_card,avatar,nickname,sex,mobile,
- 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,nickname master_name,
- qualification'];
- $user = WorkerUser::where('id', $data['party_b'])->field($filed)->find();
- if(empty($user)){
- return [];
- }else{
- $user=$user->toArray();
- }
- $user['qualification'] = json_decode($user['qualification'], true);
- if($user['qualification'] && isset($user['qualification']['other_qualifications'])){
- $user['qualification']['other_qualifications']=json_decode($user['qualification']['other_qualifications'],true);
- }
- return $user;
- }
- })
- ->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,master_phone,master_name,
- qualification'];
- $company = Company::where(['id' => $data['party_a']])->field($field)->find()->toArray();
- $company['qualification'] = json_decode($company['qualification'], true);
- if($company['qualification'] && isset($company['qualification']['other_qualifications'])){
- $company['qualification']['other_qualifications']=json_decode($company['qualification']['other_qualifications'],true);
- }
- return $company;
- })
- ->withAttr('area_manager_name', function ($value, $data) {
- return Db::connect('mysql2')->name('la_admin')->where('id', $data['area_manager'])->value('name');
- })
- ->withAttr('contract_type_name', function ($value, $data) {
- return Db::connect('mysql2')->name('la_dict_data')->where('id', $data['contract_type'])->value('name');
- })
- ->withAttr('type_name', function ($value, $data) {
- return $data['type'] == 1 ? '公司' : '个人';
- })
- ->withAttr('status_name', function ($value, $data) {
- return $data['status'] == 1 ? '已签约' : '未签约';
- })
- ->find();
- $data['signed_contract_url'] = self::getSignedContract($data);
- return $data;
- }
-
- /**
- * 获取已签约盖章的合同
- */
- public static function getSignedContract($contract)
- {
- $signedContractUrl = '';
- if($contract['status'] == 1){
- if ($contract['contract_url'] == '') {
- $res = app(JunziqianController::class)->download_file($contract['contract_no'])->getData();
- if ($res['code'] == 1) {
- $signedContractUrl = $res['data']['url'];
- }
- }else {
- $signedContractUrl = env('url.url_prefix').$contract['contract_url'];
- }
- }
- return $signedContractUrl;
- }
-
- //生成合同
- public static function Initiate_contract($data)
- {
- // 平台公司可以直接签合同,其他类型的公司需要做过合同乙方才能签合同
- $partyACompamyInfo = Company::where(['id'=>$data['party_a']])->find();
- if ($partyACompamyInfo['company_type'] != 30) {
- $partyAModel = Contract::where(['party_b' => $data['party_a']])->find();
- if (empty($partyAModel)) {
- return self::setError('当前甲方暂无和平台或上级公司签约,请先进行签约');
- }
- }
- $model = Contract::where(['party_b' => $data['party_b'],'contract_type'=>$data['contract_type']])->find();
- if (empty($model)) {
- $model = new Contract();
- $model->contract_no = time();
- $model->create_time = time();
- }
- if($data['party_a']<=0){
- return self::setError('甲方不能为空');
- }
- if($data['party_b']<=0){
- return self::setError('乙方不能为空');
- }
- if($data['type']==1){
- if($data['party_a'] == $data['party_b']){
- return self::setError('甲方和乙方不能是同一个公司');
- }
- }
- try {
- $model->check_status = 1;
- $model->update_time = time();
- $model->setAttrs($data);
- $res = $model->save($data);
- if($res){
- return ['code'=>1,'msg'=>'发起成功,等待平台风控部上传合同','data'=>['id'=>$model->id]];
- }else{
- return ['code'=>0,'msg'=>'发起失败,请稍后重试',];
- }
- }catch(\Exception $e){
- return ['code'=>0,'msg'=>$e->getMessage()];
- }
-
- }
-
- /**发送合同
- * @type 1公司 2个人
- */
- public static function Draftingcontracts($params,$type=1)
- {
- if($type==1){
- $result = CompanyLogic::detail($params);
- }else{
- $result = WorkerUserLogic::detail($params['id']);
- }
- $result['contract']= Contract::where('id',$params['contract_id'])->with(['party_a_info', 'contractType'])->find();
- if ($result && isset($result['contract']) && isset($result['contract']['file']) && $result['contract']['file'] != '') {
- 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], // 'authLevel'=>[11], 签约时验证人脸识别
- ['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']
- ];
- }
- $res = app(JunziqianController::class)->Signing($data, $result['contract']['id']);
- if ($res->success == true) {
- Db::connect('mysql2')->name('la_contract')->where('id', $result['contract']['id'])->update(['contract_no' => $res->data, 'check_status' => 3]);
- self::postsms(['id'=>$result['contract']['id']]);
- return true;
- } else {
- return self::setError($res->msg);
- }
- } else {
- return self::setError('生成合同成功失败,联系管理员');
- }
- }
-
- //**发送短信 */
- public static function postsms($params)
- {
- $result = self::detail($params);
- Log::info(['发送合同短信', $result]);
- if ($result && $result['file'] != '') {
- //发送短信
- $data = [
- [
- "applyNo" => $result['contract_no'], //TODO *
- "fullName" => $result['party_a_info']['company_name'], //TODO *
- "identityCard" => $result['party_a_info']['organization_code'], //TODO *
- "identityType" => 12, //TODO *
- "master_phone" => $result['party_a_info']['master_phone'],
- "type"=>"party_a"
- ],
- ];
- 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::connect('mysql2')->name('la_contract')->where('id', $params['id'])
- ->withAttr('contract_type_name', function ($value, $data) {
- return Db::connect('mysql2')->name('la_dict_data')->where('id', $data['contract_type'])->value('name');
- })->find();
-
- $url = [];
- foreach ($data as $k => $v) {
- $res = app(JunziqianController::class)->SigningLink($v);
- if ($res->success == true) {
- if ($v['type'] == 'party_a') {
- $url['party_a'] =$res->data;
- } else {
- $url['party_b'] =$res->data;
- }
- //发送短信
- $sms = [
- 'mobile' => $v['master_phone'],
- 'name' => $v['fullName'],
- 'type' => '《' . $find['contract_type_name'] . '》',
- 'code' => 'api/Hetong/url?id=' . $find['id'].'&type='.$v['type'],
- 'scene' => 'WQ'
- ];
- Log::info(['发送合同短信-消息体', $sms]);
- $result = SmsLogic::contractUrl($sms);
- if ($result != true) {
- return self::setError(SmsLogic::getError());
- }
- } else {
- return self::setError($res->msg);
- }
- }
- Db::connect('mysql2')->name('la_contract')->where('id', $find['id'])->update(['url' => json_encode($url)]);
- return true;
- }else{
- return self::setError('没找到合同,联系管理员');
- }
- }
- }
diff --git a/app/common/logic/user/WorkerUserLogic.php b/app/common/logic/user/WorkerUserLogic.php
deleted file mode 100644
index 5ccfd8f8..00000000
--- a/app/common/logic/user/WorkerUserLogic.php
+++ /dev/null
@@ -1,8 +0,0 @@
-value('name');
- }
-
- public function getProvinceNameAttr($value)
- {
- return Db::name('geo_province')->where(['province_code' => $this->province])->value('province_name');
- }
-
- public function getCityNameAttr($value)
- {
- return Db::name('geo_city')->where(['city_code' => $this->city])->value('city_name');
- }
-
- public function getAreaNameAttr($value)
- {
- return Db::name('geo_area')->where(['area_code' => $this->area])->value('area_name');
- }
-
- public function getStreetNameAttr($value)
- {
- return Db::name('geo_street')->where(['street_code' => $this->street])->value('street_name');
- }
-
- public function getVillageNameAttr($value)
- {
- return Db::name('geo_village')->where(['village_code' => $this->village])->value('village_name');
- }
-
- public function getBrigadeNameAttr($value)
- {
- return Db::name('geo_brigade')->where(['id' => $this->brigade])->value('brigade_name');
- }
- public function getAreaManagerNameAttr($value)
- {
- return Db::name('admin')->where(['id' => $this->area_manager])->value('name');
- }
-
- public function getContractAttr()
- {
- $find=Contract::where('party_a|party_b', $this->id)->field('check_status,status')->find();
- if($find){
- return $find->toArray();
- }else{
- return [];
- }
- }
- }
\ No newline at end of file
diff --git a/app/common/model/contract/Contract.php b/app/common/model/contract/Contract.php
deleted file mode 100644
index 909d934f..00000000
--- a/app/common/model/contract/Contract.php
+++ /dev/null
@@ -1,47 +0,0 @@
-hasOne(Company::class, 'id', 'company_id')->bind(['company_name']);
- }
- public function company(): \think\model\relation\HasOne
- {
- return $this->hasOne(Company::class, 'id', 'company_id');
- }
- public function partyAInfo(): \think\model\relation\HasOne
- {
- return $this->hasOne(Company::class, 'id', 'party_a')->field('id,company_name,organization_code,master_name,master_phone,master_email,area_manager');
- }
- public function partyBInfo(): \think\model\relation\HasOne
- {
- return $this->hasOne(Company::class, 'id', 'party_b')->field('id,company_name,organization_code,master_name,master_phone,master_email,area_manager');
- }
- public function partyA(): \think\model\relation\HasOne
- {
- return $this->hasOne(Company::class, 'id', 'party_a')->bind(['party_a_name' => 'company_name']);
- }
- public function partyB(): \think\model\relation\HasOne
- {
- return $this->hasOne(Company::class, 'id', 'party_b')->bind(['party_b_name' => 'company_name']);
- }
- public function contractType(): \think\model\relation\HasOne
- {
- return $this->hasOne(WorkerDictData::class, 'id', 'contract_type')->bind(['contract_type_name' => 'name']);
- }
-
- public function getContractTypeNameAttr($value)
- {
- return WorkerDictData::where(['id' => $this->contract_type])->value('name');
- }
- }
\ No newline at end of file
diff --git a/app/common/model/contract/VehicleContract.php b/app/common/model/contract/VehicleContract.php
deleted file mode 100644
index c1df47e4..00000000
--- a/app/common/model/contract/VehicleContract.php
+++ /dev/null
@@ -1,11 +0,0 @@
- 'town_task_type', 'status' => 1])->column('value', 'id');
- if(isset($townTaskTypeList[$typeId])) {
- return $townTaskTypeList[$typeId];
- }
- return '';
- }
- }
\ No newline at end of file
diff --git a/app/common/model/user/WorkerUser.php b/app/common/model/user/WorkerUser.php
deleted file mode 100644
index 78583611..00000000
--- a/app/common/model/user/WorkerUser.php
+++ /dev/null
@@ -1,11 +0,0 @@
- $value) {
- if(is_null($value)){
- continue;
- }else if($ignoreParams!=null&&in_array($key, $ignoreParams)){
- continue;
- }else if(is_a($value,'CURLFile')){
- $array[$key] = $value;//文件直接处理
- }else if(is_array($value)){
- $array[$key] = CommonUtil::json_encode($value);//文件直接处理
- }else if(is_a($value,"com\junziqian\sdk\bean\Req2MapInterface")){
- $array[$key] = CommonUtil::json_encode($value);//
- }else if(is_object($value)){
- //is_object 对数字、数组等都是返回false
- $array[$key] = CommonUtil::json_encode($value);//
- }else{
- if(is_string($value)&&""==$value){
- continue;
- }
- $array[$key] = $value;//文件直接处理
- }
- }
- return $array;
- }
-}
\ No newline at end of file
diff --git a/extend/junziqian/sdk/bean/req/sign/ApplySignReq.php b/extend/junziqian/sdk/bean/req/sign/ApplySignReq.php
deleted file mode 100644
index 0c604f74..00000000
--- a/extend/junziqian/sdk/bean/req/sign/ApplySignReq.php
+++ /dev/null
@@ -1,110 +0,0 @@
-attachFiles!=null&&sizeof($this->attachFiles)>0){
- $i=0;
- foreach($this->attachFiles as $value){
- $arr["attachFiles[".$i."]"]=$value;
- $i = $i+1;
- }
- }
- return $arr;
- }
-
-}
\ No newline at end of file
diff --git a/extend/junziqian/sdk/bean/req/sign/ext/SequenceInfo.php b/extend/junziqian/sdk/bean/req/sign/ext/SequenceInfo.php
deleted file mode 100644
index 6deb37e8..00000000
--- a/extend/junziqian/sdk/bean/req/sign/ext/SequenceInfo.php
+++ /dev/null
@@ -1,31 +0,0 @@
-businessNo = $businessNo;
- $this->sequenceOrder = $sequenceOrder;
- $this->totalNum = $totalNum;
- }
-
-}
\ No newline at end of file
diff --git a/extend/junziqian/sdk/bean/req/sign/ext/SignatoryReq.php b/extend/junziqian/sdk/bean/req/sign/ext/SignatoryReq.php
deleted file mode 100644
index 44cc7800..00000000
--- a/extend/junziqian/sdk/bean/req/sign/ext/SignatoryReq.php
+++ /dev/null
@@ -1,88 +0,0 @@
-serviceUrl = $serviceUrl;
- $this->appkey = $appkey;
- $this->appSecret = $appSecret;
- $this->encryMethod = $encryMethod;
- $this->tsType = $tsType;
- if(!is_null($this->encryMethod)){
- $this->encryMethod=strtolower($this->encryMethod);
- }
- }
-
- /**
- * @param $path
- * @return object
- */
- public function doPost($path,$req=null){
- Assert::notBlank($path,"path不能为空");
- $url=$this->serviceUrl.$path;
- if($req==null){
- $req=Array();
- }else if(is_array($req)){
- //
- }else if(is_a($req,"junziqian\sdk\bean\Req2MapInterface")){
- $req=$req->build();
- }else{
- throw new ResultInfoException("不支持的请求req");
- }
- $req=$this->fillSign($req);
- // Log::error([$url,json_encode($req)]);
- //请求服务端sass
- // halt($url,$req);
- //print_r(CommonUtil::json_encode($req));
- $response= HttpClientUtils::getPost($url,$req);
- $res=json_decode($response);
- Assert::notNull($res,"不能转换为JSON:".$response);
- return $res;
- }
-
- /**
- * 填充签名数据
- * @param $req array
- */
- public function fillSign($req){
- /**默认加密方式:不输入使用sha256,其它可选择项md5,sha1,sha3-256*/
- $ts=time();
- if($this->tsType==1){
- $ts=$ts*1000;
- }
- $sign=null;
- $nonce= md5($ts."");
- $signSrc="nonce".$nonce."ts".$ts."app_key".$this->appkey."app_secret".$this->appSecret;
- if($this->encryMethod==null||$this->encryMethod=="sha256"){
- $sign=ShaUtils::getSha256($signSrc);
- }else if($this->encryMethod=="sha1"){
- $sign=ShaUtils::getSha1($signSrc);
- }else if($this->encryMethod=="md5"){
- $sign=md5($signSrc);
- }else{
- throw new ResultInfoException($this->encryMethod.",必须为md5,sha1,sha256之一","PARAM_ERROR");
- }
- $req['ts']=$ts;
- $req['app_key']=$this->appkey;
- $req['sign']=$sign;
- $req['nonce']=$nonce;//这只是为了生成一个随机值
- if($this->encryMethod!=null){
- $req['encry_method']=$this->encryMethod;//为''也不能传
- }
- return $req;
- }
-}
\ No newline at end of file
diff --git a/extend/junziqian/sdk/util/ShaUtils.php b/extend/junziqian/sdk/util/ShaUtils.php
deleted file mode 100644
index 2ccee988..00000000
--- a/extend/junziqian/sdk/util/ShaUtils.php
+++ /dev/null
@@ -1,56 +0,0 @@
-resultCode;
- }
-}
\ No newline at end of file
diff --git a/extend/junziqian/sdk/util/http/HttpClientUtils.php b/extend/junziqian/sdk/util/http/HttpClientUtils.php
deleted file mode 100644
index 46b529a8..00000000
--- a/extend/junziqian/sdk/util/http/HttpClientUtils.php
+++ /dev/null
@@ -1,89 +0,0 @@
- $v ) {
- $headerArr[] = $n .':' . $v;
- }
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
- curl_setopt($ch, CURLOPT_HTTPHEADER, $headerArr);
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
- $temp = curl_exec($ch);
- if(@file_put_contents($file, $temp) && !curl_error($ch)) {
- return $file;
- } else {
- throw new ResultInfoException(curl_error($ch),"POST_ERROR");
- }
- } else {
- $params = array(
- "http"=>array(
- "method"=>"GET",
- "header"=>"User-Agent:windows",
- "timeout"=>$timeout)
- );
- $context = stream_context_create($params);
- if(@copy($url, $file, $context)) {
- //$http_response_header
- return $file;
- } else {
- return false;
- }
- }
- }
-}
\ No newline at end of file