diff --git a/app/adminapi/controller/contract/ContractController.php b/app/adminapi/controller/contract/ContractController.php index ba281437d..3e69009f3 100644 --- a/app/adminapi/controller/contract/ContractController.php +++ b/app/adminapi/controller/contract/ContractController.php @@ -22,7 +22,9 @@ use app\adminapi\logic\contract\ContractLogic; use app\adminapi\validate\contract\ContractValidate; use app\common\model\contract\Contract; use think\facade\Request; - +use think\facade\Db; +use app\api\logic\SmsLogic; +use app\api\controller\JunziqianController; /** * 合同控制器 @@ -117,4 +119,76 @@ class ContractController extends BaseAdminController return $this->fail('上传失败'); } } + + //**发送短信 */ 接口可能要做调整 + + public function postsms() + { + $params = Request::param(); + $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'); + }) + ->withAttr('user_info', function ($value, $data) { + if($data['type']==1){ + return Db::name('admin')->where('id', $data['party_b'])->field('name,phone')->find(); + }else{ + return Db::name('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()); + } + } + } + + //**废除合同 */ + public function abolition() + { + // $params = Request::param(); + // $result = UserLogic::detail($params); + // $find=Db::name('article')->where('id',2)->value('content'); + // $data = [ + // 'name' => $result['name'] . '合同', + // 'signatories' => [['fullName' => $result['name'], 'identityType' => 1, 'identityCard' => $result['id_card'], 'mobile' => $result['account'], 'noNeedVerify' => 1, 'signLevel' => 1]], + // 'url' => $result['contract']['file'], + // 'content'=>''.$find, + // ]; + // $res = app(JunziqianController::class)->html_contract($data,$result['contract']['id']); + // $data = array( + // "applyNo" => $res->data, //TODO * + // "fullName" => $result['name'], //TODO * + // "identityCard" => $result['id_card'], //TODO * + // "identityType" => 1, //TODO * + // ); + // $res = app(JunziqianController::class)->SigningLink($data); + // $sms = [ + // 'mobile' => $result['phone'], + // 'name' => $result['name'], + // 'type' => '《' . $result['contract']['contract_type_name'] . '》', + // 'code' => 'api/Hetong/url?id=' . $result['contract']['id'], + // 'scene' => 'WQ' + // ]; + // $result = SmsLogic::contractUrl($sms); + // if (true === $result) { + // return $this->success('发送成功'); + // } else { + // return $this->fail(SmsLogic::getError()); + // } + // halt($res); + + } } diff --git a/app/adminapi/controller/user/UserController.php b/app/adminapi/controller/user/UserController.php index 7c5518efc..c3c20c97c 100755 --- a/app/adminapi/controller/user/UserController.php +++ b/app/adminapi/controller/user/UserController.php @@ -148,70 +148,4 @@ class UserController extends BaseAdminController return $this->fail('生成合同成功失败,联系管理员'); } } - - //**发送短信 */ 接口可能要做调整 - - public function postsms() - { - $params = Request::param(); - $admin=Db::name('admin')->where('id',$params['id'])->find(); - $find = Db::name('contract')->where('party_b', $params['id']) - ->withAttr('contract_type_name', function ($value, $data) { - return Db::name('dict_data')->where('id', $data['contract_type'])->value('name'); - }) - ->find(); - if ($find && $find['url'] != '') { - //发送短信 - $sms = [ - 'mobile' => $admin['phone'], - 'name' => $admin['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()); - } - } - } - - //**废除合同 */ 接口可能要做调整 - public function abolition() - { - $params = Request::param(); - $result = UserLogic::detail($params); - $find=Db::name('article')->where('id',2)->value('content'); - $data = [ - 'name' => $result['name'] . '合同', - 'signatories' => [['fullName' => $result['name'], 'identityType' => 1, 'identityCard' => $result['id_card'], 'mobile' => $result['account'], 'noNeedVerify' => 1, 'signLevel' => 1]], - 'url' => $result['contract']['file'], - 'content'=>''.$find, - ]; - $res = app(JunziqianController::class)->html_contract($data,$result['contract']['id']); - $data = array( - "applyNo" => $res->data, //TODO * - "fullName" => $result['name'], //TODO * - "identityCard" => $result['id_card'], //TODO * - "identityType" => 1, //TODO * - ); - $res = app(JunziqianController::class)->SigningLink($data); - $sms = [ - 'mobile' => $result['phone'], - 'name' => $result['name'], - 'type' => '《' . $result['contract']['contract_type_name'] . '》', - 'code' => 'api/Hetong/url?id=' . $result['contract']['id'], - 'scene' => 'WQ' - ]; - $result = SmsLogic::contractUrl($sms); - if (true === $result) { - return $this->success('发送成功'); - } else { - return $this->fail(SmsLogic::getError()); - } - halt($res); - - } } \ No newline at end of file diff --git a/vendor/ebaoquan/junziqian_sdk b/vendor/ebaoquan/junziqian_sdk index 1294ea49f..9acc82cd2 160000 --- a/vendor/ebaoquan/junziqian_sdk +++ b/vendor/ebaoquan/junziqian_sdk @@ -1 +1 @@ -Subproject commit 1294ea49ff9ecc4532821f8798304816cbf8dd74 +Subproject commit 9acc82cd23d807280ddd29df2117e7890094d049