调整位置
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) {
|
} else {
|
||||||
return Db::name('dict_data')->where('id', $data['contract_type'])->value('name');
|
return $this->fail(CommonCompanyLogic::getError());
|
||||||
})
|
|
||||||
->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 {
|
|
||||||
return $this->fail(SmsLogic::getError());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -221,7 +168,7 @@ class CompanyController extends BaseAdminController
|
|||||||
];
|
];
|
||||||
$res = app(JunziqianController::class)->EnterpriseCertification($data);
|
$res = app(JunziqianController::class)->EnterpriseCertification($data);
|
||||||
if ($res->success == true) {
|
if ($res->success == true) {
|
||||||
Db::name('company')->where('id', $params['id'])->update(['master_email' => $res->data,'is_authentication'=>1]);
|
Db::name('company')->where('id', $params['id'])->update(['master_email' => $res->data, 'is_authentication' => 1]);
|
||||||
return $this->success('认证成功', ['email' => $res->data], 1, 1);
|
return $this->success('认证成功', ['email' => $res->data], 1, 1);
|
||||||
} else {
|
} else {
|
||||||
return $this->fail($res->msg);
|
return $this->fail($res->msg);
|
||||||
@ -271,9 +218,8 @@ class CompanyController extends BaseAdminController
|
|||||||
public function subordinate($company_id)
|
public function subordinate($company_id)
|
||||||
{
|
{
|
||||||
$company = Company::findOrEmpty($company_id);
|
$company = Company::findOrEmpty($company_id);
|
||||||
$result = loopGetChild(Company::class, $company->id, 'level_one','company_name,id,company_type,area,area area_name,street,street street_name,is_contract,area_manager,area_manager area_manager_name,master_name,master_phone');
|
$result = loopGetChild(Company::class, $company->id, 'level_one', 'company_name,id,company_type,area,area area_name,street,street street_name,is_contract,area_manager,area_manager area_manager_name,master_name,master_phone');
|
||||||
$data['lists']=$result;
|
$data['lists'] = $result;
|
||||||
return $this->success('success', $data);
|
return $this->success('success', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ class CompanyController extends BaseApiController
|
|||||||
[$page, $limit] = $this->getPage();
|
[$page, $limit] = $this->getPage();
|
||||||
$myCompany = Company::findOrEmpty($this->userInfo['company_id'])->toArray();
|
$myCompany = Company::findOrEmpty($this->userInfo['company_id'])->toArray();
|
||||||
$companyIds = Contract::where('party_a', $myCompany['id'])->column('party_b');
|
$companyIds = Contract::where('party_a', $myCompany['id'])->column('party_b');
|
||||||
$query = Company::whereIn('id', $companyIds)->where('status',1)->append(['province_name', 'city_name', 'area_name', 'street_name', 'area_manager_name']);
|
$query = Company::whereIn('id', $companyIds)->where('status', 1)->append(['province_name', 'city_name', 'area_name', 'street_name', 'area_manager_name']);
|
||||||
$count = $query->count();
|
$count = $query->count();
|
||||||
$companies = $query->page($page)->limit($limit)->select()->each(function ($company) {
|
$companies = $query->page($page)->limit($limit)->select()->each(function ($company) {
|
||||||
$company['other_contacts'] = json_decode($company['other_contacts'], true);
|
$company['other_contacts'] = json_decode($company['other_contacts'], true);
|
||||||
@ -42,7 +42,7 @@ class CompanyController extends BaseApiController
|
|||||||
public function unsigned()
|
public function unsigned()
|
||||||
{
|
{
|
||||||
$myCompany = Company::findOrEmpty($this->userInfo['company_id'])->toArray();
|
$myCompany = Company::findOrEmpty($this->userInfo['company_id'])->toArray();
|
||||||
$query = Company::where(['street' => $myCompany['street'], 'company_type' => [17, 18],'is_contract'=>0]);
|
$query = Company::where(['street' => $myCompany['street'], 'company_type' => [17, 18], 'is_contract' => 0]);
|
||||||
$count = $query->count();
|
$count = $query->count();
|
||||||
$companies = $query->field('*,street street_name,area area_name,city city_name,province province_name')->select()->toArray();
|
$companies = $query->field('*,street street_name,area area_name,city city_name,province province_name')->select()->toArray();
|
||||||
return $this->success('', ['count' => $count, 'data' => $companies]);
|
return $this->success('', ['count' => $count, 'data' => $companies]);
|
||||||
@ -74,7 +74,7 @@ class CompanyController extends BaseApiController
|
|||||||
$contract['contract_type_name'] = Db::name('dict_data')->where('id', $contract['contract_type'])->value('name');
|
$contract['contract_type_name'] = Db::name('dict_data')->where('id', $contract['contract_type'])->value('name');
|
||||||
}
|
}
|
||||||
$company['company_type_name'] = Db::name('dict_data')->where('id', $company['company_type'])->value('name');
|
$company['company_type_name'] = Db::name('dict_data')->where('id', $company['company_type'])->value('name');
|
||||||
$company['day_money_count']=UserAccountLog::where(['company_id'=>$company['id'],'action'=>1])->whereDay('create_time')->sum('change_amount');
|
$company['day_money_count'] = UserAccountLog::where(['company_id' => $company['id'], 'action' => 1])->whereDay('create_time')->sum('change_amount');
|
||||||
$users = Admin::where('company_id', $company['id'])->field('id,name,account,phone,qualification')->select()->toArray();
|
$users = Admin::where('company_id', $company['id'])->field('id,name,account,phone,qualification')->select()->toArray();
|
||||||
foreach ($users as &$user) {
|
foreach ($users as &$user) {
|
||||||
$user['is_main'] = $user['id'] == $company['admin_id'] ? 1 : 0;
|
$user['is_main'] = $user['id'] == $company['admin_id'] ? 1 : 0;
|
||||||
@ -100,28 +100,28 @@ class CompanyController extends BaseApiController
|
|||||||
public function users()
|
public function users()
|
||||||
{
|
{
|
||||||
[$page, $limit] = $this->getPage();
|
[$page, $limit] = $this->getPage();
|
||||||
$params = $this->request->param();
|
$params = $this->request->param();
|
||||||
// if($companyId==0){
|
// if($companyId==0){
|
||||||
// $companyId=$this->userInfo['company_id'];
|
// $companyId=$this->userInfo['company_id'];
|
||||||
// }
|
// }
|
||||||
$wehre[]=['company_id','=',$this->userInfo['company_id']];
|
$wehre[] = ['company_id', '=', $this->userInfo['company_id']];
|
||||||
if(isset($params['is_captain'])&& $params['is_captain']==1){
|
if (isset($params['is_captain']) && $params['is_captain'] == 1) {
|
||||||
$wehre[]= ['is_captain','=',1];
|
$wehre[] = ['is_captain', '=', 1];
|
||||||
}
|
}
|
||||||
$query = User::where($wehre);
|
$query = User::where($wehre);
|
||||||
$count = $query->count();
|
$count = $query->count();
|
||||||
$users = $query->page($page)->limit($limit)->with(['company' => function ($query) {
|
$users = $query->page($page)->limit($limit)->with(['company' => function ($query) {
|
||||||
$query->field('id,company_name');
|
$query->field('id,company_name');
|
||||||
}])->append(['province_name', 'city_name', 'area_name', 'street_name'])
|
}])->append(['province_name', 'city_name', 'area_name', 'street_name'])
|
||||||
->field('id,avatar,real_name,account,mobile as phone,province,city,area,street,company_id,qualification,nickname,is_contract,is_captain')
|
->field('id,avatar,real_name,account,mobile as phone,province,city,area,street,company_id,qualification,nickname,is_contract,is_captain')
|
||||||
->select()->each(function ($item, $key) {
|
->select()->each(function ($item, $key) {
|
||||||
if ($item['qualification'] != '') {
|
if ($item['qualification'] != '') {
|
||||||
$item['qualification'] = json_decode($item['qualification'], true);
|
$item['qualification'] = json_decode($item['qualification'], true);
|
||||||
}
|
}
|
||||||
if($item['is_captain']==1){
|
if ($item['is_captain'] == 1) {
|
||||||
$item['informationg_count']=UserInformationg::where(['create_user_id'=>$item['id'],'status'=>1])->count();
|
$item['informationg_count'] = UserInformationg::where(['create_user_id' => $item['id'], 'status' => 1])->count();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return $this->success('success', ['count' => $count, 'data' => $users]);
|
return $this->success('success', ['count' => $count, 'data' => $users]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,26 +140,38 @@ class CompanyController extends BaseApiController
|
|||||||
return $this->success('success', $user);
|
return $this->success('success', $user);
|
||||||
}
|
}
|
||||||
|
|
||||||
//**发起合同 */
|
//**发起合同 */
|
||||||
public function initiate_contract()
|
public function initiate_contract()
|
||||||
{
|
{
|
||||||
$params = $this->request->param();
|
$params = $this->request->param();
|
||||||
$params['party_a']=$this->userInfo['company_id'];
|
$params['party_a'] = $this->userInfo['company_id'];
|
||||||
$params['type']=1;
|
$params['type'] = 1;
|
||||||
$result = CommonCompanyLogic::initiate_contract($params);
|
$result = CommonCompanyLogic::initiate_contract($params);
|
||||||
if($result==true){
|
if ($result == true) {
|
||||||
return $this->success('发起成功,等待平台风控部上传合同');
|
return $this->success('发起成功,等待平台风控部上传合同');
|
||||||
}
|
|
||||||
return $this->fail(CommonCompanyLogic::getError());
|
|
||||||
}
|
}
|
||||||
// /**生成合同 */
|
return $this->fail(CommonCompanyLogic::getError());
|
||||||
public function Draftingcontracts()
|
}
|
||||||
{
|
// /**生成合同 */
|
||||||
$params = $this->request->param();
|
public function Draftingcontracts()
|
||||||
$result = CommonCompanyLogic::Draftingcontracts($params);
|
{
|
||||||
if($result==true){
|
$params = $this->request->param();
|
||||||
return $this->success('生成合同成功');
|
$result = CommonCompanyLogic::Draftingcontracts($params);
|
||||||
}
|
if ($result == true) {
|
||||||
return $this->fail(CommonCompanyLogic::getError());
|
return $this->success('生成合同成功');
|
||||||
}
|
}
|
||||||
|
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