调整位置

This commit is contained in:
mkm 2023-08-03 12:47:20 +08:00
parent 6ec71df1e3
commit 0f0a1f72c2
4 changed files with 105 additions and 118 deletions

View File

@ -24,6 +24,7 @@ use app\api\logic\SmsLogic;
use app\common\model\auth\Admin;
use app\common\model\Company;
use think\facade\Db;
use app\common\logic\CompanyLogic as CommonCompanyLogic;
/**
* Company控制器
@ -116,92 +117,38 @@ class CompanyController extends BaseAdminController
$result = CompanyLogic::detail($params);
return $this->data($result);
}
//**发起合同 */
public function initiate_contract()
{
$params = $this->request->param();
$params['party_a'] = $this->adminInfo['company_id'];
$params['type'] = 1;
$result = CommonCompanyLogic::initiate_contract($params);
if ($result == true) {
return $this->success('发起成功,等待平台风控部上传合同');
}
return $this->fail(CommonCompanyLogic::getError());
}
// /**生成合同 */
public function Draftingcontracts()
{
$params = (new CompanyValidate())->goCheck('detail');
$result = CompanyLogic::detail($params);
if ($result && $result['contract'] && $result['contract']['file'] != '') {
$data = [
'name' => $result['company_name'] . '合同',
'signatories' => [['fullName' => $result['company_name'], 'identityType' => 12, 'identityCard' => $result['organization_code'], 'email' => $result['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]);
$company = Db::name('company')->where('id', $params['id'])->find();
if ($company) {
$find = Db::name('contract')->where('party_b', $company['id'])
->withAttr('contract_type_name', function ($value, $data) {
return Db::name('dict_data')->where('id', $data['contract_type'])->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', $find['id'])->update(['url' => $res->data]);
//发送短信
$sms = [
'mobile' => $company['master_phone'],
'name' => $company['company_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());
}
} else {
return $this->fail($res->msg);
}
}
}
return $this->success('生成合同成功', [], 1, 1);
} else {
return $this->fail($res->msg);
}
} else {
return $this->fail('生成合同成功失败,联系管理员');
$params = $this->request->param();
$result = CommonCompanyLogic::Draftingcontracts($params);
if ($result == true) {
return $this->success('生成合同成功');
}
return $this->fail(CommonCompanyLogic::getError());
}
//**发送短信 */
public function postsms()
{
$params = (new CompanyValidate())->goCheck('detail');
$company = Db::name('company')->where('id', $params['id'])->find();
if ($company) {
$find = Db::name('contract')->where('party_b', $company['id'])
->withAttr('contract_type_name', function ($value, $data) {
return Db::name('dict_data')->where('id', $data['contract_type'])->value('name');
})
->find();
if ($find) {
//发送短信
$sms = [
'mobile' => $company['master_phone'],
'name' => $company['company_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('发送成功');
$res = CommonCompanyLogic::postsms($params);
if ($res == true) {
return $this->success('发送成功', [], 1, 1);
} else {
return $this->fail(SmsLogic::getError());
}
}
return $this->fail(CommonCompanyLogic::getError());
}
}
@ -275,5 +222,4 @@ class CompanyController extends BaseAdminController
$data['lists'] = $result;
return $this->success('success', $data);
}
}

View File

@ -162,4 +162,16 @@ class CompanyController extends BaseApiController
}
return $this->fail(CommonCompanyLogic::getError());
}
//**发送短信 */
public function postsms()
{
$params = $this->request->param();
$res = CommonCompanyLogic::postsms($params);
if ($res == true) {
return $this->success('发送成功', [], 1, 1);
} else {
return $this->fail(CommonCompanyLogic::getError());
}
}
}

View File

@ -74,7 +74,7 @@ class UserLogic extends BaseLogic
*/
public static function info(int $userId)
{
$user = User::where(['id' => $userId])->with(['admin','company'])
$user = User::where(['id' => $userId])->with(['company'])
->field('id,sn,sex,account,password,nickname,real_name,avatar,mobile,create_time,user_money,income,admin_id,company_id,is_captain')
->findOrEmpty();
// $user['avatar'] = $user['avatar'] ? Request()->host() . $user['avatar'] : $user['avatar'];

View File

@ -27,7 +27,7 @@ use app\api\controller\JunziqianController;
use app\api\logic\SmsLogic;
/**
* Company逻辑
* 公司逻辑
* Class CompanyLogic
* @package app\adminapi\logic
*/
@ -289,4 +289,33 @@ class CompanyLogic extends BaseLogic
return self::setError('生成合同成功失败,联系管理员');
}
}
//**发送短信 */
public static function postsms($params)
{
$company = Db::name('company')->where('id', $params['id'])->find();
if ($company) {
$find = Db::name('contract')->where('party_b', $company['id'])
->withAttr('contract_type_name', function ($value, $data) {
return Db::name('dict_data')->where('id', $data['contract_type'])->value('name');
})
->find();
if ($find) {
//发送短信
$sms = [
'mobile' => $company['master_phone'],
'name' => $company['company_name'],
'type' => '《' . $find['contract_type_name'] . '》',
'code' => 'api/Hetong/url?id='.$find['id'],
'scene' => 'WQ'
];
$result = SmsLogic::contractUrl($sms);
if (true === $result) {
return true;
} else {
return self::setError(SmsLogic::getError());
}
}
}
}
}