调整位置
This commit is contained in:
parent
6ec71df1e3
commit
0f0a1f72c2
@ -24,6 +24,7 @@ use app\api\logic\SmsLogic;
|
|||||||
use app\common\model\auth\Admin;
|
use app\common\model\auth\Admin;
|
||||||
use app\common\model\Company;
|
use app\common\model\Company;
|
||||||
use think\facade\Db;
|
use think\facade\Db;
|
||||||
|
use app\common\logic\CompanyLogic as CommonCompanyLogic;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Company控制器
|
* Company控制器
|
||||||
@ -116,92 +117,38 @@ class CompanyController extends BaseAdminController
|
|||||||
$result = CompanyLogic::detail($params);
|
$result = CompanyLogic::detail($params);
|
||||||
return $this->data($result);
|
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()
|
public function Draftingcontracts()
|
||||||
{
|
{
|
||||||
$params = (new CompanyValidate())->goCheck('detail');
|
$params = $this->request->param();
|
||||||
$result = CompanyLogic::detail($params);
|
$result = CommonCompanyLogic::Draftingcontracts($params);
|
||||||
if ($result && $result['contract'] && $result['contract']['file'] != '') {
|
if ($result == true) {
|
||||||
$data = [
|
return $this->success('生成合同成功');
|
||||||
'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('生成合同成功失败,联系管理员');
|
|
||||||
}
|
}
|
||||||
|
return $this->fail(CommonCompanyLogic::getError());
|
||||||
}
|
}
|
||||||
|
|
||||||
//**发送短信 */
|
//**发送短信 */
|
||||||
public function postsms()
|
public function postsms()
|
||||||
{
|
{
|
||||||
$params = (new CompanyValidate())->goCheck('detail');
|
$params = (new CompanyValidate())->goCheck('detail');
|
||||||
$company = Db::name('company')->where('id', $params['id'])->find();
|
$res = CommonCompanyLogic::postsms($params);
|
||||||
if ($company) {
|
if ($res == true) {
|
||||||
$find = Db::name('contract')->where('party_b', $company['id'])
|
return $this->success('发送成功', [], 1, 1);
|
||||||
->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('发送成功');
|
|
||||||
} else {
|
} else {
|
||||||
return $this->fail(SmsLogic::getError());
|
return $this->fail(CommonCompanyLogic::getError());
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -275,5 +222,4 @@ class CompanyController extends BaseAdminController
|
|||||||
$data['lists'] = $result;
|
$data['lists'] = $result;
|
||||||
return $this->success('success', $data);
|
return $this->success('success', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -162,4 +162,16 @@ class CompanyController extends BaseApiController
|
|||||||
}
|
}
|
||||||
return $this->fail(CommonCompanyLogic::getError());
|
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());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -74,7 +74,7 @@ class UserLogic extends BaseLogic
|
|||||||
*/
|
*/
|
||||||
public static function info(int $userId)
|
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')
|
->field('id,sn,sex,account,password,nickname,real_name,avatar,mobile,create_time,user_money,income,admin_id,company_id,is_captain')
|
||||||
->findOrEmpty();
|
->findOrEmpty();
|
||||||
// $user['avatar'] = $user['avatar'] ? Request()->host() . $user['avatar'] : $user['avatar'];
|
// $user['avatar'] = $user['avatar'] ? Request()->host() . $user['avatar'] : $user['avatar'];
|
||||||
|
@ -27,7 +27,7 @@ use app\api\controller\JunziqianController;
|
|||||||
use app\api\logic\SmsLogic;
|
use app\api\logic\SmsLogic;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Company逻辑
|
* 公司逻辑
|
||||||
* Class CompanyLogic
|
* Class CompanyLogic
|
||||||
* @package app\adminapi\logic
|
* @package app\adminapi\logic
|
||||||
*/
|
*/
|
||||||
@ -289,4 +289,33 @@ class CompanyLogic extends BaseLogic
|
|||||||
return self::setError('生成合同成功失败,联系管理员');
|
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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user