Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
3b86db5d96 |
35
.example.env
35
.example.env
@ -1,34 +1 @@
|
||||
APP_DEBUG = true
|
||||
|
||||
[APP]
|
||||
DEFAULT_TIMEZONE = Asia/Shanghai
|
||||
|
||||
[DATABASE]
|
||||
TYPE = mysql
|
||||
HOSTNAME = 127.0.0.1
|
||||
DATABASE = test
|
||||
USERNAME = username
|
||||
PASSWORD = password
|
||||
HOSTPORT = 3306
|
||||
CHARSET = utf8
|
||||
DEBUG = true
|
||||
PREFIX = la_
|
||||
|
||||
[LANG]
|
||||
default_lang = zh-cn
|
||||
|
||||
[PROJECT]
|
||||
UNIQUE_IDENTIFICATION = likeadmin
|
||||
# 演示环境
|
||||
DEMO_ENV = false
|
||||
|
||||
[DATABASE]
|
||||
TYPE = "mysql"
|
||||
HOSTNAME = "47.109.36.146"
|
||||
DATABASE = "worker_task"
|
||||
USERNAME = "worker_task"
|
||||
PASSWORD = "p4WGD67TezzzX3Mc"
|
||||
HOSTPORT = "3306"
|
||||
CHARSET = "utf8mb4"
|
||||
DEBUG = "0"
|
||||
PREFIX = "la_"
|
||||
APP_DEBUG = true
[APP]
DEFAULT_TIMEZONE = Asia/Shanghai
[DATABASE]
TYPE = mysql
HOSTNAME = 127.0.0.1
DATABASE = test
USERNAME = username
PASSWORD = password
HOSTPORT = 3306
CHARSET = utf8
DEBUG = true
PREFIX = la_
[LANG]
default_lang = zh-cn
[PROJECT]
UNIQUE_IDENTIFICATION = likeadmin
# 演示环境
DEMO_ENV = false
|
7
.gitignore
vendored
7
.gitignore
vendored
@ -6,9 +6,4 @@
|
||||
!/public/uploads/index.html
|
||||
/runtime/*
|
||||
!/runtime/index.html
|
||||
/config/install.lock
|
||||
/public/nginx.htaccess
|
||||
/public/.htaccess
|
||||
vendor/ebaoquan/junziqian_sdk
|
||||
vendor/workerman/workerman.log
|
||||
vendor/workerman/*.pid
|
||||
/config/install.lock
|
@ -20,7 +20,7 @@ install:
|
||||
- composer require --update-no-dev --no-interaction "topthink/think-migration:^1.0"
|
||||
- composer require --update-no-dev --no-interaction "topthink/think-captcha:^1.0"
|
||||
- composer require --update-no-dev --no-interaction "topthink/think-mongo:^1.0"
|
||||
- composer require --update-no-dev --no-interaction "topthink/think-workerim:^1.0"
|
||||
- composer require --update-no-dev --no-interaction "topthink/think-worker:^1.0"
|
||||
- composer require --update-no-dev --no-interaction "topthink/think-helper:^1.0"
|
||||
- composer require --update-no-dev --no-interaction "topthink/think-queue:^1.0"
|
||||
- composer require --update-no-dev --no-interaction "topthink/think-angular:^1.0"
|
||||
|
@ -1,108 +0,0 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\adminapi\controller;
|
||||
|
||||
|
||||
use app\adminapi\controller\BaseAdminController;
|
||||
use app\adminapi\lists\AppUpdateLists;
|
||||
use app\adminapi\logic\AppUpdateLogic;
|
||||
use app\adminapi\validate\AppUpdateValidate;
|
||||
|
||||
|
||||
/**
|
||||
* app更新控制器
|
||||
* Class AppUpdateController
|
||||
* @package app\adminapi\controller
|
||||
*/
|
||||
class AppUpdateController extends BaseAdminController
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取app更新列表
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/08/31 11:08
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new AppUpdateLists());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加app更新
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/08/31 11:08
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$params = (new AppUpdateValidate())->post()->goCheck('add');
|
||||
$result = AppUpdateLogic::add($params);
|
||||
if (true === $result) {
|
||||
return $this->success('添加成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(AppUpdateLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑app更新
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/08/31 11:08
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$params = (new AppUpdateValidate())->post()->goCheck('edit');
|
||||
$result = AppUpdateLogic::edit($params);
|
||||
if (true === $result) {
|
||||
return $this->success('编辑成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(AppUpdateLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除app更新
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/08/31 11:08
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
$params = (new AppUpdateValidate())->post()->goCheck('delete');
|
||||
AppUpdateLogic::delete($params);
|
||||
return $this->success('删除成功', [], 1, 1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取app更新详情
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/08/31 11:08
|
||||
*/
|
||||
public function detail()
|
||||
{
|
||||
$params = (new AppUpdateValidate())->goCheck('detail');
|
||||
$result = AppUpdateLogic::detail($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -6,7 +6,7 @@ use think\facade\Db;
|
||||
|
||||
class CommonController extends BaseAdminController
|
||||
{
|
||||
public array $notNeedLogin = ['city', 'area', 'street','village','brigade'];
|
||||
public array $notNeedLogin = ['city', 'area', 'street'];
|
||||
|
||||
//**省列表 */
|
||||
public function province()
|
||||
@ -31,16 +31,4 @@ class CommonController extends BaseAdminController
|
||||
$data = Db::name('geo_street')->where(['area_code' => $street])->select();
|
||||
return $this->data($data->toArray());
|
||||
}
|
||||
//**村列表 */
|
||||
public function village($village)
|
||||
{
|
||||
$data = Db::name('geo_village')->where(['street_code' => $village])->select();
|
||||
return $this->data($data->toArray());
|
||||
}
|
||||
//**小队列表 */
|
||||
public function brigade()
|
||||
{
|
||||
$data = Db::name('geo_brigade')->select();
|
||||
return $this->data($data->toArray());
|
||||
}
|
||||
}
|
||||
|
@ -1,108 +0,0 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\adminapi\controller;
|
||||
|
||||
|
||||
use app\adminapi\controller\BaseAdminController;
|
||||
use app\adminapi\lists\CompanyComplaintFeedbackLists;
|
||||
use app\adminapi\logic\CompanyComplaintFeedbackLogic;
|
||||
use app\adminapi\validate\CompanyComplaintFeedbackValidate;
|
||||
|
||||
|
||||
/**
|
||||
* CompanyComplaintFeedback控制器
|
||||
* Class CompanyComplaintFeedbackController
|
||||
* @package app\adminapi\controller
|
||||
*/
|
||||
class CompanyComplaintFeedbackController extends BaseAdminController
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/09/23 15:14
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new CompanyComplaintFeedbackLists());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/09/23 15:14
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$params = (new CompanyComplaintFeedbackValidate())->post()->goCheck('add');
|
||||
$result = CompanyComplaintFeedbackLogic::add($params);
|
||||
if (true === $result) {
|
||||
return $this->success('添加成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(CompanyComplaintFeedbackLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/09/23 15:14
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$params = (new CompanyComplaintFeedbackValidate())->post()->goCheck('edit');
|
||||
$result = CompanyComplaintFeedbackLogic::edit($params);
|
||||
if (true === $result) {
|
||||
return $this->success('编辑成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(CompanyComplaintFeedbackLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/09/23 15:14
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
$params = (new CompanyComplaintFeedbackValidate())->post()->goCheck('delete');
|
||||
CompanyComplaintFeedbackLogic::delete($params);
|
||||
return $this->success('删除成功', [], 1, 1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取详情
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/09/23 15:14
|
||||
*/
|
||||
public function detail()
|
||||
{
|
||||
$params = (new CompanyComplaintFeedbackValidate())->goCheck('detail');
|
||||
$result = CompanyComplaintFeedbackLogic::detail($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -17,26 +17,13 @@ namespace app\adminapi\controller;
|
||||
|
||||
|
||||
use app\adminapi\lists\CompanyLists;
|
||||
use app\adminapi\logic\auth\AdminLogic;
|
||||
use app\common\enum\PayEnum;
|
||||
use app\common\logic\CompanyLogic;
|
||||
use app\adminapi\logic\CompanyLogic;
|
||||
use app\adminapi\validate\CompanyValidate;
|
||||
use app\api\controller\JunziqianController;
|
||||
use app\common\logic\RedisLogic;
|
||||
use app\common\model\Approve;
|
||||
use app\api\logic\SmsLogic;
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\Company;
|
||||
use app\common\model\company\CompanyAccountLog;
|
||||
use app\common\model\CompanyDepositVoucher;
|
||||
use app\common\model\recharge\RechargeOrder;
|
||||
use app\common\model\user\UserAccountLog;
|
||||
use think\Exception;
|
||||
use think\facade\Db;
|
||||
use app\common\logic\contract\ContractLogic;
|
||||
use app\common\model\contract\Contract;
|
||||
use app\common\model\task_scheduling\TaskScheduling;
|
||||
use app\common\model\user\User;
|
||||
use think\facade\Log;
|
||||
|
||||
/**
|
||||
* Company控制器
|
||||
@ -45,7 +32,8 @@ use think\facade\Log;
|
||||
*/
|
||||
class CompanyController extends BaseAdminController
|
||||
{
|
||||
public array $notNeedLogin = ['createShopMerchant'];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return \think\response\Json
|
||||
@ -57,10 +45,6 @@ class CompanyController extends BaseAdminController
|
||||
return $this->dataLists(new CompanyLists());
|
||||
}
|
||||
|
||||
public function list_two()
|
||||
{
|
||||
return $this->success('ok', (new CompanyLists())->list_two());
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 添加
|
||||
@ -73,11 +57,10 @@ class CompanyController extends BaseAdminController
|
||||
$params = (new CompanyValidate())->post()->goCheck('add');
|
||||
$params['other_contacts'] = json_encode($params['other_contacts']);
|
||||
$params['qualification'] = json_encode($params['qualification']);
|
||||
$params['area_manager'] = $this->adminId;
|
||||
if (isset($params['responsible_area'])) {
|
||||
$params['responsible_area'] = implode(',', $params['responsible_area']);
|
||||
}
|
||||
$result = CompanyLogic::add($params);
|
||||
if ($this->adminInfo['root'] != 1 && empty($params['contract']['party_a'])) {
|
||||
return $this->fail('签约方不能为空');
|
||||
}
|
||||
if (true === $result) {
|
||||
return $this->success('添加成功', [], 1, 1);
|
||||
}
|
||||
@ -96,8 +79,8 @@ class CompanyController extends BaseAdminController
|
||||
$params = (new CompanyValidate())->post()->goCheck('edit');
|
||||
$params['other_contacts'] = json_encode($params['other_contacts']);
|
||||
$params['qualification'] = json_encode($params['qualification']);
|
||||
if (isset($params['responsible_area'])) {
|
||||
$params['responsible_area'] = implode(',', $params['responsible_area']);
|
||||
if ($this->adminInfo['root'] != 1 && empty($params['contract']['party_a'])) {
|
||||
return $this->fail('签约方不能为空');
|
||||
}
|
||||
$result = CompanyLogic::edit($params);
|
||||
if (true === $result) {
|
||||
@ -116,10 +99,6 @@ class CompanyController extends BaseAdminController
|
||||
public function delete()
|
||||
{
|
||||
$params = (new CompanyValidate())->post()->goCheck('delete');
|
||||
$admin_id = Company::where('id', $params['id'])->value('admin_id');
|
||||
User::where('company_id', $params['id'])->update(['delete_time' => time()]);
|
||||
TaskScheduling::where('company_id', $params['id'])->update(['delete_time' => time()]);
|
||||
AdminLogic::delete(['id' => $admin_id]);
|
||||
CompanyLogic::delete($params);
|
||||
return $this->success('删除成功', [], 1, 1);
|
||||
}
|
||||
@ -137,55 +116,92 @@ class CompanyController extends BaseAdminController
|
||||
$result = CompanyLogic::detail($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
//**发起合同 */
|
||||
public function initiate_contract()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
if (isset($params['party_a']) && $params['party_a'] > 0) {
|
||||
$params['party_a'] = $params['party_a'];
|
||||
} else {
|
||||
$params['party_a'] = $this->adminInfo['company_id'];
|
||||
}
|
||||
//判断是否是租赁合同
|
||||
//如果是租赁合同则必须传递租赁数量参数
|
||||
// if($params['contract_type'] == 29) {
|
||||
// if(empty($params['num'])){
|
||||
// return $this->fail('缺少必要参数');
|
||||
// }
|
||||
// }
|
||||
$area_manager = Company::where('id', $params['party_a'])->value('area_manager');
|
||||
$params['area_manager'] = $area_manager;
|
||||
$params['type'] = 1;
|
||||
$params['party_b'] = $params['id'];
|
||||
unset($params['id']);
|
||||
$result = ContractLogic::initiate_contract($params);
|
||||
if (!empty($result) && $result['code'] == 1) {
|
||||
return $this->success($result['msg'], $result['data'], 1, 1);
|
||||
}
|
||||
return $this->fail(ContractLogic::getError());
|
||||
}
|
||||
|
||||
// /**发送合同 */
|
||||
// /**生成合同 */
|
||||
public function Draftingcontracts()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
$result = ContractLogic::Draftingcontracts($params);
|
||||
if ($result == true) {
|
||||
return $this->success('发送合同成功', [], 1, 1);
|
||||
$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('生成合同成功失败,联系管理员');
|
||||
}
|
||||
return $this->fail(ContractLogic::getError());
|
||||
}
|
||||
|
||||
//**发送短信 */
|
||||
public function postsms()
|
||||
{
|
||||
$params = (new CompanyValidate())->goCheck('detail');
|
||||
$id = Contract::where('party_b', $params['id'])->value('id');
|
||||
$res = ContractLogic::postsms(['id' => $id]);
|
||||
if ($res == true) {
|
||||
return $this->success('发送成功', [], 1, 1);
|
||||
} else {
|
||||
return $this->fail(ContractLogic::getError());
|
||||
$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('发送成功');
|
||||
} else {
|
||||
return $this->fail(SmsLogic::getError());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -202,36 +218,14 @@ class CompanyController extends BaseAdminController
|
||||
'business_license' => 'https://lihai001.oss-cn-chengdu.aliyuncs.com/def/561f8202305171526091317.png', //$qualification['business_license'],
|
||||
'master_name' => $company['master_name'],
|
||||
'master_email' => $company['master_email'],
|
||||
'master_phone' => $company['master_phone'],
|
||||
'master_id_card' => $company['master_id_card'],
|
||||
'id' => $company['id'],
|
||||
];
|
||||
$res = app(JunziqianController::class)->EnterpriseCertification($data);
|
||||
Log::info(['企业认证同步结果',$res]);
|
||||
if ($res->success == true) {
|
||||
// 企业人脸上传
|
||||
// $company['master_email'] = $email; // 法人邮箱
|
||||
// $faceCreateRe = CompanyLogic::originationFaceCreate($company);
|
||||
// if ($faceCreateRe !== true) {
|
||||
// return $this->fail($faceCreateRe);
|
||||
// }
|
||||
//
|
||||
if ($company['company_type'] == 30) {
|
||||
// 平台公司不用初始化生成合同 合同签约暂不用人脸识别,预留人脸采集状态为已采集
|
||||
Db::name('company')->where('id', $params['id'])->update([ 'is_contract'=>1,'face_create_status'=>1]);
|
||||
} else {
|
||||
Db::name('company')->where('id', $params['id'])->update([ 'face_create_status'=>1]);
|
||||
}
|
||||
|
||||
// 加入缓存中,is_callback用于判断是否获取到异步通知
|
||||
RedisLogic::getInstance()->set('authentication_company_id_'.$company['id'], json_encode(['company_id'=>$company['id'],'is_callback'=>0, 'timing'=>time()]));
|
||||
// return $this->success('认证成功',[],1, 1);
|
||||
return $this->success('系统认证中,请稍后刷新页面查看', ['email' => $res->data], 1, 1);
|
||||
Db::name('company')->where('id', $params['id'])->update(['master_email' => $res->data,'is_authentication'=>1]);
|
||||
return $this->success('认证成功', ['email' => $res->data], 1, 1);
|
||||
} else {
|
||||
return $this->fail($res->msg);
|
||||
}
|
||||
} else {
|
||||
return $this->fail("公司不存在");
|
||||
}
|
||||
}
|
||||
//重新认证
|
||||
@ -247,44 +241,17 @@ class CompanyController extends BaseAdminController
|
||||
'business_license' => 'https://lihai001.oss-cn-chengdu.aliyuncs.com/def/561f8202305171526091317.png', //$qualification['business_license'],
|
||||
'master_name' => $company['master_name'],
|
||||
'master_email' => $company['master_email'],
|
||||
'master_phone' => $company['master_phone'],
|
||||
'master_id_card' => $company['master_id_card'],
|
||||
];
|
||||
$res = app(JunziqianController::class)->organizationReapply($data);
|
||||
if ($res->success == true) {
|
||||
Db::name('company')->where('id', $params['id'])->update(['master_email' => $res->data, 'face_create_status'=>1]); //todo 上人脸采集功能时
|
||||
return $this->success('系统认证中,请稍后刷新页面查看', ['email' => $res->data], 1, 1);
|
||||
Db::name('company')->where('id', $params['id'])->update(['master_email' => $res->data]);
|
||||
return $this->success('重新认证成功', ['em'], 1, 1);
|
||||
} else {
|
||||
return $this->fail($res->msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 企业人脸校验上传
|
||||
public function organizationFaceCreate()
|
||||
{
|
||||
$params = (new CompanyValidate())->goCheck('detail');
|
||||
$company = Db::name('company')->where('id', $params['id'])->find();
|
||||
$re = CompanyLogic::originationFaceCreate($company);
|
||||
if ($re === true) {
|
||||
return $this->success('人脸采集中,请稍后刷新页面查看',[],1, 1);
|
||||
} else {
|
||||
return $this->fail($re);
|
||||
}
|
||||
}
|
||||
private function companyCheck($company) {
|
||||
if (empty($company)) {
|
||||
return $this->fail("公司不存在");
|
||||
}
|
||||
if(empty($company['master_id_card'])) {
|
||||
return $this->fail("主联系人证件号为空,无法上传企业人脸");
|
||||
}
|
||||
if(empty($company['master_email'])) {
|
||||
return $this->fail("主联系人邮箱为空,无法上传企业人脸");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function userList()
|
||||
{
|
||||
$existUsers = Company::where('status', '<>', -1)->column('admin_id');
|
||||
@ -303,261 +270,10 @@ class CompanyController extends BaseAdminController
|
||||
*/
|
||||
public function subordinate($company_id)
|
||||
{
|
||||
$ids = Contract::where('party_a', $company_id)->where('status', 1)->where('type', 1)->column('party_b');
|
||||
if ($ids) {
|
||||
$result = Company::where('id', 'in', $ids)->field('company_name,id,company_type,company_type company_type_name,area,area area_name,street,street street_name,is_contract,area_manager,area_manager area_manager_name,master_name,master_phone,is_authentication')->select();
|
||||
} else {
|
||||
$result = [];
|
||||
}
|
||||
$data['lists'] = $result;
|
||||
$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');
|
||||
$data['lists']=$result;
|
||||
return $this->success('success', $data);
|
||||
}
|
||||
|
||||
public function responsible_area()
|
||||
{
|
||||
$parmas = $this->request->param();
|
||||
if (!isset($parmas['key']) && isset($parmas['key']) == '' || !isset($parmas['value']) && isset($parmas['value']) == '') {
|
||||
return $this->fail('参数错误');
|
||||
}
|
||||
if ($parmas['key'] == 'city') {
|
||||
$where[] = ['area', '=', 0];
|
||||
}
|
||||
if ($parmas['value'] == '') {
|
||||
return $this->fail('参数不能为空');
|
||||
}
|
||||
$where[] = [$parmas['key'], '=', $parmas['value']];
|
||||
$where[] = ['company_type', '=', $parmas['company_type']];
|
||||
switch ($parmas['key']) {
|
||||
case 'city':
|
||||
// $geo_area=Db::name('geo_area')->where('city_code', '=', $parmas['value'])->column('area_code');
|
||||
// $where[] = ['area', 'in', $geo_area];
|
||||
break;
|
||||
case 'area':
|
||||
$street_code = Db::name('geo_street')->where('area_code', '=', $parmas['value'])->column('street_code');
|
||||
$where[] = ['street', 'in', $street_code];
|
||||
$where[] = ['village', '=', 0];
|
||||
break;
|
||||
case 'street':
|
||||
$street_code = Db::name('geo_village')->where('street_code', '=', $parmas['value'])->column('village_code');
|
||||
$where[] = ['village', 'in', $street_code];
|
||||
$where[] = ['brigade', '=', 0];
|
||||
break;
|
||||
case 'village':
|
||||
// $street_code = Db::name('geo_brigade')->where('street_code', '=', $parmas['value'])->column('village_code');
|
||||
$where[] = ['village', '=', $parmas['value']];
|
||||
// $where[] = ['brigade', '=', 0];
|
||||
break;
|
||||
}
|
||||
|
||||
$res = Company::where($where)->column('responsible_area');
|
||||
|
||||
foreach ($res as $k => $v) {
|
||||
$res[$k] = explode(',', $v);
|
||||
}
|
||||
$data = [];
|
||||
foreach ($res as $k => $v) {
|
||||
foreach ($v as $kk => $vv) {
|
||||
if ($vv != '') {
|
||||
$data[] = $vv;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $this->success('success', array_unique($data));
|
||||
}
|
||||
public function createShopMerchant()
|
||||
{
|
||||
try {
|
||||
$params = $this->request->param();
|
||||
Log::info(['商户入驻申请-请求参数', $params]);
|
||||
// if (empty($params['company_name'])) {
|
||||
// throw new Exception('商户名称不能为空');
|
||||
// }
|
||||
// if (empty($params['organization_code'])) {
|
||||
// throw new Exception('社会统一信用代码不能为空');
|
||||
// }
|
||||
// if (empty($params['master_name'])) {
|
||||
// throw new Exception('商户法人名称不能为空');
|
||||
// }
|
||||
// $master_email=Db::name('company_form')->where('organization_code',$params['organization_code'])->value('master_email');
|
||||
//
|
||||
// $isQueryStatus = false; // 需要进一步查询是否已做过企业认证
|
||||
// // $master_email为空表示没有做过认证
|
||||
// if($master_email){
|
||||
// $isQueryStatus = true;asdasd,fsdfdf
|
||||
// }else{
|
||||
// $master_email=substr(md5(uniqid()),rand(0, 22),10)."@lihai.com";
|
||||
// }
|
||||
|
||||
// 市级供应链直接和海之农签约
|
||||
if (isset($params['type_id']) && $params['type_id'] == 12) {
|
||||
$company = Company::where(['company_name' => '泸州市海之农科技有限公司'])->find();
|
||||
} else {
|
||||
// 根据street码查询所属镇农科公司
|
||||
$company_select=Db::query("select * from la_company where company_type=:company_type and FIND_IN_SET(:street,responsible_area)", ['company_type' => 41,'street'=>$params['street']], true);
|
||||
if(empty($company_select)) {
|
||||
throw new Exception('当前区域无镇农科公司');
|
||||
}
|
||||
$company=$company_select[0];
|
||||
}
|
||||
$data = [
|
||||
'mer_intention_id' => $params['mer_intention_id']??'', // 商城商户入驻申请id,签约完成后回调使用
|
||||
'company_name' => $params['company_name']??'',
|
||||
'mer_name' => $params['mer_name']??'', // 店铺名称
|
||||
'organization_code' => $params['organization_code']??'',
|
||||
'city' => $params['city']??'',
|
||||
'area' => $params['area']??'',
|
||||
'street' => $params['street']??'',
|
||||
'address' => $params['address']??'',
|
||||
'master_name' => $params['master_name']??'',
|
||||
'master_phone' => $params['master_phone']??'',
|
||||
'master_email' => $master_email??'',
|
||||
'type_name' => $params['type_name'] ?? '', //店铺类型
|
||||
'category_name' => $params['category_name'] ?? '', //商户分类
|
||||
'qualification' => !empty($params['images'])?$params['images']:json_encode([])
|
||||
];
|
||||
$approveModel = new Approve();
|
||||
$shopApproveType = $params['type']; // 商户申请类型 1入驻 2开通交易
|
||||
// 插入审批流
|
||||
$approveModel->type = $shopApproveType == 1? 2: 3; // 审批类型,后台配置 1 其他任务 2商户入驻 3开通交易
|
||||
$approveModel->flow_id = 2;
|
||||
$approveModel->name = $shopApproveType == 1? '商户入驻审批': '开通交易审批';
|
||||
$approveModel->admin_id = 0; // 后台发起人id 暂时为0
|
||||
$approveModel->department_id = '0';
|
||||
$approveModel->check_admin_ids = $company['admin_id']; // 当前审批人ID 镇农科公司负责人
|
||||
$approveModel->check_status = 1; // 状态 0待审核,1审核中,2审核通过,3审核不通过,4撤销审核
|
||||
$approveModel->other_type = 6;
|
||||
$approveModel->extend = json_encode(array_merge($params, $data));
|
||||
$approveModel->create_time = time();
|
||||
$approveModel->update_time = time();
|
||||
$approveModel->save();
|
||||
|
||||
// $shopMerchantModel = ShopMerchant::create($data);
|
||||
|
||||
// 如果是通滩镇的商户,查询一下企业认证状态,通过的情况,则直接发起生成合同
|
||||
// if ($params['street'] == '510502106' && $isQueryStatus) {
|
||||
// $statusRe = app(JunziqianController::class)->shopMerchantStatusQuery($master_email);
|
||||
// Log::info(['商户入驻请求-通滩镇商户-认证状态查询结果', $statusRe]);
|
||||
// if($statusRe->success == true) {
|
||||
// $statusData = json_decode($statusRe->data, true);
|
||||
// if ($statusData['status'] == 1) {
|
||||
// // 生成合同
|
||||
// $createContractData = [
|
||||
// 'id' => $shopMerchantModel->id,
|
||||
// 'party_a' => 1,
|
||||
// 'party_a_name' => '泸州市海之农科技有限公司',
|
||||
// 'party_b' => $shopMerchantModel->id,
|
||||
// 'party_b_name' => $params['company_name'],
|
||||
// 'contract_type' => 22,
|
||||
// ];
|
||||
// $shopContractModel = new ShopContract();
|
||||
// $shopContractModel->contract_no = time();
|
||||
// $shopContractModel->create_time = time();
|
||||
// $shopContractModel->check_status = 1;
|
||||
// $shopContractModel->update_time = time();
|
||||
// $shopContractModel->setAttrs($createContractData);
|
||||
// $shopContractModel->save($createContractData);
|
||||
// return $this->success('已做过企业认证,直接生成合同成功', [], 1, 1);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
// if (!$shopMerchantModel->isEmpty()) {
|
||||
// // 自动发起企业认证
|
||||
// $shopMerchantCertificationData = [
|
||||
// 'name' => $shopMerchantModel->company_name,
|
||||
// 'organization_code' => $shopMerchantModel->organization_code,
|
||||
// 'business_license' => 'https://lihai001.oss-cn-chengdu.aliyuncs.com/def/561f8202305171526091317.png',
|
||||
// 'master_name' => $shopMerchantModel->master_name,
|
||||
// 'master_email' => $shopMerchantModel->master_email,
|
||||
// 'master_phone' => $shopMerchantModel->master_phone,
|
||||
// 'id' => $shopMerchantModel->id,
|
||||
// ];
|
||||
// app(JunziqianController::class)->ShopMerchantCertification($shopMerchantCertificationData);
|
||||
// } else {
|
||||
// throw new Exception('商户创建失败');
|
||||
// }
|
||||
return $this->success('审批创建成功', [], 1, 1);
|
||||
} catch (Exception $exception) {
|
||||
Log::error(['商户入驻审批失败', $exception->getMessage()]);
|
||||
return $this->fail($exception->getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 押金凭证录入,并将押金写入公司押金账户,新增一条押金充值流水
|
||||
public function depositRechargeTransferVoucher()
|
||||
{
|
||||
try {
|
||||
$param = $this->request->param();
|
||||
Db::startTrans();
|
||||
$data = [
|
||||
'company_id' => $param['company_id'],
|
||||
'deposit' => $param['deposit'],
|
||||
'voucher' => $param['voucher'],
|
||||
'create_admin_id' => $this->adminId,
|
||||
'create_time' => time(),
|
||||
'update_time' => time()
|
||||
];
|
||||
$result = (new CompanyDepositVoucher())->save($data);
|
||||
|
||||
$companyModel = Company::where(['id' => $param['company_id']])->find();
|
||||
$left_amount = bcadd($companyModel['deposit'], $param['deposit'], 2);
|
||||
|
||||
// 添加流水记录
|
||||
$datas = [
|
||||
'sn' => generate_sn(CompanyAccountLog::class, 'sn', 20),
|
||||
'user_id' => 0,
|
||||
'company_id' => $param['company_id'],
|
||||
'change_type' => CompanyAccountLog::COMPANY_DEPOSIT,
|
||||
'change_object' => CompanyAccountLog::DEPOSIT,
|
||||
'action' => 1,
|
||||
'change_amount' => $param['deposit'],
|
||||
'left_amount' =>$left_amount,
|
||||
'remark' => '后台押金转账凭证充值',
|
||||
'status' => 1,
|
||||
];
|
||||
CompanyAccountLog::create($datas);
|
||||
|
||||
// 更新公司押金金额
|
||||
$companyModel->deposit = $left_amount;
|
||||
$companyModel->save();
|
||||
Db::commit();
|
||||
return $this->success('成功');
|
||||
} catch (Exception $exception) {
|
||||
Db::rollback();
|
||||
return $this->fail($exception->getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function getPartyA()
|
||||
{
|
||||
$companyId = $this->request->param('company_id');
|
||||
$re = CompanyLogic::getPartyA($companyId);
|
||||
if ($re === false) {
|
||||
return $this->fail(CompanyLogic::getError());
|
||||
}
|
||||
return $this->success('成功', $re);
|
||||
}
|
||||
|
||||
public function getDepositRechargeTransferVoucherList()
|
||||
{
|
||||
$companyId = $this->request->param('company_id');
|
||||
$re = (new CompanyLists())->list_three($companyId);
|
||||
|
||||
return $this->success('成功', $re);
|
||||
}
|
||||
|
||||
|
||||
public function depositRechargeTransferVoucherDetail()
|
||||
{
|
||||
$param = $this->request->param();
|
||||
$companyDepositVoucher = CompanyDepositVoucher::where(['id' => $param['id']])->findOrEmpty()->toArray();
|
||||
if (empty($companyDepositVoucher)) {
|
||||
return $this->fail('数据不存在');
|
||||
}
|
||||
$contract = Contract::where(['party_b'=>$companyDepositVoucher['company_id']])->with(['partyA', 'partyB'])->findOrEmpty()->toArray();
|
||||
return $this->success('成功', array_merge($companyDepositVoucher, $contract));
|
||||
}
|
||||
}
|
||||
|
@ -1,108 +0,0 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\adminapi\controller;
|
||||
|
||||
|
||||
use app\adminapi\controller\BaseAdminController;
|
||||
use app\adminapi\lists\CompanyFormLists;
|
||||
use app\adminapi\logic\CompanyFormLogic;
|
||||
use app\adminapi\validate\CompanyFormValidate;
|
||||
|
||||
|
||||
/**
|
||||
* CompanyForm控制器
|
||||
* Class CompanyFormController
|
||||
* @package app\adminapi\controller
|
||||
*/
|
||||
class CompanyFormController extends BaseAdminController
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/09/15 14:00
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new CompanyFormLists());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/09/15 14:00
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$params = (new CompanyFormValidate())->post()->goCheck('add');
|
||||
$result = CompanyFormLogic::add($params);
|
||||
if (true === $result) {
|
||||
return $this->success('添加成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(CompanyFormLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/09/15 14:00
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$params = (new CompanyFormValidate())->post()->goCheck('edit');
|
||||
$result = CompanyFormLogic::edit($params);
|
||||
if (true === $result) {
|
||||
return $this->success('编辑成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(CompanyFormLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/09/15 14:00
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
$params = (new CompanyFormValidate())->post()->goCheck('delete');
|
||||
CompanyFormLogic::delete($params);
|
||||
return $this->success('删除成功', [], 1, 1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取详情
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/09/15 14:00
|
||||
*/
|
||||
public function detail()
|
||||
{
|
||||
$params = (new CompanyFormValidate())->goCheck('detail');
|
||||
$result = CompanyFormLogic::detail($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,201 +0,0 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\adminapi\controller;
|
||||
|
||||
|
||||
use app\adminapi\controller\BaseAdminController;
|
||||
use app\adminapi\lists\ShopContractLists;
|
||||
use app\adminapi\logic\ShopContractLogic;
|
||||
use app\adminapi\validate\ShopContractValidate;
|
||||
use app\api\controller\JunziqianController;
|
||||
use app\api\logic\SmsLogic;
|
||||
use app\common\logic\contract\ContractLogic;
|
||||
use app\common\model\Company;
|
||||
use app\common\model\contract\Contract;
|
||||
use app\common\model\ShopContract;
|
||||
use app\common\model\ShopMerchant;
|
||||
use app\Request;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* ShopContract控制器
|
||||
* Class ShopContractController
|
||||
* @package app\adminapi\controller
|
||||
*/
|
||||
class ShopContractController extends BaseAdminController
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/09/13 17:01
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new ShopContractLists());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/09/13 17:01
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$params = (new ShopContractValidate())->post()->goCheck('add');
|
||||
$result = ShopContractLogic::add($params);
|
||||
if (true === $result) {
|
||||
return $this->success('添加成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(ShopContractLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/09/13 17:01
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$params = (new ShopContractValidate())->post()->goCheck('edit');
|
||||
$result = ShopContractLogic::edit($params);
|
||||
if (true === $result) {
|
||||
return $this->success('编辑成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(ShopContractLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/09/13 17:01
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
$params = (new ShopContractValidate())->post()->goCheck('delete');
|
||||
ShopContractLogic::delete($params);
|
||||
return $this->success('删除成功', [], 1, 1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取详情
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/09/13 17:01
|
||||
*/
|
||||
public function detail()
|
||||
{
|
||||
$params = (new ShopContractValidate())->goCheck('detail');
|
||||
$result = ShopContractLogic::detail($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
// 上传合同
|
||||
public function wind_control()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
$file = $params['file'];
|
||||
$res = ShopContract::where('id', $params['id'])->update(['file' => $file, 'check_status' => 2]);
|
||||
if ($res) {
|
||||
$find = ShopContract::where('id', $params['id'])->field('type,party_b,party_a')
|
||||
->find()->toArray();
|
||||
|
||||
$find['party_a_info'] = ShopMerchant::where('id', $find['party_a'])->field('company_name name,master_phone phone')->find()->toArray();
|
||||
$find['party_b_info'] = ShopMerchant::where('id', $find['party_b'])->field('company_name name,master_phone phone')->find()->toArray();
|
||||
|
||||
$a = [
|
||||
'mobile' => $find['party_a_info']['phone'],
|
||||
'name' => $find['party_a_info']['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 Draftingcontracts()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
$result = ShopContractLogic::Draftingcontracts($params);
|
||||
if ($result == true) {
|
||||
return $this->success('生成合同成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(ContractLogic::getError());
|
||||
}
|
||||
|
||||
//**发送短信 */ 接口可能要做调整
|
||||
|
||||
public function postsms()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
$re = ShopContractLogic::postsms($params);
|
||||
if (!$re) {
|
||||
return $this->fail(ShopContractLogic::getError());
|
||||
}
|
||||
return $this->success('成功');
|
||||
}
|
||||
|
||||
public function evidence()
|
||||
{
|
||||
$id = $this->request->param('id');
|
||||
$detail=ShopContract::where('id',$id)->find();
|
||||
if(!empty($detail['evidence_url'])){
|
||||
return $this->success('获取成功', ['url' => env('url.url_prefix').$detail['evidence_url']]);
|
||||
}
|
||||
$company=ShopMerchant::where('id',$detail['party_a'])->find();
|
||||
$request = array(
|
||||
"applyNo" => $detail['contract_no'],
|
||||
"fullName" => $company['company_name'],
|
||||
"identityCard" => $company['organization_code'],
|
||||
"identityType" => 12,
|
||||
);
|
||||
return app(JunziqianController::class)->EvidenceShopDownload($request);
|
||||
}
|
||||
|
||||
public function addNote()
|
||||
{
|
||||
$params = $this->request->param(); // id notes
|
||||
$shopContract = ShopContract::where('id', $params['id'])->find();
|
||||
if (empty($shopContract)) {
|
||||
return $this->fail('合同不存在');
|
||||
}
|
||||
$shopContract->notes = $params['notes'];
|
||||
$shopContract->save();
|
||||
return $this->success('成功');
|
||||
}
|
||||
}
|
@ -1,108 +0,0 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\adminapi\controller;
|
||||
|
||||
|
||||
use app\adminapi\controller\BaseAdminController;
|
||||
use app\adminapi\lists\ShopMerchantLists;
|
||||
use app\adminapi\logic\ShopMerchantLogic;
|
||||
use app\adminapi\validate\ShopMerchantValidate;
|
||||
|
||||
|
||||
/**
|
||||
* ShopMerchant控制器
|
||||
* Class ShopMerchantController
|
||||
* @package app\adminapi\controller
|
||||
*/
|
||||
class ShopMerchantController extends BaseAdminController
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/09/13 16:45
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new ShopMerchantLists());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/09/13 16:45
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$params = (new ShopMerchantValidate())->post()->goCheck('add');
|
||||
$result = ShopMerchantLogic::add($params);
|
||||
if (true === $result) {
|
||||
return $this->success('添加成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(ShopMerchantLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/09/13 16:45
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$params = (new ShopMerchantValidate())->post()->goCheck('edit');
|
||||
$result = ShopMerchantLogic::edit($params);
|
||||
if (true === $result) {
|
||||
return $this->success('编辑成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(ShopMerchantLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/09/13 16:45
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
$params = (new ShopMerchantValidate())->post()->goCheck('delete');
|
||||
ShopMerchantLogic::delete($params);
|
||||
return $this->success('删除成功', [], 1, 1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取详情
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/09/13 16:45
|
||||
*/
|
||||
public function detail()
|
||||
{
|
||||
$params = (new ShopMerchantValidate())->goCheck('detail');
|
||||
$result = ShopMerchantLogic::detail($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,427 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace app\adminapi\controller\approve;
|
||||
|
||||
use app\adminapi\controller\BaseAdminController;
|
||||
use app\adminapi\lists\approve\ApproveLists;
|
||||
use app\common\enum\user\AccountLogEnum;
|
||||
use app\common\logic\AccountLogLogic;
|
||||
use app\common\logic\task\TaskLogic;
|
||||
use app\common\model\Approve;
|
||||
use app\common\model\Company;
|
||||
use app\common\model\company\CompanyAccountLog;
|
||||
use app\common\model\task\Task;
|
||||
use app\common\model\task_scheduling_plan\TaskSchedulingPlan;
|
||||
use app\common\model\task_template\TaskTemplate;
|
||||
use app\common\model\user\User;
|
||||
use app\common\model\user\UserAccountLog;
|
||||
use think\facade\Db;
|
||||
|
||||
class ApproveController extends BaseAdminController
|
||||
{
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new ApproveLists());
|
||||
}
|
||||
|
||||
public function lists2()
|
||||
{
|
||||
return $this->success('成功',(new ApproveLists())->lists2());
|
||||
}
|
||||
|
||||
public function lists3()
|
||||
{
|
||||
return $this->success('成功',(new ApproveLists())->lists3());
|
||||
}
|
||||
public function audit()
|
||||
{
|
||||
try {
|
||||
$params = $this->request->param(); // id check_status remark amount
|
||||
$approve = Approve::find($params['id']);
|
||||
if (!$approve) {
|
||||
$this->fail('数据不存在');
|
||||
}
|
||||
|
||||
Db::startTrans();
|
||||
// 拒绝通过 要让用户今天可以继续做任务
|
||||
if ($params['check_status'] == 3) {
|
||||
$this->refuse($params, $approve);
|
||||
}
|
||||
// 修改任务完成状态
|
||||
if ($params['check_status'] == 2) {
|
||||
if ($approve->type == Approve::APPROVE_TYPE_7) {
|
||||
$taskTemplate = TaskTemplate::where(['id'=>$approve->business_id])->find();
|
||||
// 提前完成
|
||||
if ($taskTemplate['day_count'] < $taskTemplate['stage_day_one']) {
|
||||
if (bccomp($params['amount'], 300000, 2) == -1) {
|
||||
return $this->fail('该任务提前完成条件:销售总额必须达到30万元及以上');
|
||||
} else {
|
||||
// 提前完成标识
|
||||
$extend = $taskTemplate['extend'];
|
||||
$extend['early_finish'] = 1;
|
||||
$taskTemplate->extend = json_encode($extend);
|
||||
$taskTemplate->save();
|
||||
$this->pass($approve, $params);
|
||||
}
|
||||
} else {
|
||||
$this->pass($approve, $params);
|
||||
}
|
||||
} else {
|
||||
$this->pass($approve, $params);
|
||||
}
|
||||
|
||||
}
|
||||
Db::commit();
|
||||
return $this->success('审核成功');
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
return $this->fail($e->getFile().$e->getLine().$e->getMessage());
|
||||
}
|
||||
}
|
||||
// 通过
|
||||
private function pass($approve, $params=[])
|
||||
{
|
||||
Db::startTrans();
|
||||
$approve->check_status = 2;
|
||||
$approve->update_time = time();
|
||||
$approve->save();
|
||||
// 任务
|
||||
$task = Task::find($approve['task_id']);
|
||||
if ($task['status'] == 2) {
|
||||
$task->status = 3;
|
||||
$task->save();
|
||||
}
|
||||
Db::commit();
|
||||
|
||||
// 镇合伙人公司任务-数字农贸宣传业务、加工业务的建设和招商工作任务 结算
|
||||
if ($approve->type == Approve::APPROVE_TYPE_4) {
|
||||
$taskSchedulePlan = TaskSchedulingPlan::where('la_task_scheduling_plan.id', $task['scheduling_plan_id'])
|
||||
->where('is_pay',0)
|
||||
->with(['template_info'])
|
||||
->withJoin(['scheduling'], 'left')
|
||||
->where('scheduling.company_type', 16)
|
||||
->find()
|
||||
->toArray();
|
||||
TaskLogic::dealTaskMarketingDirector10($taskSchedulePlan, $approve);
|
||||
}
|
||||
|
||||
if ($approve->type == Approve::APPROVE_TYPE_5) {
|
||||
$taskSchedulePlan = TaskSchedulingPlan::where('la_task_scheduling_plan.id', $task['scheduling_plan_id'])
|
||||
->where('is_pay',0)
|
||||
->with(['template_info'])
|
||||
->withJoin(['scheduling'], 'left')
|
||||
->where('scheduling.company_type', 17)
|
||||
->find()
|
||||
->toArray();
|
||||
TaskLogic::dealVillageTask6($taskSchedulePlan);
|
||||
}
|
||||
|
||||
if ($approve->type == Approve::APPROVE_TYPE_6) {
|
||||
$taskSchedulePlan = TaskSchedulingPlan::where('la_task_scheduling_plan.id', $task['scheduling_plan_id'])
|
||||
->where('is_pay',0)
|
||||
->with(['template_info'])
|
||||
->withJoin(['scheduling'], 'left')
|
||||
->where('scheduling.company_type', 17)
|
||||
->find()
|
||||
->toArray();
|
||||
TaskLogic::dealVillageTask8($taskSchedulePlan);
|
||||
}
|
||||
if ($approve->type == Approve::APPROVE_TYPE_7) {
|
||||
// 需要手动输入销售总额
|
||||
$approve->amount = $params['amount'];
|
||||
$approve->save();
|
||||
}
|
||||
if ($approve->type == Approve::APPROVE_TYPE_8) {
|
||||
// 需要手动输入申请的政策补贴金额
|
||||
$approve->amount = $params['amount'];
|
||||
$approve->save();
|
||||
$taskSchedulePlan = TaskSchedulingPlan::where('la_task_scheduling_plan.id', $task['scheduling_plan_id'])
|
||||
->where('is_pay',0)
|
||||
->with(['template_info'])
|
||||
->withJoin(['scheduling'], 'left')
|
||||
->where('scheduling.company_type', 16)
|
||||
->find()
|
||||
->toArray();
|
||||
TaskLogic::masterTask7Settlement($taskSchedulePlan);
|
||||
}
|
||||
if ($approve->type == Approve::APPROVE_TYPE_9) {
|
||||
$taskSchedulePlan = TaskSchedulingPlan::where('la_task_scheduling_plan.id', $task['scheduling_plan_id'])
|
||||
->where('is_pay',0)
|
||||
->with(['template_info'])
|
||||
->withJoin(['scheduling'], 'left')
|
||||
->where('scheduling.company_type', 16)
|
||||
->find()
|
||||
->toArray();
|
||||
TaskLogic::masterTask8Settlement($taskSchedulePlan);
|
||||
}
|
||||
}
|
||||
|
||||
// 拒绝
|
||||
private function refuse($params, $approve)
|
||||
{
|
||||
$approve->check_status = $params['check_status'];
|
||||
$approve->remark = $params['remark'];
|
||||
$approve->update_time = time();
|
||||
$approve->save();
|
||||
|
||||
// 更新schedule_plan时间和task的时间为今天依旧可提交
|
||||
$schedulePlan = TaskSchedulingPlan::find(['tast_id' => $approve['task_id']]);
|
||||
if (empty($schedule_plan)) {
|
||||
return $this->fail('数据异常,任务计划不存在');
|
||||
}
|
||||
$time = strtotime(date('Y-m-d'));
|
||||
TaskSchedulingPlan::where(['id' => $schedulePlan['id']])->update([
|
||||
'start_time'=>$time,
|
||||
'end_time'=>$time + 86399
|
||||
]);
|
||||
Task::where('id', $approve['task_id'])->update([
|
||||
'start_time'=>$time,
|
||||
'end_time'=>$time + 86399
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 股金任务审批
|
||||
*/
|
||||
public function shareholderMoneyTaskAudit()
|
||||
{
|
||||
// try {
|
||||
$params = $this->request->param(); // id check_status remark
|
||||
$approve = Approve::find($params['id']);
|
||||
if (!empty($approve)) {
|
||||
$this->fail('数据不存在');
|
||||
}
|
||||
// 拒绝通过 要让用户今天可以继续做任务
|
||||
if ($params['check_status'] == 3) {
|
||||
$this->refuse1($params, $approve);
|
||||
}
|
||||
if ($params['check_status'] == 2) {
|
||||
$this->pass1($approve, $params);
|
||||
}
|
||||
// } catch (\Exception $e) {
|
||||
// return $this->fail($e->getMessage());
|
||||
// }
|
||||
}
|
||||
|
||||
private function refuse1($params, $approve)
|
||||
{
|
||||
$approve->check_status = $params['check_status'];
|
||||
$approve->remark = $params['remark'];
|
||||
$approve->update_time = time();
|
||||
$approve->save();
|
||||
}
|
||||
|
||||
private function pass1($approve, $params)
|
||||
{
|
||||
Db::startTrans();
|
||||
|
||||
// 审批
|
||||
$approve->check_status = 2;
|
||||
$approve->update_time = time();
|
||||
$approve->remark = $params['remark'];
|
||||
$approve->save();
|
||||
|
||||
// 任务
|
||||
$task = Task::find($approve['task_id']);
|
||||
if ($task['status'] == 2) {
|
||||
$task->status = 3;
|
||||
$task->save();
|
||||
}
|
||||
Db::commit();
|
||||
// 小组服务公司股金上交 小组服务团队-入股任务
|
||||
// if ($approve->type == Approve::APPROVE_TYPE_10) {
|
||||
// // 小组服务公司
|
||||
// $subordinateCompany = Company::where(['id'=>$approve->department_id])->find();
|
||||
// // 村公司
|
||||
// $parentCompany = Company::where(['village'=>$subordinateCompany['village'], 'company_type'=>17])->find();
|
||||
// }
|
||||
//
|
||||
// // 村联络员-督促小组服务团队入股任务
|
||||
// if ( $approve->type == Approve::APPROVE_TYPE_11) {
|
||||
// $parentCompany = Company::where(['id'=>$approve->department_id])->find();
|
||||
// }
|
||||
//
|
||||
// // 村管理公司股金上交 村联络员任务-入股甲方公司
|
||||
// if ($approve->type == Approve::APPROVE_TYPE_12) {
|
||||
// // 村公司
|
||||
// $subordinateCompany = Company::where(['id'=>$approve->department_id])->find();
|
||||
// // 镇农科公司 负责区域包含有村公司的street码
|
||||
// $parentCompany = Db::query("select * from la_company where company_type=:company_type and FIND_IN_SET(:street,responsible_area)", ['company_type' => 41,'street'=>$subordinateCompany['street']], true)[0];
|
||||
// }
|
||||
//
|
||||
// // 镇农科服务部长-督促小组服务团队入股村管理公司任务
|
||||
// if ($approve->type == Approve::APPROVE_TYPE_13) {
|
||||
// $parentCompany = Company::where(['id'=>$approve->department_id])->find(); //无法确定那个小组服务公司入股到哪个村管理公司
|
||||
// }
|
||||
//
|
||||
// // 镇农科负责人任务-促成村联络员入股甲方
|
||||
// if ($approve->type == Approve::APPROVE_TYPE_14) {
|
||||
// // 镇农科公司
|
||||
// $parentCompany = Company::where(['id'=>$approve->department_id])->find();
|
||||
// }
|
||||
//
|
||||
// $amount = $approve->amount; // 上交股金金额
|
||||
//
|
||||
// $subordinateCompany->shareholder_money = $amount;
|
||||
// $subordinateCompany->save();
|
||||
//
|
||||
// // 添加入股记录
|
||||
// $this->addConpanyAccountLog($parentCompany, $amount, $task);
|
||||
|
||||
|
||||
// 小组服务团队-入股任务结算
|
||||
if ($approve->type == Approve::APPROVE_TYPE_10) {
|
||||
$taskSchedulingPaln = TaskSchedulingPlan::where(['task_id' => $task->id])
|
||||
->withJoin(['scheduling'], 'left')
|
||||
->where('scheduling.company_type', 18)
|
||||
->where('is_pay',0)
|
||||
->with(['template_info'])
|
||||
->select()
|
||||
->toArray()[0];
|
||||
$taskInfo = $task->toArray();
|
||||
$company = Company::where(['id' => $taskInfo['company_id']])->find();
|
||||
$this->taskSettlement($taskInfo, $company, $taskSchedulingPaln);
|
||||
}
|
||||
// 村联络员-督促小组服务团队入股
|
||||
if ($approve->type == Approve::APPROVE_TYPE_11) {
|
||||
$taskSchedulingPaln = TaskSchedulingPlan::where(['task_id' => $task->id])
|
||||
->withJoin(['scheduling'], 'left')
|
||||
->where('scheduling.company_type', 17)
|
||||
->where('is_pay',0)
|
||||
->with(['template_info'])
|
||||
->select()
|
||||
->toArray()[0];
|
||||
TaskLogic::dealVillageTask4($taskSchedulingPaln, $approve);
|
||||
}
|
||||
// 村联络员-入股甲方公司
|
||||
if ($approve->type == Approve::APPROVE_TYPE_12) {
|
||||
$taskSchedulingPaln = TaskSchedulingPlan::where(['task_id' => $task->id])
|
||||
->withJoin(['scheduling'], 'left')
|
||||
->where('scheduling.company_type', 17)
|
||||
->where('is_pay',0)
|
||||
->with(['template_info'])
|
||||
->select()
|
||||
->toArray()[0];
|
||||
TaskLogic::dealVillageTask5($taskSchedulingPaln, $approve);
|
||||
}
|
||||
// 镇合伙人服务部长-督促小组服务团队入股村管理公司任务
|
||||
if ($approve->type == Approve::APPROVE_TYPE_13) {
|
||||
$taskSchedulingPaln = TaskSchedulingPlan::where(['task_id' => $task->id])
|
||||
->withJoin(['scheduling'], 'left')
|
||||
->where('scheduling.company_type', 16)
|
||||
->where('is_pay',0)
|
||||
->with(['template_info'])
|
||||
->select()
|
||||
->toArray()[0];
|
||||
TaskLogic::dealTownTask6($taskSchedulingPaln, $approve);
|
||||
}
|
||||
// 镇合伙人负责人-促成村联络员入股甲方
|
||||
if ($approve->type == Approve::APPROVE_TYPE_14) {
|
||||
$taskSchedulingPaln = TaskSchedulingPlan::where(['task_id' => $task->id])
|
||||
->withJoin(['scheduling'], 'left')
|
||||
->where('scheduling.company_type', 16)
|
||||
->where('is_pay',0)
|
||||
->with(['template_info'])
|
||||
->select()
|
||||
->toArray()[0];
|
||||
TaskLogic::masterTask6Settlement($taskSchedulingPaln, $approve);
|
||||
}
|
||||
return $this->success('成功');
|
||||
}
|
||||
|
||||
private function addConpanyAccountLog($parentCompany, $amount, $task)
|
||||
{
|
||||
// 接收股金公司股金变更 + 公司股金增加记录
|
||||
$addAmount = bcadd($parentCompany['shareholder_money'], $amount, 2);
|
||||
Company::where('id', $parentCompany['id'])->save(['shareholder_money'=>$addAmount]);
|
||||
|
||||
// 公司账户变动记录
|
||||
$company_log2 = [
|
||||
'sn' => generate_sn(UserAccountLog::class, 'sn', 20),
|
||||
'company_id' => $parentCompany['id'],
|
||||
'change_object' => CompanyAccountLog::SHAREHOLDER, // 变动对象 1余额 2股金
|
||||
'change_type' => CompanyAccountLog::TASK_INC_SHAREHOLDER_MONEY, //变动类型
|
||||
'action' => CompanyAccountLog::INC, //1-增加 2-减少
|
||||
'left_amount' => $addAmount, //变动后数量
|
||||
'change_amount' => $amount, //变动数量
|
||||
'extend' => json_encode(['task_id' => $task->id]),
|
||||
'status' => 1,
|
||||
];
|
||||
CompanyAccountLog::create($company_log2);
|
||||
}
|
||||
|
||||
public function taskSettlement($data, $company, $datas = [])
|
||||
{
|
||||
$proportion = 0;
|
||||
$remark = '来自任务【' . $datas['template_info']['title'] . '】,';
|
||||
//总金额除以2等于不可提现账号金额和收益
|
||||
$master_money = bcdiv($data['money'], 2, 2);
|
||||
//收益的百分之25为负责人的收益其余为成员的平分收益
|
||||
$master_money_user = bcdiv($master_money, 2, 2);
|
||||
|
||||
//成员数量
|
||||
$userAll = User::where('company_id', $data['company_id'])->where('admin_id', 0)->field('id,user_money')->select();
|
||||
$yser_all_count = count($userAll);
|
||||
$member_money_user = bcdiv($master_money_user, $yser_all_count, 2);
|
||||
|
||||
//负责人
|
||||
$arr = [$company['user_id'], AccountLogEnum::UM_INC_TASK, AccountLogEnum::INC, $master_money_user, $datas['sn'], $remark . '获得收益' . $master_money_user . '元', ['company_id' => $data['company_id'], 'proportion' => $proportion], $data['status']];
|
||||
$this->master($arr);
|
||||
$arr_two = [$company['user_id'], AccountLogEnum::UM_INC_TASKUSER, AccountLogEnum::INC, $master_money_user, $datas['sn'], $remark. '获得账户余额' . $master_money_user . '元', ['company_id' => $data['company_id'], 'proportion' => $proportion], $data['status']];
|
||||
$this->Account($arr_two);
|
||||
|
||||
//成员
|
||||
foreach ($userAll as $value) {
|
||||
$arr = [$value['id'], AccountLogEnum::UM_INC_TASK, AccountLogEnum::INC, $member_money_user, $datas['sn'], $remark . '获得收益' . $member_money_user . '元', ['company_id' => $data['company_id'], 'proportion' => $proportion], $data['status']];
|
||||
$this->member($arr);
|
||||
$arr_two = [$value['id'], AccountLogEnum::UM_INC_TASKUSER, AccountLogEnum::INC, $member_money_user, $datas['sn'], $remark. '获得账户余额' . $member_money_user . '元', ['company_id' => $data['company_id'], 'proportion' => $proportion], $data['status']];
|
||||
$this->Account($arr_two);
|
||||
}
|
||||
|
||||
//公司
|
||||
$deposit_count = bcadd($company['deposit'], $master_money, 2);
|
||||
$this->AccountLog($data['company_id'], $deposit_count, $master_money);
|
||||
|
||||
$company_money_count = bcadd($company['company_money'], $master_money, 2);
|
||||
$this->AccountLog($data['company_id'], $company_money_count, $master_money);
|
||||
Company::where('id', $data['company_id'])->update(['deposit' => Db::raw('deposit+' . $master_money), 'company_money' => Db::raw('company_money+' . $master_money)]);
|
||||
}
|
||||
|
||||
public function AccountLog($companyId, $left_amount, $changeAmount, $change_object = 1, $change_type = 1, $action = 1)
|
||||
{
|
||||
$company_log = [
|
||||
'sn' => generate_sn(UserAccountLog::class, 'sn', 20),
|
||||
'company_id' => $companyId,
|
||||
'change_object' => $change_object, //变动对象
|
||||
'change_type' => $change_type, //变动类型
|
||||
'action' => $action, //1-增加 2-减少
|
||||
'left_amount' => $left_amount, //变动后数量
|
||||
'change_amount' => $changeAmount, //变动数量
|
||||
'status' => 1,
|
||||
];
|
||||
CompanyAccountLog::create($company_log);
|
||||
}
|
||||
|
||||
/**负责人的分润
|
||||
* @param $data
|
||||
*/
|
||||
private function master($data)
|
||||
{
|
||||
User::where('id', $data[0])->update(['deposit'=>Db::raw('deposit+' . $data[3]),'user_money'=>Db::raw('user_money+' . $data[3])]);
|
||||
return AccountLogLogic::add($data[0], $data[1], $data[2], $data[3], $data[4], $data[5], $data[6], $data[7]);
|
||||
}
|
||||
|
||||
/**成员分润
|
||||
* @param $data
|
||||
*/
|
||||
private function member($data)
|
||||
{
|
||||
User::where('id', $data[0])->update(['deposit'=>Db::raw('deposit+' . $data[3]),'user_money'=>Db::raw('user_money+' . $data[3])]);
|
||||
return AccountLogLogic::add($data[0], $data[1], $data[2], $data[3], $data[4], $data[5], $data[6], $data[7]);
|
||||
}
|
||||
|
||||
private function Account($data)
|
||||
{
|
||||
return AccountLogLogic::add($data[0], $data[1], $data[2], $data[3], $data[4], $data[5], $data[6], $data[7]);
|
||||
}
|
||||
}
|
@ -158,4 +158,117 @@ class AdminController extends BaseAdminController
|
||||
$result = AdminLogic::editSelf($params);
|
||||
return $this->success('操作成功', [], 1, 1);
|
||||
}
|
||||
// /**生成合同 */
|
||||
public function Draftingcontracts()
|
||||
{
|
||||
$params = Request::param();
|
||||
$result = AdminLogic::detail($params);
|
||||
if ($result && $result['contract'] && $result['contract']['file'] != '') {
|
||||
$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']
|
||||
];
|
||||
$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]);
|
||||
$data = array(
|
||||
"applyNo" => $res->data, //TODO *
|
||||
"fullName" => $result['name'], //TODO *
|
||||
"identityCard" => $result['id_card'], //TODO *
|
||||
"identityType" => 1, //TODO *
|
||||
);
|
||||
$res = app(JunziqianController::class)->SigningLink($data);
|
||||
if ($res->success == true) {
|
||||
Db::name('contract')->where('id', $result['contract']['id'])->update(['url' => $res->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());
|
||||
}
|
||||
} else {
|
||||
return $this->fail($res->msg);
|
||||
}
|
||||
return $this->success('生成合同成功', [], 1, 1);
|
||||
} else {
|
||||
return $this->fail($res->msg);
|
||||
}
|
||||
} else {
|
||||
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 = AdminLogic::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'=>'<meta charset="utf-8">'.$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);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ namespace app\adminapi\controller\category_business;
|
||||
|
||||
use app\adminapi\controller\BaseAdminController;
|
||||
use app\adminapi\lists\category_business\CategoryBusinessLists;
|
||||
use app\common\logic\category_business\CategoryBusinessLogic;
|
||||
use app\adminapi\logic\category_business\CategoryBusinessLogic;
|
||||
use app\adminapi\validate\category_business\CategoryBusinessValidate;
|
||||
|
||||
|
||||
|
@ -18,15 +18,13 @@ namespace app\adminapi\controller\contract;
|
||||
|
||||
use app\adminapi\controller\BaseAdminController;
|
||||
use app\adminapi\lists\contract\ContractLists;
|
||||
use app\common\logic\contract\ContractLogic;
|
||||
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;
|
||||
use app\common\model\Company;
|
||||
use app\common\model\user\User;
|
||||
|
||||
/**
|
||||
* 合同控制器
|
||||
@ -114,85 +112,86 @@ class ContractController extends BaseAdminController
|
||||
{
|
||||
$params = Request::param();
|
||||
$file = $params['file'];
|
||||
$res = Contract::where('id', $params['id'])->update(['file' => $file, 'check_status' => 2]);
|
||||
$res = Contract::where('id', $params['id'])->update(['file' => $file]);
|
||||
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'] = User::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) {
|
||||
if($res==0){
|
||||
return $this->success('没有更新', [], 1, 1);
|
||||
}
|
||||
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();
|
||||
//**发送短信 */ 接口可能要做调整
|
||||
|
||||
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 Db::name('user')->where('id', $data['party_b'])->field('nickname name,mobile phone')->find();
|
||||
return $this->fail(SmsLogic::getError());
|
||||
}
|
||||
})
|
||||
->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 evidence()
|
||||
{
|
||||
$id = Request::param('id');
|
||||
$detail=Contract::where('id',$id)->find();
|
||||
if(!empty($detail['evidence_url'])){
|
||||
return $this->success('获取成功', ['url' => env('url.url_prefix').$detail['evidence_url']]);
|
||||
}
|
||||
$company=Company::where('id',$detail['party_a'])->find();
|
||||
$request = array(
|
||||
"applyNo" => $detail['contract_no'],
|
||||
"fullName" => $company['company_name'],
|
||||
"identityCard" => $company['organization_code'],
|
||||
"identityType" => 12,
|
||||
);
|
||||
return app(JunziqianController::class)->EvidenceDownload($request);
|
||||
}
|
||||
|
||||
//**废除合同 */
|
||||
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'=>'<meta charset="utf-8">'.$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);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,317 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace app\adminapi\controller\contract;
|
||||
|
||||
use app\adminapi\controller\BaseAdminController;
|
||||
use app\api\controller\JunziqianController;
|
||||
use app\common\enum\notice\NoticeEnum;
|
||||
use app\common\model\contract\VehicleContract;
|
||||
use app\common\model\vehicle\VehicleRent;
|
||||
|
||||
class VehicleContractController extends BaseAdminController
|
||||
{
|
||||
//风控中心上传合同
|
||||
public function uploadContract() {
|
||||
//获取参数
|
||||
$params = $this->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,
|
||||
'update_time' => time()
|
||||
];
|
||||
//判断合同类型
|
||||
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 rentNoticeSms($params) {
|
||||
try {
|
||||
$scene = NoticeEnum::getSceneByTag($params['scene']);
|
||||
if (empty($scene)) {
|
||||
throw new \Exception('场景值异常');
|
||||
}
|
||||
$result = event('Notice', [
|
||||
'scene_id' => $scene,
|
||||
'params' => $params
|
||||
]);
|
||||
return $result[0];
|
||||
} catch (\Exception $e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function lists() {
|
||||
$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 townRentList() {
|
||||
$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)->where('contract_logistic_id','<>',0)
|
||||
->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 initiatingRentCarContract() {
|
||||
//获取参数
|
||||
$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.website_domain').'/api/index/systemCarRent';
|
||||
}else{
|
||||
$notify_url = env('project.website_domain').'/api/index/townCarRent';
|
||||
}
|
||||
}elseif($contract['type'] == 1){
|
||||
$smsTitle = '《自有车辆上传合同》';
|
||||
$notify_url = env('project.website_domain').'/api/index/selfCarRent';
|
||||
}elseif($contract['type'] == 2){
|
||||
$smsTitle = '《解约合同》';
|
||||
$notify_url = env('project.website_domain').'/api/index/cancelRent';
|
||||
}elseif($contract['type'] == 3){
|
||||
$smsTitle = '《购买合同》';
|
||||
$notify_url = env('project.website_domain').'/api/index/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,
|
||||
'update_time' => time()
|
||||
]);
|
||||
}
|
||||
$this->sendSms($params['id'],$smsTitle);
|
||||
return $this->success('合同发送成功');
|
||||
} else {
|
||||
return $this->fail($signRes->msg);
|
||||
}
|
||||
}
|
||||
|
||||
public function sendSms($id,$title) {
|
||||
//获取合同数据
|
||||
$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 detail() {
|
||||
$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());
|
||||
}
|
||||
}
|
@ -1,131 +0,0 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\adminapi\controller\create_task_template;
|
||||
|
||||
|
||||
use app\adminapi\controller\BaseAdminController;
|
||||
use app\adminapi\lists\create_task_template\CreateTaskTemplateLists;
|
||||
use app\adminapi\logic\create_task_template\CreateTaskTemplateLogic;
|
||||
use app\adminapi\validate\create_task_template\CreateTaskTemplateValidate;
|
||||
use app\common\model\dict\DictData;
|
||||
|
||||
|
||||
/**
|
||||
* CreateTaskTemplate控制器
|
||||
* Class CreateTaskTemplateController
|
||||
* @package app\adminapi\controller\create_task_template
|
||||
*/
|
||||
class CreateTaskTemplateController extends BaseAdminController
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 14:50
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new CreateTaskTemplateLists());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 14:50
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$params = (new CreateTaskTemplateValidate())->post()->goCheck('add');
|
||||
$params['admin_id'] = $this->adminId;
|
||||
$result = CreateTaskTemplateLogic::add($params);
|
||||
if (true === $result) {
|
||||
return $this->success('添加成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(CreateTaskTemplateLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 14:50
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$params = (new CreateTaskTemplateValidate())->post()->goCheck('edit');
|
||||
$result = CreateTaskTemplateLogic::edit($params);
|
||||
if (true === $result) {
|
||||
return $this->success('编辑成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(CreateTaskTemplateLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 14:50
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
$params = (new CreateTaskTemplateValidate())->post()->goCheck('delete');
|
||||
CreateTaskTemplateLogic::delete($params);
|
||||
return $this->success('删除成功', [], 1, 1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取详情
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 14:50
|
||||
*/
|
||||
public function detail()
|
||||
{
|
||||
$params = (new CreateTaskTemplateValidate())->goCheck('detail');
|
||||
$result = CreateTaskTemplateLogic::detail($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
public function taskTypeList()
|
||||
{
|
||||
$taskRoleId = $this->request->param('task_role_id');
|
||||
$result = CreateTaskTemplateLogic::taskTypeList($taskRoleId);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
public function selectList()
|
||||
{
|
||||
|
||||
$role = $this->request->param('task_role_id');
|
||||
$list = CreateTaskTemplateLogic::getList($role);
|
||||
return $this->data($list);
|
||||
}
|
||||
|
||||
public function taskTypeInfo()
|
||||
{
|
||||
$type = ['town_task_type_master', 'town_task_type_marketing_director', 'town_task_type', 'village_task_type', 'task_type'];
|
||||
$lists = DictData::whereIn('type_value', $type)->column('name', 'id');
|
||||
return $this->data($lists);
|
||||
}
|
||||
|
||||
}
|
@ -17,7 +17,6 @@ namespace app\adminapi\controller\finance;
|
||||
use app\adminapi\controller\BaseAdminController;
|
||||
use app\adminapi\lists\finance\AccountLogLists;
|
||||
use app\common\enum\user\AccountLogEnum;
|
||||
use app\common\model\user\User;
|
||||
|
||||
/***
|
||||
* 账户流水控制器
|
||||
@ -51,12 +50,5 @@ class AccountLogController extends BaseAdminController
|
||||
return $this->data(AccountLogEnum::getUserMoneyChangeTypeDesc());
|
||||
}
|
||||
|
||||
public function getCompanyUserList()
|
||||
{
|
||||
$param = $this->request->param();
|
||||
$companyId = $param['company_id'];
|
||||
$userList = User::where(['company_id' => $companyId])->field('id,nickname,avatar,sn,mobile,group_id,deposit,income,user_money')->select()->toArray();
|
||||
return $this->success('成功', $userList);
|
||||
}
|
||||
|
||||
}
|
@ -3,26 +3,22 @@
|
||||
namespace app\adminapi\controller\finance;
|
||||
|
||||
use app\adminapi\controller\BaseAdminController;
|
||||
use app\adminapi\lists\finance\WithdrawLists;
|
||||
use app\common\logic\finance\WithdrawLogic;
|
||||
use app\common\model\user\Withdraw;
|
||||
use think\Exception;
|
||||
|
||||
class WithdrawController extends BaseAdminController
|
||||
{
|
||||
|
||||
public function index()
|
||||
{
|
||||
return $this->dataLists(new WithdrawLists());
|
||||
// [$page, $limit] = $this->getPage();
|
||||
// $status = $this->request->param('status');
|
||||
// $query = Withdraw::with('user');
|
||||
// if ($status !== '') {
|
||||
// $query->where('status', $status);
|
||||
// }
|
||||
// $count = $query->count();
|
||||
// $list = $query->order('id', 'desc')->page($page)->limit($limit)->select()->toArray();
|
||||
// return $this->success('success', ['count' => $count, 'data' => $list]);
|
||||
[$page, $limit] = $this->getPage();
|
||||
$status = $this->request->param('status');
|
||||
$query = Withdraw::with('user');
|
||||
if ($status !== '') {
|
||||
$query->where('status', $status);
|
||||
}
|
||||
$count = $query->count();
|
||||
$list = $query->order('id', 'desc')->page($page)->limit($limit)->select()->toArray();
|
||||
return $this->success('success', ['count' => $count, 'data' => $list]);
|
||||
}
|
||||
|
||||
public function update($id)
|
||||
@ -41,20 +37,4 @@ class WithdrawController extends BaseAdminController
|
||||
return $this->success('操作成功', [], 1, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 提现申请审核
|
||||
*/
|
||||
public function audit()
|
||||
{
|
||||
try {
|
||||
$params = $this->request->param();
|
||||
$re = WithdrawLogic::audit($params);
|
||||
if (!$re) {
|
||||
return $this->fail(WithdrawLogic::getError());
|
||||
}
|
||||
return $this->success('操作成功', [], 1, 1);
|
||||
} catch (Exception $exception) {
|
||||
return $this->fail($exception->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
@ -1,108 +0,0 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\adminapi\controller\informationg;
|
||||
|
||||
|
||||
use app\adminapi\controller\BaseAdminController;
|
||||
use app\adminapi\lists\informationg\UserInformationgLists;
|
||||
use app\adminapi\logic\informationg\UserInformationgLogic;
|
||||
use app\adminapi\validate\informationg\UserInformationgValidate;
|
||||
|
||||
|
||||
/**
|
||||
* UserInformationg控制器
|
||||
* Class UserInformationgController
|
||||
* @package app\adminapi\controller\informationg
|
||||
*/
|
||||
class UserInformationgController extends BaseAdminController
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/08/01 15:00
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new UserInformationgLists());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/08/01 15:00
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$params = (new UserInformationgValidate())->post()->goCheck('add');
|
||||
$result = UserInformationgLogic::add($params);
|
||||
if (true === $result) {
|
||||
return $this->success('添加成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(UserInformationgLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/08/01 15:00
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$params = (new UserInformationgValidate())->post()->goCheck('edit');
|
||||
$result = UserInformationgLogic::edit($params);
|
||||
if (true === $result) {
|
||||
return $this->success('编辑成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(UserInformationgLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/08/01 15:00
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
$params = (new UserInformationgValidate())->post()->goCheck('delete');
|
||||
UserInformationgLogic::delete($params);
|
||||
return $this->success('删除成功', [], 1, 1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取详情
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/08/01 15:00
|
||||
*/
|
||||
public function detail()
|
||||
{
|
||||
$params = (new UserInformationgValidate())->goCheck('detail');
|
||||
$result = UserInformationgLogic::detail($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -95,22 +95,5 @@ class DictDataController extends BaseAdminController
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
public function getContractPartyACompanyTypeList()
|
||||
{
|
||||
$result = DictDataLogic::getContractPartyACompanyTypeList();
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
public function getTaskApproveTypeList()
|
||||
{
|
||||
$result = DictDataLogic::getTaskApproveTypeList();
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
public function getShareholderMoneyTaskApproveTypeList()
|
||||
{
|
||||
$result = DictDataLogic::getShareholderMoneyTaskApproveTypeList();
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
}
|
@ -1,126 +0,0 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\adminapi\controller\task;
|
||||
|
||||
|
||||
use app\adminapi\controller\BaseAdminController;
|
||||
use app\adminapi\lists\task\TaskLists;
|
||||
use app\common\logic\task\TaskLogic;
|
||||
use app\adminapi\validate\task\TaskValidate;
|
||||
use app\common\model\task_scheduling_plan\TaskSchedulingPlan;
|
||||
use app\common\model\task_template\TaskTemplate;
|
||||
|
||||
/**
|
||||
* 任务控制器
|
||||
* Class TaskController
|
||||
* @package app\adminapi\controller\task
|
||||
*/
|
||||
class TaskController extends BaseAdminController
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取任务列表
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/08/05 13:39
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new TaskLists());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加任务
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/08/05 13:39
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$params = (new TaskValidate())->post()->goCheck('add');
|
||||
|
||||
if($params['type']==1){
|
||||
$arr=[42,43,44,45];//信息更新
|
||||
$params['extend']['informationg']['arr']=$arr;
|
||||
$params['extend']['informationg']['arr_count']=count($arr);
|
||||
$params['extend']['informationg']['update']=[];
|
||||
$params['extend']['informationg']['update_count']=0;
|
||||
}
|
||||
|
||||
$result = TaskLogic::add($params);
|
||||
if (true === $result) {
|
||||
return $this->success('添加成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(TaskLogic::getError());
|
||||
}
|
||||
|
||||
public function CronAdd(){
|
||||
$all=TaskSchedulingPlan::whereDay('start_time')->with(['template_info','scheduling'])->select();
|
||||
$res=TaskLogic::CronAdd($all->toArray());
|
||||
if($res){
|
||||
return $this->success('添加成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(TaskLogic::getError());
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 编辑任务
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/08/05 13:39
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$params = (new TaskValidate())->post()->goCheck('edit');
|
||||
$result = TaskLogic::edit($params);
|
||||
if (true === $result) {
|
||||
return $this->success('编辑成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(TaskLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除任务
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/08/05 13:39
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
$params = (new TaskValidate())->post()->goCheck('delete');
|
||||
TaskLogic::delete($params);
|
||||
return $this->success('删除成功', [], 1, 1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取任务详情
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/08/05 13:39
|
||||
*/
|
||||
public function detail()
|
||||
{
|
||||
$params = (new TaskValidate())->goCheck('detail');
|
||||
$result = TaskLogic::detail($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,120 +0,0 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\adminapi\controller\task_scheduling;
|
||||
|
||||
|
||||
use app\adminapi\controller\BaseAdminController;
|
||||
use app\adminapi\lists\task_scheduling\TaskSchedulingLists;
|
||||
use app\common\logic\task_scheduling\TaskSchedulingLogic;
|
||||
use app\adminapi\validate\task_scheduling\TaskSchedulingValidate;
|
||||
use app\common\model\task_scheduling\TaskScheduling;
|
||||
|
||||
/**
|
||||
* 任务公司排期控制器
|
||||
* Class TaskSchedulingController
|
||||
* @package app\adminapi\controller\task_scheduling
|
||||
*/
|
||||
class TaskSchedulingController extends BaseAdminController
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取任务公司排期列表
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/08/08 10:08
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new TaskSchedulingLists());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加任务公司排期
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/08/08 10:08
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
return $this->fail('暂未开放');
|
||||
$params = (new TaskSchedulingValidate())->post()->goCheck('add');
|
||||
$params['create_user_id']=$this->adminId;
|
||||
$result = TaskSchedulingLogic::add($params);
|
||||
if (true === $result) {
|
||||
return $this->success('添加成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(TaskSchedulingLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑任务公司排期
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/08/08 10:08
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$params = (new TaskSchedulingValidate())->post()->goCheck('edit');
|
||||
$result = TaskSchedulingLogic::edit($params);
|
||||
if (true === $result) {
|
||||
return $this->success('编辑成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(TaskSchedulingLogic::getError());
|
||||
}
|
||||
//编辑金额
|
||||
public function editMoney()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
$moeny=$params['money'];
|
||||
$result = TaskScheduling::where(['id'=>$params['id']])->update(['money'=>$moeny]);
|
||||
if ( $result) {
|
||||
return $this->success('编辑成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail('编辑失败');
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 删除任务公司排期
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/08/08 10:08
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
$params = (new TaskSchedulingValidate())->post()->goCheck('delete');
|
||||
TaskSchedulingLogic::delete($params);
|
||||
return $this->success('删除成功', [], 1, 1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取任务公司排期详情
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/08/08 10:08
|
||||
*/
|
||||
public function detail()
|
||||
{
|
||||
$params = (new TaskSchedulingValidate())->goCheck('detail');
|
||||
$result = TaskSchedulingLogic::detail($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,134 +0,0 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\adminapi\controller\task_scheduling_plan;
|
||||
|
||||
|
||||
use app\adminapi\controller\BaseAdminController;
|
||||
use app\adminapi\lists\task_scheduling_plan\TaskSchedulingPlanLists;
|
||||
use app\common\logic\task_scheduling_plan\TaskSchedulingPlanLogic;
|
||||
use app\adminapi\validate\task_scheduling_plan\TaskSchedulingPlanValidate;
|
||||
use app\common\logic\task\TaskLogic;
|
||||
use app\common\logic\task_template\TaskTemplateLogic;
|
||||
use app\common\model\task_scheduling_plan\TaskSchedulingPlan;
|
||||
|
||||
/**
|
||||
* 任务排期日历控制器
|
||||
* Class TaskSchedulingPlanController
|
||||
* @package app\adminapi\controller\task_scheduling_plan
|
||||
*/
|
||||
class TaskSchedulingPlanController extends BaseAdminController
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取任务排期日历列表
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/08/08 10:34
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new TaskSchedulingPlanLists());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加任务排期日历
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/08/08 10:34
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$params = (new TaskSchedulingPlanValidate())->post()->goCheck('add');
|
||||
$params['create_user_id']=$this->adminId;
|
||||
$time=strtotime($params['start_time']);
|
||||
$params['start_time']=$time;
|
||||
$params['end_time']=strtotime($params['end_time'])+86399;
|
||||
$result = TaskSchedulingPlanLogic::add($params);
|
||||
if (true === $result) {
|
||||
return $this->success('添加成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(TaskSchedulingPlanLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑任务排期日历
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/08/08 10:34
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$params = (new TaskSchedulingPlanValidate())->post()->goCheck('edit');
|
||||
$time=strtotime($params['start_time']);
|
||||
$params['start_time']=$time;
|
||||
$params['end_time']=strtotime($params['end_time'])+86399;
|
||||
$result = TaskSchedulingPlanLogic::edit($params);
|
||||
if (true === $result) {
|
||||
return $this->success('编辑成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(TaskSchedulingPlanLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除任务排期日历
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/08/08 10:34
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
$params = (new TaskSchedulingPlanValidate())->post()->goCheck('delete');
|
||||
$find=TaskSchedulingPlan::where('id',$params['id'])->find();
|
||||
TaskSchedulingPlanLogic::delete($params);
|
||||
$data['id']=$find['task_id'];
|
||||
TaskLogic::delete($data);
|
||||
return $this->success('删除成功', [], 1, 1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取任务排期日历详情
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/08/08 10:34
|
||||
*/
|
||||
public function detail()
|
||||
{
|
||||
$params = (new TaskSchedulingPlanValidate())->goCheck('detail');
|
||||
$result = TaskSchedulingPlanLogic::detail($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
public function getDayTaskList()
|
||||
{
|
||||
$companyId = $this->request->param('company_id', 0);
|
||||
$date = $this->request->param('date',);
|
||||
$lists = TaskSchedulingPlan::where(['company_id' => $companyId])
|
||||
->where('start_time', strtotime($date))
|
||||
->with(['template','templateInfo', 'task'])
|
||||
->order(['id' => 'desc'])
|
||||
->select()
|
||||
->toArray();
|
||||
return $this->success('', compact('lists'));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -1,168 +0,0 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\adminapi\controller\task_template;
|
||||
|
||||
|
||||
use app\adminapi\controller\BaseAdminController;
|
||||
use app\adminapi\lists\task_template\TaskTemplateLists;
|
||||
use app\common\logic\ShopRequestLogic;
|
||||
use app\common\logic\task_template\TaskTemplateLogic;
|
||||
use app\adminapi\validate\task_template\TaskTemplateValidate;
|
||||
use app\common\model\Company;
|
||||
use app\common\model\task\Task;
|
||||
|
||||
|
||||
/**
|
||||
* 任务模板控制器
|
||||
* Class TaskTemplateController
|
||||
* @package app\adminapi\controller\task_template
|
||||
*/
|
||||
class TaskTemplateController extends BaseAdminController
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取任务模板列表
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/08/06 17:30
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new TaskTemplateLists());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加任务模板
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/08/06 17:30
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$params = (new TaskTemplateValidate())->post()->goCheck('add');
|
||||
$params['admin_id'] = $this->adminId;
|
||||
$company = Company::find($params['company_id']);
|
||||
if ($company->company_type == 16) {
|
||||
// 创建 镇合伙人公司 任务模板
|
||||
$result = TaskTemplateLogic::addTownTaskTemplate($params);
|
||||
} else if ($company->company_type == 17) {
|
||||
$result = TaskTemplateLogic::addVillageTaskTemplate($params);
|
||||
} else {
|
||||
$result = TaskTemplateLogic::add($params);
|
||||
}
|
||||
|
||||
if (true === $result) {
|
||||
/**
|
||||
* 如果是公司第一次创建安排任务,则初始化公司的提现周期截止时间
|
||||
*/
|
||||
TaskTemplateLogic::initCompanyWithdrawDeadline($params['company_id']);
|
||||
return $this->success('添加成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(TaskTemplateLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑任务模板
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/08/06 17:30
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$params = (new TaskTemplateValidate())->post()->goCheck('edit');
|
||||
$result = TaskTemplateLogic::edit($params);
|
||||
if (true === $result) {
|
||||
return $this->success('编辑成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(TaskTemplateLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除任务模板
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/08/06 17:30
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
$params = (new TaskTemplateValidate())->post()->goCheck('delete');
|
||||
$task = Task::where(['template_id' =>$params['id']])->whereDay('start_time', 'today')->find();
|
||||
if(!empty($task)) {
|
||||
return $this->fail('该任务今天已在进行中,无法删除');
|
||||
}
|
||||
TaskTemplateLogic::delete($params);
|
||||
return $this->success('删除成功', [], 1, 1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取任务模板详情
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/08/06 17:30
|
||||
*/
|
||||
public function detail()
|
||||
{
|
||||
$params = (new TaskTemplateValidate())->goCheck('detail');
|
||||
$result = TaskTemplateLogic::detail($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
public function getProductList()
|
||||
{
|
||||
$param = $this->request->param(); // page keyword
|
||||
$p['page'] = $param['page_no'] ?? 1;
|
||||
$p['keyword'] = $param['keyword'] ??'';
|
||||
$result = ShopRequestLogic::getProductList($p);;
|
||||
// $result['data']['count'] = 1000;
|
||||
$data = [
|
||||
'lists' => $result['data']['data'],
|
||||
'count' => $result['data']['count'],
|
||||
'page_no' => $result['data']['page'],
|
||||
'page_size' => 10,
|
||||
];
|
||||
return $this->data($data);
|
||||
}
|
||||
|
||||
public function checkRole()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
if ($params['task_role'] == 1) {
|
||||
$serviceManagerUser = (new User())->searchMaster($params['company_id']);
|
||||
if (empty($serviceManagerUser)) {
|
||||
return $this->fail('公司还没有负责人,无法指派任务');
|
||||
}
|
||||
}
|
||||
if ($params['task_role'] == 2) {
|
||||
$serviceManagerUser = (new User())->searchMarketingManager($params['company_id']);
|
||||
if (empty($serviceManagerUser)) {
|
||||
return $this->fail('公司还没有市场部长,无法指派任务');
|
||||
}
|
||||
}
|
||||
|
||||
if ($params['task_role'] == 3) {
|
||||
$serviceManagerUser = (new User())->searchServiceManager($params['company_id']);
|
||||
if (empty($serviceManagerUser)) {
|
||||
return $this->fail('公司还没有服务部长,无法指派任务');
|
||||
}
|
||||
}
|
||||
return $this->success('成功');
|
||||
}
|
||||
}
|
@ -18,10 +18,11 @@ use app\adminapi\lists\user\UserLists;
|
||||
use app\adminapi\logic\user\UserLogic;
|
||||
use app\adminapi\validate\user\AdjustUserMoney;
|
||||
use app\adminapi\validate\user\UserValidate;
|
||||
use app\common\logic\CompanyLogic;
|
||||
use think\facade\Db;
|
||||
use think\facade\Request;
|
||||
use app\common\logic\contract\ContractLogic;
|
||||
use app\api\logic\SmsLogic;
|
||||
use app\api\controller\JunziqianController;
|
||||
use app\common\model\contract\Contract;
|
||||
|
||||
/**
|
||||
* 用户控制器
|
||||
@ -56,15 +57,6 @@ class UserController extends BaseAdminController
|
||||
return $this->success('', $detail);
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
$re = UserLogic::addUser($params);
|
||||
if ($re) {
|
||||
return $this->success('添加成功');
|
||||
}
|
||||
return $this->fail(UserLogic::getError());
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 编辑用户信息
|
||||
@ -98,32 +90,62 @@ class UserController extends BaseAdminController
|
||||
//**发起合同 */
|
||||
public function initiate_contract(){
|
||||
$params = Request::param();
|
||||
$find=Db::name('company')->where('admin_id',$this->adminId)->field('id,area_manager')->find();
|
||||
if(!$find||$find['party_a']<=0){
|
||||
$params['party_a']=Db::name('company')->where('admin_id',$this->adminId)->value('id');
|
||||
if($params['party_a']<=0){
|
||||
return $this->fail('甲方不存在,请联系平台绑定公司');
|
||||
}
|
||||
$params['check_status']=1;
|
||||
$params['area_manager'] = $find['area_manager'];
|
||||
$res=ContractLogic::Initiate_contract($params);
|
||||
$res=Contract::Initiate_contract($params);
|
||||
if (true === $res) {
|
||||
return $this->success('发起成功,等待平台风控部上传合同', [], 1, 1);
|
||||
return $this->success('发起成功,等待平台风控部上传合同');
|
||||
}
|
||||
return $this->fail('发起失败');
|
||||
}
|
||||
// /**发送合同 */
|
||||
// /**生成合同 */
|
||||
public function Draftingcontracts()
|
||||
{
|
||||
$params = Request::param();
|
||||
$result = ContractLogic::Draftingcontracts($params, 2);
|
||||
if ($result === true) {
|
||||
return $this->success('发送合同成功', [], 1, 1);
|
||||
$result = UserLogic::detail($params['id']);
|
||||
if ($result && $result['contract'] && $result['contract']['file'] != '') {
|
||||
$data = [
|
||||
'name' => $result['nickname'] . '的合同',
|
||||
'signatories' => [['fullName' => $result['nickname'], 'identityType' => 1, 'identityCard' => $result['id_card'], 'mobile' => $result['mobile'], '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]);
|
||||
$data = array(
|
||||
"applyNo" => $res->data, //TODO *
|
||||
"fullName" => $result['nickname'], //TODO *
|
||||
"identityCard" => $result['id_card'], //TODO *
|
||||
"identityType" => 1, //TODO *
|
||||
);
|
||||
$res = app(JunziqianController::class)->SigningLink($data);
|
||||
if ($res->success == true) {
|
||||
Db::name('contract')->where('id', $result['contract']['id'])->update(['url' => $res->data]);
|
||||
//发送短信
|
||||
$sms = [
|
||||
'mobile' => $result['mobile'],
|
||||
'name' => $result['nickname'],
|
||||
'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());
|
||||
}
|
||||
} else {
|
||||
return $this->fail($res->msg);
|
||||
}
|
||||
return $this->success('生成合同成功', [], 1, 1);
|
||||
} else {
|
||||
return $this->fail($res->msg);
|
||||
}
|
||||
} else {
|
||||
return $this->fail(ContractLogic::getError());
|
||||
return $this->fail('生成合同成功失败,联系管理员');
|
||||
}
|
||||
}
|
||||
|
||||
public function getCompanyList()
|
||||
{
|
||||
return $this->data(CompanyLogic::getList());
|
||||
}
|
||||
}
|
@ -1,108 +0,0 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\adminapi\controller\user;
|
||||
|
||||
|
||||
use app\adminapi\controller\BaseAdminController;
|
||||
use app\adminapi\lists\user\UserMenuLists;
|
||||
use app\common\logic\user\UserMenuLogic;
|
||||
use app\adminapi\validate\user\UserMenuValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 用户菜单控制器
|
||||
* Class UserMenuController
|
||||
* @package app\adminapi\controller\user
|
||||
*/
|
||||
class UserMenuController extends BaseAdminController
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取用户菜单列表
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/08/23 09:38
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new UserMenuLists());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加用户菜单
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/08/23 09:38
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$params = (new UserMenuValidate())->post()->goCheck('add');
|
||||
$result = UserMenuLogic::add($params);
|
||||
if (true === $result) {
|
||||
return $this->success('添加成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(UserMenuLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑用户菜单
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/08/23 09:38
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$params = (new UserMenuValidate())->post()->goCheck('edit');
|
||||
$result = UserMenuLogic::edit($params);
|
||||
if (true === $result) {
|
||||
return $this->success('编辑成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(UserMenuLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除用户菜单
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/08/23 09:38
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
$params = (new UserMenuValidate())->post()->goCheck('delete');
|
||||
UserMenuLogic::delete($params);
|
||||
return $this->success('删除成功', [], 1, 1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取用户菜单详情
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/08/23 09:38
|
||||
*/
|
||||
public function detail()
|
||||
{
|
||||
$params = (new UserMenuValidate())->goCheck('detail');
|
||||
$result = UserMenuLogic::detail($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,113 +0,0 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\adminapi\controller\user;
|
||||
|
||||
|
||||
use app\adminapi\controller\BaseAdminController;
|
||||
use app\adminapi\lists\user\UserRoleLists;
|
||||
use app\common\logic\user\UserRoleLogic;
|
||||
use app\adminapi\validate\user\UserRoleValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 用户角色控制器
|
||||
* Class UserRoleController
|
||||
* @package app\adminapi\controller\user
|
||||
*/
|
||||
class UserRoleController extends BaseAdminController
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取用户角色列表
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/08/23 09:38
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new UserRoleLists());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加用户角色
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/08/23 09:38
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$params = (new UserRoleValidate())->post()->goCheck('add');
|
||||
$result = UserRoleLogic::add($params);
|
||||
if (true === $result) {
|
||||
return $this->success('添加成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(UserRoleLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑用户角色
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/08/23 09:38
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$params = (new UserRoleValidate())->post()->goCheck('edit');
|
||||
$result = UserRoleLogic::edit($params);
|
||||
if (true === $result) {
|
||||
return $this->success('编辑成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(UserRoleLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除用户角色
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/08/23 09:38
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
$params = (new UserRoleValidate())->post()->goCheck('delete');
|
||||
UserRoleLogic::delete($params);
|
||||
return $this->success('删除成功', [], 1, 1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取用户角色详情
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/08/23 09:38
|
||||
*/
|
||||
public function detail()
|
||||
{
|
||||
$params = (new UserRoleValidate())->goCheck('detail');
|
||||
$result = UserRoleLogic::detail($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
public function getList()
|
||||
{
|
||||
$list = UserRoleLogic::getList();
|
||||
return $this->data($list);
|
||||
}
|
||||
|
||||
}
|
@ -1,77 +0,0 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\model\AppUpdate;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
|
||||
|
||||
/**
|
||||
* app更新列表
|
||||
* Class AppUpdateLists
|
||||
* @package app\adminapi\lists
|
||||
*/
|
||||
class AppUpdateLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2023/08/31 11:08
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['title', 'content', 'type', 'version', 'dow_url', 'force', 'quiet'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取app更新列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2023/08/31 11:08
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return AppUpdate::where($this->searchWhere)
|
||||
->field(['id', 'title', 'content', 'type', 'version', 'dow_url', 'force', 'quiet', 'create_time', 'update_time'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取app更新数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2023/08/31 11:08
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return AppUpdate::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
}
|
@ -1,84 +0,0 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\model\Company;
|
||||
use app\common\model\CompanyComplaintFeedback;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
|
||||
|
||||
/**
|
||||
* CompanyComplaintFeedback列表
|
||||
* Class CompanyComplaintFeedbackLists
|
||||
* @package app\adminapi\lists
|
||||
*/
|
||||
class CompanyComplaintFeedbackLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2023/09/23 15:14
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['company_id', 'content'],
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2023/09/23 15:14
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return CompanyComplaintFeedback::where($this->searchWhere)
|
||||
->field(['id', 'company_id', 'content'])
|
||||
->append(['company_name'], true)
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->withAttr('company_name', function ($value, $data) {
|
||||
$company = Company::where('id', $data['company_id'])->find();
|
||||
return $company['company_name'];
|
||||
})
|
||||
->select()
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2023/09/23 15:14
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return CompanyComplaintFeedback::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
}
|
@ -1,77 +0,0 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\model\CompanyForm;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
|
||||
|
||||
/**
|
||||
* CompanyForm列表
|
||||
* Class CompanyFormLists
|
||||
* @package app\adminapi\lists
|
||||
*/
|
||||
class CompanyFormLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2023/09/15 14:00
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['company_name', 'organization_code', 'address', 'master_name', 'type', 'master_email', 'notes'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2023/09/15 14:00
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return CompanyForm::where($this->searchWhere)
|
||||
->field(['id', 'company_name', 'organization_code', 'address', 'master_name', 'type', 'master_email', 'notes'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2023/09/15 14:00
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return CompanyForm::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
}
|
@ -18,8 +18,6 @@ namespace app\adminapi\lists;
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\model\Company;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\CompanyDepositVoucher;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
@ -41,7 +39,7 @@ class CompanyLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['organization_code', 'city', 'company_type', 'master_name', 'master_position', 'master_phone', 'master_email', 'other_contacts', 'area_manager', 'is_contract', 'deposit', 'deposit_time', 'qualification', 'status'],
|
||||
'=' => ['level_two', 'level_one', 'organization_code', 'city', 'area', 'street', 'company_type', 'master_name', 'master_position', 'master_phone', 'master_email', 'other_contacts', 'area_manager', 'is_contract', 'deposit', 'deposit_time', 'qualification', 'status'],
|
||||
'%like%' => ['company_name'],
|
||||
];
|
||||
}
|
||||
@ -58,41 +56,10 @@ class CompanyLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$params=$this->request->param();
|
||||
$where=[];
|
||||
if($this->adminInfo['root']!=1){
|
||||
$where['area_manager']=$this->adminId;
|
||||
}
|
||||
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= Admin::where('name','like','%'.$params['area_manager'].'%')->column('id');
|
||||
if($arr){
|
||||
$where[]=['area_manager','in',$arr];
|
||||
}
|
||||
}
|
||||
if(isset($params['area']) && $params['area']!=''){
|
||||
$arr= Db::name('geo_area')->where('area_name','like','%'.$params['area'].'%')->column('area_code');
|
||||
if($arr){
|
||||
$where[]=['area','in',$arr];
|
||||
}
|
||||
}
|
||||
if(isset($params['street']) && $params['street']!=''){
|
||||
$arr= Db::name('geo_street')->where('street_name','like','%'.$params['street'].'%')->column('street_code');
|
||||
if($arr){
|
||||
$where[]=['street','in',$arr];
|
||||
}
|
||||
}
|
||||
return Company::where($this->searchWhere)
|
||||
->where($where)
|
||||
->field(['is_authentication','id', 'id contract', 'company_name', 'organization_code', 'city', 'area', 'street', 'company_type', 'master_name', 'master_position', 'master_phone', 'master_email', 'area_manager', 'is_contract', 'deposit', 'company_money', 'shareholder_money', 'deposit_time', 'status', 'face_create_status'])
|
||||
->field(['is_authentication','id', 'level_two', 'level_one', 'company_name', 'organization_code', 'city', 'area', 'street', 'company_type', 'master_name', 'master_position', 'master_phone', 'master_email', 'other_contacts', 'area_manager', 'is_contract', 'deposit', 'deposit_time', 'qualification', 'status'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->append(['notes'], true)
|
||||
->withAttr('company_type',function($value,$data){
|
||||
return Db::name('dict_data')->where('id',$value)->value('name');
|
||||
})
|
||||
@ -105,45 +72,11 @@ class CompanyLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
->withAttr('area_manager',function($value,$data){
|
||||
return Db::name('admin')->where('id',$value)->value('name');
|
||||
})
|
||||
->withAttr('notes',function($value,$data){
|
||||
if ($data['is_authentication'] == 1) {
|
||||
return Db::name('company_authentication_fail_log')->where('company_id',$data['id'])->where('log_type', 2)->order(['id'=>'desc'])->limit(1)->value('fail_reason');
|
||||
} else {
|
||||
return Db::name('company_authentication_fail_log')->where('company_id',$data['id'])->where('log_type', 1)->order(['id'=>'desc'])->limit(1)->value('fail_reason');
|
||||
}
|
||||
|
||||
})
|
||||
->select()
|
||||
->toArray();
|
||||
}
|
||||
|
||||
public function list_two(): array
|
||||
{
|
||||
|
||||
$params=$this->request->param();
|
||||
$where=['company_type'=>30];
|
||||
if(isset($params['company_type'])){
|
||||
$where=['company_type'=>$params['company_type']];
|
||||
};
|
||||
$count=Company::where($where)->count();
|
||||
$list= Company::where($where)
|
||||
->field(['is_authentication','id', 'company_name', 'organization_code', 'province', 'province province_name','city', 'city city_name', 'area','area area_name', 'street','street street_name', 'village','village village_name', 'brigade', 'brigade brigade_name', 'company_type', 'master_name', 'master_position', 'master_phone', 'master_email', 'other_contacts', 'area_manager', 'is_contract', 'deposit', 'deposit_time', 'qualification', 'status'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()
|
||||
->toArray();
|
||||
return ['list'=>$list,'page_no'=>$this->limitOffset+1,'page_size'=>$this->limitLength,'count'=>$count];
|
||||
}
|
||||
public function list_three($companyId): array
|
||||
{
|
||||
$list = CompanyDepositVoucher::where(['company_id' => $companyId])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()
|
||||
->toArray();
|
||||
$count=CompanyDepositVoucher::where(['company_id' => $companyId])->count();
|
||||
return ['list'=>$list,'page_no'=>$this->limitOffset+1,'page_size'=>$this->limitLength,'count'=>$count];
|
||||
}
|
||||
/**
|
||||
* @notes 获取数量
|
||||
* @return int
|
||||
|
@ -1,79 +0,0 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\model\ShopContract;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
|
||||
|
||||
/**
|
||||
* ShopContract列表
|
||||
* Class ShopContractLists
|
||||
* @package app\adminapi\lists
|
||||
*/
|
||||
class ShopContractLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2023/09/13 17:01
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['contract_no', 'party_a', 'party_b', 'check_status'],
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2023/09/13 17:01
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return ShopContract::where($this->searchWhere)
|
||||
->field(['id', 'contract_no', 'party_a', 'party_b', 'area_manager', 'type', 'evidence_url', 'check_status', 'status', 'notes'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->with(['partyA', 'partyB'])
|
||||
->select()
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2023/09/13 17:01
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return ShopContract::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
}
|
@ -1,83 +0,0 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\model\ShopMerchant;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* ShopMerchant列表
|
||||
* Class ShopMerchantLists
|
||||
* @package app\adminapi\lists
|
||||
*/
|
||||
class ShopMerchantLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2023/09/13 16:45
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['company_name', 'master_name', 'master_phone'],
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2023/09/13 16:45
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return ShopMerchant::where($this->searchWhere)
|
||||
->field(['id', 'company_name', 'organization_code', 'master_name', 'master_phone'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->append(['notes'], true)
|
||||
->withAttr('notes',function($value,$data){
|
||||
return Db::name('company_authentication_fail_log')->where('company_id',$data['id'])->where('log_type', 3)->order(['id'=>'desc'])->limit(1)->value('fail_reason');
|
||||
})
|
||||
->select()
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2023/09/13 16:45
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return ShopMerchant::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
}
|
@ -1,142 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace app\adminapi\lists\approve;
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\Approve;
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\Company;
|
||||
use app\common\model\task\Task;
|
||||
use think\facade\Db;
|
||||
|
||||
class ApproveLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2023/08/31 11:08
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'in' => ['type'],
|
||||
'='=>['check_status']
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
public function queryWhere()
|
||||
{
|
||||
$where = [];
|
||||
// $where[] = ['check_admin_ids', '=', $this->adminId]; // todo 放开过滤条件,只有片区经理才能查看
|
||||
return $where;
|
||||
}
|
||||
|
||||
public function lists(): array
|
||||
{
|
||||
return Approve::where($this->searchWhere)
|
||||
->where($this->queryWhere())
|
||||
->with('task')
|
||||
->field('*')
|
||||
->append(['area_manager', 'company_name'], true)
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()
|
||||
->withAttr('area_manager',function($value,$data){
|
||||
return Admin::where(['id' => $data['check_admin_ids']])->value('name');
|
||||
})
|
||||
->withAttr('company_name',function($value,$data){
|
||||
$task = Task::where('id', $data['task_id'])->find();
|
||||
return Company::where(['id' => $task['company_id']])->value('company_name');
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
public function lists2(): array
|
||||
{
|
||||
$list = Approve::where($this->searchWhere)
|
||||
->where($this->queryWhere())
|
||||
->with('task')
|
||||
->field('*')
|
||||
->append(['area_manager', 'company_name'], true)
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()
|
||||
->withAttr('area_manager',function($value,$data){
|
||||
$company = Company::where(['admin_id'=>$data['check_admin_ids']])->find();
|
||||
return Admin::where(['id' => $company['area_manager']])->value('name');
|
||||
})
|
||||
->withAttr('company_name',function($value,$data){
|
||||
$company = Company::where(['admin_id'=>$data['check_admin_ids']])->find();
|
||||
return $company['company_name'];
|
||||
})
|
||||
->toArray();
|
||||
$count = Approve::where($this->searchWhere)
|
||||
->where($this->queryWhere())->count();
|
||||
|
||||
return [
|
||||
'lists' => $list,
|
||||
'count' => $count,
|
||||
'page_no' => $this->pageNo,
|
||||
'page_size' => $this->pageSize,
|
||||
];
|
||||
}
|
||||
|
||||
public function lists3(): array
|
||||
{
|
||||
$list = Approve::where($this->searchWhere)
|
||||
->where($this->queryWhere())
|
||||
->with('task')
|
||||
->field('*')
|
||||
->append(['area_manager', 'company_a_name', 'company_b_name'], true)
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()
|
||||
->withAttr('area_manager',function($value,$data){
|
||||
return Admin::where(['id' => $data['check_admin_ids']])->value('name');
|
||||
})
|
||||
->withAttr('company_b_name',function($value,$data){
|
||||
$task = Task::where('id', $data['task_id'])->find();
|
||||
if ($data['type'] == Approve::APPROVE_TYPE_11) {
|
||||
return '下属小组服务公司';
|
||||
}
|
||||
if ($data['type'] == Approve::APPROVE_TYPE_13) {
|
||||
$townCompanyName = Company::where(['id' => $task['company_id']])->value('company_name');
|
||||
return $townCompanyName.'(镇农科公司)下属小组服务公司';
|
||||
}
|
||||
if ($data['type'] == Approve::APPROVE_TYPE_14) {
|
||||
return '下属村管理公司';
|
||||
}
|
||||
return Company::where(['id' => $task['company_id']])->value('company_name');
|
||||
})
|
||||
->withAttr('company_a_name',function($value,$data){
|
||||
$task = Task::where('id', $data['task_id'])->find();
|
||||
$companyB = Company::where(['id' => $task['company_id']])->find();
|
||||
if ($data['type'] == Approve::APPROVE_TYPE_12 || $data['type'] == Approve::APPROVE_TYPE_14) {
|
||||
return Db::query("select * from la_company where company_type=:company_type and FIND_IN_SET(:street,responsible_area)", ['company_type' => 41,'street'=>$companyB['street']], true)[0]['company_name'];
|
||||
}
|
||||
if ($data['type'] == Approve::APPROVE_TYPE_13) {
|
||||
$townCompanyName = Company::where(['id' => $task['company_id']])->value('company_name');
|
||||
return $townCompanyName.'(镇农科公司)下属村管理公司';
|
||||
}
|
||||
return Company::where(['village' => $companyB['village'], 'company_type'=>17])->value('company_name');
|
||||
})
|
||||
->toArray();
|
||||
$count = Approve::where($this->searchWhere)
|
||||
->where($this->queryWhere())->count();
|
||||
|
||||
return [
|
||||
'lists' => $list,
|
||||
'count' => $count,
|
||||
'page_no' => $this->pageNo,
|
||||
'page_size' => $this->pageSize,
|
||||
];
|
||||
}
|
||||
|
||||
public function count(): int
|
||||
{
|
||||
return Approve::where($this->searchWhere)->count();
|
||||
}
|
||||
}
|
@ -15,7 +15,7 @@
|
||||
namespace app\adminapi\lists\article;
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\logic\CompanyLogic;
|
||||
use app\adminapi\logic\CompanyLogic;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\lists\ListsSortInterface;
|
||||
use app\common\model\article\Article;
|
||||
@ -73,9 +73,12 @@ class ArticleLists extends BaseAdminDataLists implements ListsSearchInterface, L
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$query = Article::where($this->searchWhere);
|
||||
$query = Article::where($this->searchWhere);
|
||||
if($this->adminInfo['root']!=1){
|
||||
$query->where('company_id', $this->adminInfo['company_id']);
|
||||
$companyIds = CompanyLogic::getAllCompanyIds();
|
||||
if (!empty($companyIds)) {
|
||||
$query->whereIn('company_id', $companyIds);
|
||||
}
|
||||
}
|
||||
|
||||
$ArticleLists = $query->with(['company'])
|
||||
@ -96,11 +99,7 @@ class ArticleLists extends BaseAdminDataLists implements ListsSearchInterface, L
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
$query = Article::where($this->searchWhere);
|
||||
if($this->adminInfo['root']!=1){
|
||||
$query->where('company_id', $this->adminInfo['company_id']);
|
||||
}
|
||||
return $query->count();
|
||||
return Article::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
public function extend()
|
||||
|
@ -25,7 +25,6 @@ use app\common\model\auth\SystemRole;
|
||||
use app\common\model\Company;
|
||||
use app\common\model\dept\Dept;
|
||||
use app\common\model\dept\Jobs;
|
||||
use app\common\model\user\User;
|
||||
use think\facade\Db;
|
||||
|
||||
/**
|
||||
@ -33,7 +32,7 @@ use think\facade\Db;
|
||||
* Class AdminLists
|
||||
* @package app\adminapi\lists\auth
|
||||
*/
|
||||
class AdminLists extends BaseAdminDataLists implements ListsExtendInterface, ListsSearchInterface, ListsSortInterface, ListsExcelInterface
|
||||
class AdminLists extends BaseAdminDataLists implements ListsExtendInterface, ListsSearchInterface, ListsSortInterface,ListsExcelInterface
|
||||
{
|
||||
/**
|
||||
* @notes 设置导出字段
|
||||
@ -78,6 +77,7 @@ class AdminLists extends BaseAdminDataLists implements ListsExtendInterface, Lis
|
||||
{
|
||||
return [
|
||||
'%like%' => ['name', 'account'],
|
||||
'=' => ['company_id']
|
||||
];
|
||||
}
|
||||
|
||||
@ -121,14 +121,16 @@ class AdminLists extends BaseAdminDataLists implements ListsExtendInterface, Lis
|
||||
$where[] = ['id', 'in', $adminIds];
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->adminInfo['root'] != 1) {
|
||||
if($this->adminInfo['role_id'][0]==10){
|
||||
$where[] = ['area_manager', '=', $this->adminId];
|
||||
|
||||
if(isset($this->params['company_id']) && $this->params['company_id'] != ''){
|
||||
$where[] = ['company_id', '=', $this->params['company_id']];
|
||||
}else{
|
||||
if($this->adminInfo['root']!=1){
|
||||
$column_id=Db::name('company')->where('level_two',$this->adminInfo['company_id'])->column('id');
|
||||
array_push($column_id,$this->adminInfo['company_id']);
|
||||
$where[]=['company_id','in',$column_id];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return $where;
|
||||
}
|
||||
|
||||
@ -146,7 +148,7 @@ class AdminLists extends BaseAdminDataLists implements ListsExtendInterface, Lis
|
||||
{
|
||||
$field = [
|
||||
'id', 'name', 'account', 'create_time', 'disable', 'root', 'province', 'city', 'area', 'street',
|
||||
'login_time', 'login_ip', 'multipoint_login', 'avatar', 'is_contract', 'create_time'
|
||||
'login_time', 'login_ip', 'multipoint_login', 'avatar', 'company_id', 'is_contract', 'create_time'
|
||||
];
|
||||
$adminLists = Admin::field($field)
|
||||
->where($this->searchWhere)
|
||||
@ -155,24 +157,17 @@ class AdminLists extends BaseAdminDataLists implements ListsExtendInterface, Lis
|
||||
->order($this->sortOrder)
|
||||
->append(['role_id', 'dept_id', 'jobs_id', 'disable_desc', 'province_name', 'city_name', 'area_name', 'street_name'])
|
||||
->select()
|
||||
->each(function($item){
|
||||
$company_id=User::where('admin_id',$item['id'])->value('company_id');
|
||||
if($company_id){
|
||||
$item['company']=Company::where('id',$company_id)->field('id,company_name')->find();
|
||||
}else{
|
||||
$item['company']=[];
|
||||
}
|
||||
})
|
||||
->toArray();
|
||||
|
||||
// 角色数组('角色id'=>'角色名称')
|
||||
$roleLists = SystemRole::column('name', 'id');
|
||||
// 部门列表
|
||||
$deptLists = Dept::column('name', 'id');
|
||||
// 岗位列表
|
||||
$jobsLists = Jobs::column('name', 'id');
|
||||
// $companyIds = array_unique(array_column($adminLists, 'company_id'));
|
||||
// $company = Company::whereIn('id', $companyIds)->field('id,company_name')->select()->toArray();
|
||||
// $adminLists = append($adminLists, $company, 'company_id', 'company');
|
||||
$companyIds = array_unique(array_column($adminLists, 'company_id'));
|
||||
$company = Company::whereIn('id', $companyIds)->field('id,company_name')->select()->toArray();
|
||||
$adminLists = append($adminLists, $company, 'company_id', 'company');
|
||||
|
||||
//管理员列表增加角色名称
|
||||
foreach ($adminLists as $k => $v) {
|
||||
@ -223,4 +218,4 @@ class AdminLists extends BaseAdminDataLists implements ListsExtendInterface, Lis
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
}
|
@ -38,8 +38,7 @@ class CategoryBusinessLists extends BaseAdminDataLists implements ListsSearchInt
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['sort', 'status','pid'],
|
||||
'%like%'=>['name']
|
||||
'=' => ['name', 'sort', 'status','pid'],
|
||||
];
|
||||
}
|
||||
|
||||
@ -57,6 +56,7 @@ class CategoryBusinessLists extends BaseAdminDataLists implements ListsSearchInt
|
||||
{
|
||||
$lists=CategoryBusiness::where($this->searchWhere)
|
||||
->field(['id', 'name', 'pid', 'sort', 'status'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()
|
||||
->toArray();
|
||||
|
@ -18,8 +18,6 @@ namespace app\adminapi\lists\contract;
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\model\contract\Contract;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\Company;
|
||||
use think\facade\Db;
|
||||
|
||||
/**
|
||||
@ -41,6 +39,7 @@ class ContractLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
return [
|
||||
'=' => ['contract_type', 'contract_no', 'status'],
|
||||
'%like%' => ['company_id', 'party_a', 'party_b', 'area_manager'],
|
||||
];
|
||||
}
|
||||
|
||||
@ -56,31 +55,7 @@ class ContractLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$params=$this->request->param();
|
||||
$where=[];
|
||||
if ($this->adminInfo['root'] != 1) {
|
||||
// if($this->adminInfo['role_id'][0]==10){
|
||||
// if(isset($params['type']) && $params['type']==1){
|
||||
// $where[] = ['check_status', '=',1];
|
||||
// }else{
|
||||
// $where[] = ['status', '=',0];
|
||||
// $where[] = ['check_status', 'in',[2,3]];
|
||||
// }
|
||||
// }
|
||||
}
|
||||
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= Admin::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'])
|
||||
return Contract::where($this->searchWhere)->with(['companyName','partyA','contractType'])
|
||||
// ->field(['id', 'company_id', 'contract_type', 'contract_no', 'status', 'party_a', 'party_b', 'area_manager'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
@ -88,15 +63,12 @@ class ContractLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
if($item->type==1){
|
||||
$item->party_b_name=Db::name('company')->where('id',$item->party_b)->value('company_name');
|
||||
}else{
|
||||
$item->party_b_name=Db::name('user')->where('id',$item->party_b)->value('nickname');
|
||||
$item->party_b_name=Db::name('admin')->where('id',$item->party_b)->value('name');
|
||||
}
|
||||
if(!empty($item->party_a_info)){
|
||||
$area_manager_name=Db::name('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='暂无片区经理';
|
||||
}
|
||||
$item->party_a_name=Db::name('company')->where('id',$item->party_a)->value('company_name');
|
||||
$area_manager_name=Db::name('admin')->where('id',$item->area_manager)->value('name');
|
||||
if($area_manager_name){
|
||||
$item->area_manager_name=$area_manager_name;
|
||||
}else{
|
||||
$item->area_manager_name='暂无片区经理';
|
||||
}
|
||||
|
@ -1,82 +0,0 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\create_task_template;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\create_task_template\CreateTaskTemplate;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
|
||||
|
||||
/**
|
||||
* CreateTaskTemplate列表
|
||||
* Class CreateTaskTemplateLists
|
||||
* @package app\adminapi\listscreate_task_template
|
||||
*/
|
||||
class CreateTaskTemplateLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 14:50
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['title', 'task_role_id', 'type'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 14:50
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return CreateTaskTemplate::where($this->searchWhere)
|
||||
->field(['id', 'title', 'admin_id', 'task_role_id', 'type', 'stage_day_one', 'money', 'proportion_one', 'stage_day_two', 'proportion_two', 'money_two', 'stage_day_three', 'new_money_three', 'money_longtime', 'types', 'recharge', 'content'])
|
||||
->append(['admin_name'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->withAttr('admin_name', function ($value, $data) {
|
||||
return Admin::where('id', $data['admin_id'])->value('name');
|
||||
})
|
||||
->select()
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 14:50
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return CreateTaskTemplate::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
}
|
@ -16,10 +16,8 @@ namespace app\adminapi\lists\finance;
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\enum\user\AccountLogEnum;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\user\UserAccountLog;
|
||||
use app\common\model\user\UserRole;
|
||||
use app\common\service\FileService;
|
||||
|
||||
|
||||
@ -28,42 +26,9 @@ use app\common\service\FileService;
|
||||
* Class AccountLogLists
|
||||
* @package app\adminapi\lists\finance
|
||||
*/
|
||||
class AccountLogLists extends BaseAdminDataLists implements ListsSearchInterface,ListsExcelInterface
|
||||
class AccountLogLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 导出字段
|
||||
* @return string[]
|
||||
* @author 段誉
|
||||
* @date 2023/2/24 16:07
|
||||
*/
|
||||
public function setExcelFields(): array
|
||||
{
|
||||
return [
|
||||
'user_info_sn' => '用户编号',
|
||||
'company_info_company_name' => '归属公司',
|
||||
'user_info_nickname' => '用户昵称',
|
||||
'user_info_group_name' => '角色名称',
|
||||
'user_info_mobile' => '手机号码',
|
||||
'change_amount' => '变动金额',
|
||||
'left_amount' => '剩余金额',
|
||||
'change_type_desc' => '变动类型',
|
||||
'source_sn' => '来源单号',
|
||||
'create_time' => '记录时间',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 导出表名
|
||||
* @return string
|
||||
* @author 段誉
|
||||
* @date 2023/2/24 16:07
|
||||
*/
|
||||
public function setFileName(): string
|
||||
{
|
||||
return '余额明细';
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 搜索条件
|
||||
* @return array
|
||||
@ -73,7 +38,7 @@ class AccountLogLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['change_type','company_id'],
|
||||
'=' => ['al.change_type'],
|
||||
];
|
||||
}
|
||||
|
||||
@ -91,13 +56,18 @@ class AccountLogLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
$where[] = ['change_type', 'in', AccountLogEnum::getUserMoneyChangeType()];
|
||||
}
|
||||
|
||||
if (!empty($this->params['user_info'])) {
|
||||
$where[] = ['u.sn|u.nickname|u.mobile', 'like', '%' . $this->params['user_info'] . '%'];
|
||||
}
|
||||
|
||||
if (!empty($this->params['start_time'])) {
|
||||
$where[] = ['create_time', '>=', strtotime($this->params['start_time'])];
|
||||
$where[] = ['al.create_time', '>=', strtotime($this->params['start_time'])];
|
||||
}
|
||||
|
||||
if (!empty($this->params['end_time'])) {
|
||||
$where[] = ['create_time', '<=', strtotime($this->params['end_time'])];
|
||||
$where[] = ['al.create_time', '<=', strtotime($this->params['end_time'])];
|
||||
}
|
||||
|
||||
return $where;
|
||||
}
|
||||
|
||||
@ -110,25 +80,22 @@ class AccountLogLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$lists = UserAccountLog::where($this->searchWhere)
|
||||
->with(['company_info','user_info'])
|
||||
$field = 'u.nickname,u.sn,u.avatar,u.mobile,al.action,al.change_amount,al.left_amount,al.change_type,al.source_sn,al.create_time';
|
||||
$lists = UserAccountLog::alias('al')
|
||||
->join('user u', 'u.id = al.user_id')
|
||||
->field($field)
|
||||
->where($this->searchWhere)
|
||||
->where($this->queryWhere())
|
||||
->order('id', 'desc')
|
||||
->order('al.id', 'desc')
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
foreach ($lists as &$item) {
|
||||
$item['user_info']['avatar'] = FileService::getFileUrl($item['user_info']['avatar']);
|
||||
$item['user_info']['group_name']=UserRole::where('id',$item['user_info']['group_id'])->value('name');
|
||||
$item['avatar'] = FileService::getFileUrl($item['avatar']);
|
||||
$item['change_type_desc'] = AccountLogEnum::getChangeTypeDesc($item['change_type']);
|
||||
$symbol = $item['action'] == AccountLogEnum::INC ? '+' : '-';
|
||||
$item['change_amount'] = $symbol . $item['change_amount'];
|
||||
// 用于导出
|
||||
$item['user_info_sn'] = $item['user_info']['sn'];
|
||||
$item['company_info_company_name'] = $item['company_info']['company_name'];
|
||||
$item['user_info_nickname'] = $item['user_info']['nickname'];
|
||||
$item['user_info_group_name'] = $item['user_info']['group_name'];
|
||||
$item['user_info_mobile'] = $item['user_info']['mobile'];
|
||||
}
|
||||
|
||||
return $lists;
|
||||
@ -143,7 +110,9 @@ class AccountLogLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return UserAccountLog::where($this->queryWhere())
|
||||
return UserAccountLog::alias('al')
|
||||
->join('user u', 'u.id = al.user_id')
|
||||
->where($this->queryWhere())
|
||||
->where($this->searchWhere)
|
||||
->count();
|
||||
}
|
||||
|
@ -97,6 +97,7 @@ class RefundRecordLists extends BaseAdminDataLists implements ListsSearchInterfa
|
||||
foreach ($lists as &$item) {
|
||||
$item['avatar'] = FileService::getFileUrl($item['avatar']);
|
||||
}
|
||||
|
||||
return $lists;
|
||||
}
|
||||
|
||||
|
@ -1,96 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace app\adminapi\lists\finance;
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\Company;
|
||||
use app\common\model\user\UserAccountLog;
|
||||
use app\common\model\user\Withdraw;
|
||||
|
||||
class WithdrawLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 搜索条件
|
||||
* @return array
|
||||
* @author 段誉
|
||||
* @date 2023/2/24 15:26
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['order_sn','user_id', 'amount', 'status'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 搜索条件
|
||||
* @author 段誉
|
||||
* @date 2023/2/24 15:26
|
||||
*/
|
||||
public function queryWhere()
|
||||
{
|
||||
$where = [];
|
||||
// 用户余额
|
||||
return $where;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return array
|
||||
* @author 段誉
|
||||
* @date 2023/2/24 15:31
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$lists = Withdraw::where($this->searchWhere)
|
||||
->append(['s_date', 'e_date', 'company_name'], true)
|
||||
->with('user')
|
||||
->where($this->queryWhere())
|
||||
->withAttr('company_name', function ($value, $data) {
|
||||
$company = Company::where(['admin_id'=>$data['admin_id']])->find();
|
||||
return $company['company_name']??'';
|
||||
})
|
||||
->withAttr('s_date', function ($value, $data) {
|
||||
$withdrawedCount = Withdraw::where(['user_id'=>$data['user_id'], 'status'=>3])->count();
|
||||
$company = Company::where(['admin_id'=>$data['admin_id']])->find();
|
||||
// 开始时间 如果用户第一次提现申请,则以该公司内用户 周期内第一条数据的生成时间为开始时间
|
||||
if ($withdrawedCount == 0) {
|
||||
$firstUserLog = UserAccountLog::where(['company_id'=>$company['id']])->order('id', 'asc')->find();
|
||||
return $firstUserLog['create_time'];
|
||||
} else {
|
||||
// 如果用户已成功申请过提现,则以上次提现的截止日期为开始时间
|
||||
$withdrawedCount = Withdraw::where(['user_id'=>$data['user_id'], 'status'=>3])->order('id', 'desc')->find();
|
||||
return $withdrawedCount['transfer_end_cycel'];
|
||||
}
|
||||
})
|
||||
->withAttr('e_date', function ($value, $data) {
|
||||
// 结束时间
|
||||
return date('Y-m-d H:i:s', $data['transfer_end_cycel']);
|
||||
})
|
||||
->order('id', 'desc')
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->select()
|
||||
->toArray();
|
||||
unset($item);
|
||||
return $lists;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取数量
|
||||
* @return int
|
||||
* @author 段誉
|
||||
* @date 2023/2/24 15:36
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return Withdraw::where($this->queryWhere())
|
||||
->where($this->searchWhere)
|
||||
->count();
|
||||
}
|
||||
|
||||
}
|
@ -1,97 +0,0 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\informationg;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\model\informationg\UserInformationg;
|
||||
use app\common\model\informationg\UserInformationgDemand;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
|
||||
|
||||
/**
|
||||
* UserInformationg列表
|
||||
* Class UserInformationgLists
|
||||
* @package app\adminapi\listsinformationg
|
||||
*/
|
||||
class UserInformationgLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2023/08/01 15:00
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['create_user_id', 'user_id', 'area_id', 'street_id', 'village_id', 'brigade_id', 'address', 'name', 'phone', 'sex', 'age', 'wechat', 'family', 'child', 'child_arr', 'highway', 'smart_phone', 'status'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2023/08/01 15:00
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$lists = UserInformationg::where($this->searchWhere)
|
||||
->field(['id','create_user_id','company_id','area_id','area_id area_name','street_id','street_id street_name','village_id','village_id village_name', 'brigade_id','brigade_id brigade_name', 'address', 'name', 'phone', 'sex', 'age','update_time','create_time','status'])
|
||||
->append(['extend'])
|
||||
->order(['id' => 'desc'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->select()
|
||||
->toArray();
|
||||
$informationIdArray = [];
|
||||
foreach($lists as $k=>$v) {
|
||||
$informationIdArray[] = $v['id'];
|
||||
}
|
||||
$data = UserInformationgDemand::whereIn('information_id', $informationIdArray)->order('id', 'desc')->select();
|
||||
$aianalyseArray = [];
|
||||
foreach($data as $kk=>$vv) {
|
||||
if (!empty($vv['ai_aianalyse'])) {
|
||||
$aianalyseArray[$vv['information_id']][] = $vv['id'];
|
||||
}
|
||||
}
|
||||
foreach($lists as $k=>$v) {
|
||||
$lists[$k]['aianalyse_status'] = 0;
|
||||
if (!empty($aianalyseArray[$v['id']])) {
|
||||
$lists[$k]['aianalyse_status'] = 1;
|
||||
}
|
||||
}
|
||||
return $lists;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2023/08/01 15:00
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return UserInformationg::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
}
|
@ -1,77 +0,0 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\model\Property;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
|
||||
|
||||
/**
|
||||
* Property列表
|
||||
* Class PropertyLists
|
||||
* @package app\adminapi\lists
|
||||
*/
|
||||
class PropertyLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2023/08/02 16:35
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['company_id', 'name', 'status', 'type'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2023/08/02 16:35
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return Property::where($this->searchWhere)
|
||||
->field(['id', 'company_id', 'name', 'status', 'type'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2023/08/02 16:35
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return Property::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
}
|
@ -15,7 +15,7 @@
|
||||
namespace app\adminapi\lists\recharge;
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\logic\CompanyLogic;
|
||||
use app\adminapi\logic\CompanyLogic;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\recharge\RechargeOrder;
|
||||
@ -104,16 +104,17 @@ class RechargeLists extends BaseAdminDataLists implements ListsSearchInterface,
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$companyIds = CompanyLogic::getAllCompanyIds();
|
||||
$field = 'ro.id,ro.sn,ro.order_amount,ro.pay_way,ro.pay_time,ro.pay_status,ro.create_time,ro.refund_status';
|
||||
$field .= ',u.avatar,u.nickname,u.company_id';
|
||||
$field .= ',u.avatar,u.nickname,a.company_id';
|
||||
$lists = RechargeOrder::alias('ro')
|
||||
->join('user u', 'u.id = ro.user_id')
|
||||
->join('admin a', 'u.admin_id = a.id')
|
||||
->join('company c', 'u.company_id = c.id')
|
||||
->join('company c', 'a.company_id = c.id')
|
||||
->field($field)
|
||||
->where($this->queryWhere())
|
||||
->where($this->searchWhere)
|
||||
// ->where('c.id', 'in', $companyIds)
|
||||
->where('c.id', 'in', $companyIds)
|
||||
->order('ro.id', 'desc')
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->append(['pay_status_text', 'pay_way_text'])
|
||||
|
@ -36,8 +36,8 @@ class DictDataLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'%like%' => ['name'],
|
||||
'=' => ['status', 'type_id', 'type_value']
|
||||
'%like%' => ['name', 'type_value'],
|
||||
'=' => ['status', 'type_id']
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -1,83 +0,0 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\task;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\model\task\Task;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
|
||||
|
||||
/**
|
||||
* 任务列表
|
||||
* Class TaskLists
|
||||
* @package app\adminapi\liststask
|
||||
*/
|
||||
class TaskLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2023/08/05 13:39
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['title', 'template_id', 'company_id', 'start_time', 'end_time', 'director_uid', 'type', 'status', 'content'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取任务列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2023/08/05 13:39
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
if($this->adminInfo['root']==1){
|
||||
$where=[];
|
||||
}else{
|
||||
$where['company_id']=$this->adminInfo['company_id'];
|
||||
}
|
||||
return Task::where($this->searchWhere)
|
||||
->where($where)
|
||||
->field(['id', 'title', 'template_id', 'company_id', 'admin_id', 'start_time', 'end_time', 'director_uid', 'type', 'status', 'content'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取任务数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2023/08/05 13:39
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return Task::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
}
|
@ -1,95 +0,0 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\task_scheduling;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\model\task_scheduling\TaskScheduling;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\Company;
|
||||
use think\db\Where;
|
||||
|
||||
/**
|
||||
* 任务公司排期列表
|
||||
* Class TaskSchedulingLists
|
||||
* @package app\adminapi\liststask_scheduling
|
||||
*/
|
||||
class TaskSchedulingLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2023/08/08 10:08
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['company_type', 'status'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取任务公司排期列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2023/08/08 10:08
|
||||
*/
|
||||
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[] = ['company_id', 'in', $arr];
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->adminInfo['root'] != 1) {
|
||||
$arr = Company::where('area_manager', $this->adminId)->column('id');
|
||||
if ($arr) {
|
||||
$where[] = ['company_id', 'in', $arr];
|
||||
}
|
||||
}
|
||||
return TaskScheduling::where($this->searchWhere)
|
||||
->where($where)
|
||||
->with(['admin', 'company', 'company_type'])
|
||||
// ->field(['id', 'create_user_id', 'company_id', 'company_type', 'status'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取任务公司排期数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2023/08/08 10:08
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return TaskScheduling::where($this->searchWhere)->count();
|
||||
}
|
||||
}
|
@ -1,85 +0,0 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\task_scheduling_plan;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\model\task_scheduling_plan\TaskSchedulingPlan;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
|
||||
|
||||
/**
|
||||
* 任务排期日历列表
|
||||
* Class TaskSchedulingPlanLists
|
||||
* @package app\adminapi\liststask_scheduling_plan
|
||||
*/
|
||||
class TaskSchedulingPlanLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2023/08/08 10:34
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['create_user_id', 'template_id', 'scheduling_id', 'status'],
|
||||
'between_time'=> 'start_time'
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取任务排期日历列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2023/08/08 10:34
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$where = [];
|
||||
|
||||
if($this->adminInfo['root']!=1){
|
||||
$where[] = ['create_user_id','=',$this->adminId];
|
||||
}
|
||||
return TaskSchedulingPlan::where($this->searchWhere)
|
||||
->where($where)
|
||||
->with(['template','templateInfo'])
|
||||
// ->field(['id', 'create_user_id', 'template_id', 'scheduling_id', 'start_time', 'end_time', 'status'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取任务排期日历数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2023/08/08 10:34
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return TaskSchedulingPlan::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
}
|
@ -1,88 +0,0 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\task_template;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\model\task_template\TaskTemplate;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\task_scheduling\TaskScheduling;
|
||||
use app\common\model\user\User;
|
||||
|
||||
/**
|
||||
* 任务模板列表
|
||||
* Class TaskTemplateLists
|
||||
* @package app\adminapi\liststask_template
|
||||
*/
|
||||
class TaskTemplateLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2023/08/06 17:30
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['title', 'admin_id', 'money', 'type', 'status', 'content','company_id'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取任务模板列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2023/08/06 17:30
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return TaskTemplate::where($this->searchWhere)
|
||||
->with(['admin','data_type'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()
|
||||
->append(['task_admin_name'])
|
||||
->withAttr("task_admin_name", function ($value,$data) {
|
||||
if ($data['type'] == 35) {
|
||||
$extend = json_decode($data['extend'], true);
|
||||
$userName = User::where('id', $extend['shareholder']['user_id'])->value('nickname');
|
||||
return $userName;
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取任务模板数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2023/08/06 17:30
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return TaskTemplate::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
}
|
@ -16,8 +16,6 @@ namespace app\adminapi\lists\user;
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\enum\user\UserTerminalEnum;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
use app\common\model\Company;
|
||||
use app\common\model\contract\Contract;
|
||||
use app\common\model\user\User;
|
||||
use think\facade\Db;
|
||||
|
||||
@ -38,11 +36,7 @@ class UserLists extends BaseAdminDataLists implements ListsExcelInterface
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
$allowSearch = ['keyword', 'channel', 'create_time_start', 'create_time_end', 'company_id'];
|
||||
if (empty($this->params['company_id'])) {
|
||||
unset($allowSearch['company_id']);
|
||||
unset($this->params['company_id']);
|
||||
}
|
||||
$allowSearch = ['keyword', 'channel', 'create_time_start', 'create_time_end'];
|
||||
return array_intersect(array_keys($this->params), $allowSearch);
|
||||
}
|
||||
|
||||
@ -59,30 +53,22 @@ class UserLists extends BaseAdminDataLists implements ListsExcelInterface
|
||||
public function lists(): array
|
||||
{
|
||||
$where = [];
|
||||
if(isset($this->params['company_id']) && $this->params['company_id'] > 0){
|
||||
if(isset($this->params['company_id']) && $this->params['company_id'] != ''){
|
||||
$where[] = ['company_id', '=', $this->params['company_id']];
|
||||
}else{
|
||||
if($this->adminInfo['root']!=1){
|
||||
if($this->adminInfo['role_id'][0]==8){
|
||||
$where[]=['area_manager','=',$this->adminInfo['admin_id']];
|
||||
}else{
|
||||
$company_id=Db::name('company')->where('admin_id',$this->adminInfo['admin_id'])->value('id');
|
||||
$where[]=['company_id','=',$company_id];
|
||||
}
|
||||
|
||||
$company_id=Db::name('company')->where('admin_id',$this->adminInfo['admin_id'])->value('id');
|
||||
$where[]=['company_id','=',$company_id];
|
||||
}
|
||||
}
|
||||
|
||||
$field = "id,id contract,sn,nickname,sex,avatar,account,mobile,channel,create_time,admin_id,company_id,street,street as street_name,is_contract";
|
||||
|
||||
$field = "id,sn,nickname,sex,avatar,account,mobile,channel,create_time,admin_id,company_id,street,street as street_name,is_contract";
|
||||
$lists = User::withSearch($this->setSearch(), $this->params)
|
||||
->with(['company'])
|
||||
->where($where)
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->field($field)
|
||||
->order('id desc')
|
||||
->select()
|
||||
->toArray();
|
||||
->select()->toArray();
|
||||
|
||||
foreach ($lists as &$item) {
|
||||
$item['channel'] = UserTerminalEnum::getTermInalDesc($item['channel']);
|
||||
|
@ -1,77 +0,0 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\user;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\model\user\UserMenu;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
|
||||
|
||||
/**
|
||||
* 用户菜单列表
|
||||
* Class UserMenuLists
|
||||
* @package app\adminapi\listsuser
|
||||
*/
|
||||
class UserMenuLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2023/08/23 09:38
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['pid', 'type', 'name', 'icon', 'sort', 'paths', 'params', 'is_show', 'is_disable'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取用户菜单列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2023/08/23 09:38
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$lists = UserMenu::where($this->searchWhere)
|
||||
->field(['id', 'pid', 'type', 'name', 'icon', 'sort', 'paths', 'params', 'is_show', 'is_disable','notes'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()
|
||||
->toArray();
|
||||
return linear_to_tree($lists, 'children');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取用户菜单数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2023/08/23 09:38
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return UserMenu::where($this->searchWhere)->count();
|
||||
}
|
||||
}
|
@ -1,77 +0,0 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\user;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\model\user\UserRole;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
|
||||
|
||||
/**
|
||||
* 用户角色列表
|
||||
* Class UserRoleLists
|
||||
* @package app\adminapi\listsuser
|
||||
*/
|
||||
class UserRoleLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2023/08/23 09:38
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['name', 'desc', 'menu_arr', 'sort'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取用户角色列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2023/08/23 09:38
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return UserRole::where($this->searchWhere)
|
||||
->field(['id', 'name', 'desc', 'menu_arr', 'sort'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取用户角色数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2023/08/23 09:38
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return UserRole::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
}
|
@ -1,119 +0,0 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\logic;
|
||||
|
||||
|
||||
use app\common\model\AppUpdate;
|
||||
use app\common\logic\BaseLogic;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* app更新逻辑
|
||||
* Class AppUpdateLogic
|
||||
* @package app\adminapi\logic
|
||||
*/
|
||||
class AppUpdateLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加app更新
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2023/08/31 11:08
|
||||
*/
|
||||
public static function add(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
AppUpdate::create([
|
||||
'title' => $params['title'],
|
||||
'content' => $params['content'],
|
||||
'type' => $params['type'],
|
||||
'version' => $params['version'],
|
||||
'dow_url' => $params['dow_url'],
|
||||
'force' => $params['force'],
|
||||
'quiet' => $params['quiet']
|
||||
]);
|
||||
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑app更新
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2023/08/31 11:08
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
AppUpdate::where('id', $params['id'])->update([
|
||||
'title' => $params['title'],
|
||||
'content' => $params['content'],
|
||||
'type' => $params['type'],
|
||||
'version' => $params['version'],
|
||||
'dow_url' => $params['dow_url'],
|
||||
'force' => $params['force'],
|
||||
'quiet' => $params['quiet'],
|
||||
'update_time'=>time()
|
||||
]);
|
||||
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除app更新
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2023/08/31 11:08
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
return AppUpdate::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取app更新详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author likeadmin
|
||||
* @date 2023/08/31 11:08
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
return AppUpdate::findOrEmpty($params['id'])->toArray();
|
||||
}
|
||||
}
|
@ -1,106 +0,0 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\logic;
|
||||
|
||||
|
||||
use app\common\model\CompanyComplaintFeedback;
|
||||
use app\common\logic\BaseLogic;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* CompanyComplaintFeedback逻辑
|
||||
* Class CompanyComplaintFeedbackLogic
|
||||
* @package app\adminapi\logic
|
||||
*/
|
||||
class CompanyComplaintFeedbackLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2023/09/23 15:08
|
||||
*/
|
||||
public static function add(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
CompanyComplaintFeedback::create([
|
||||
'content' => $params['content'],
|
||||
]);
|
||||
|
||||
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/09/23 15:08
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
CompanyComplaintFeedback::where('id', $params['id'])->update([
|
||||
'content' => $params['content'],
|
||||
]);
|
||||
|
||||
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/09/23 15:08
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
return CompanyComplaintFeedback::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author likeadmin
|
||||
* @date 2023/09/23 15:08
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
return CompanyComplaintFeedback::findOrEmpty($params['id'])->toArray();
|
||||
}
|
||||
}
|
@ -1,118 +0,0 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\logic;
|
||||
|
||||
|
||||
use app\common\model\CompanyForm;
|
||||
use app\common\logic\BaseLogic;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* CompanyForm逻辑
|
||||
* Class CompanyFormLogic
|
||||
* @package app\adminapi\logic
|
||||
*/
|
||||
class CompanyFormLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2023/09/15 14:00
|
||||
*/
|
||||
public static function add(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
CompanyForm::create([
|
||||
'company_name' => $params['company_name'],
|
||||
'organization_code' => $params['organization_code'],
|
||||
'address' => $params['address'],
|
||||
'master_name' => $params['master_name'],
|
||||
'type' => $params['type'],
|
||||
'master_email' => $params['master_email'],
|
||||
'notes' => $params['notes'],
|
||||
]);
|
||||
|
||||
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/09/15 14:00
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
CompanyForm::where('id', $params['id'])->update([
|
||||
'company_name' => $params['company_name'],
|
||||
'organization_code' => $params['organization_code'],
|
||||
'address' => $params['address'],
|
||||
'master_name' => $params['master_name'],
|
||||
'type' => $params['type'],
|
||||
'master_email' => $params['master_email'],
|
||||
'notes' => $params['notes'],
|
||||
]);
|
||||
|
||||
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/09/15 14:00
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
return CompanyForm::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author likeadmin
|
||||
* @date 2023/09/15 14:00
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
return CompanyForm::findOrEmpty($params['id'])->toArray();
|
||||
}
|
||||
}
|
218
app/adminapi/logic/CompanyLogic.php
Normal file
218
app/adminapi/logic/CompanyLogic.php
Normal file
@ -0,0 +1,218 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\logic;
|
||||
|
||||
|
||||
use app\common\model\Company;
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\contract\Contract;
|
||||
use app\common\model\user\User;
|
||||
use think\exception\ValidateException;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* Company逻辑
|
||||
* Class CompanyLogic
|
||||
* @package app\adminapi\logic
|
||||
*/
|
||||
class CompanyLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2023/07/15 14:43
|
||||
*/
|
||||
public static function add(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
// $exist = Company::where('admin_id', $params['admin_id'])->find();
|
||||
// if (!empty($exist)) {
|
||||
// throw new ValidateException('该账号已经注册过企业');
|
||||
// }
|
||||
$level_one = $params['contract']['party_a'] ?? 0;
|
||||
$data = Company::create([
|
||||
// 'level_two' => $params['level_two'],
|
||||
// 'level_one' => $params['level_one'],
|
||||
'company_name' => $params['company_name'],
|
||||
'organization_code' => $params['organization_code'],
|
||||
'province' => $params['province'],
|
||||
'city' => $params['city'],
|
||||
'area' => $params['area'],
|
||||
'street' => $params['street'],
|
||||
'address' => $params['address'],
|
||||
'company_type' => $params['company_type'],
|
||||
'master_name' => $params['master_name'],
|
||||
'master_position' => $params['master_position'],
|
||||
'master_phone' => $params['master_phone'],
|
||||
'master_email' => $params['master_email'],
|
||||
'other_contacts' => $params['other_contacts'],
|
||||
'area_manager' => $params['area_manager'] ?? 0,
|
||||
// 'is_contract' => $params['is_contract'],
|
||||
// 'account' => $params['account'],
|
||||
// 'password' => $params['password'],
|
||||
// 'deposit' => $params['deposit'],
|
||||
// 'deposit_time' => $params['deposit_time'],
|
||||
'qualification' => $params['qualification'],
|
||||
'admin_id' => $params['admin_id'] ?? 0,
|
||||
'level_one' => $level_one,
|
||||
// 'status' => $params['status']
|
||||
]);
|
||||
if ($level_one > 0) {
|
||||
$contractId = self::contract($data['id'], $params);
|
||||
}
|
||||
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/15 14:43
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
Company::where('id', $params['id'])->update([
|
||||
// 'level_two' => $params['level_two'],
|
||||
// 'level_one' => $params['level_one'],
|
||||
'company_name' => $params['company_name'],
|
||||
'organization_code' => $params['organization_code'],
|
||||
'province' => $params['province'],
|
||||
'city' => $params['city'],
|
||||
'area' => $params['area'],
|
||||
'street' => $params['street'],
|
||||
'address' => $params['address'],
|
||||
'company_type' => $params['company_type'],
|
||||
'master_name' => $params['master_name'],
|
||||
'master_position' => $params['master_position'],
|
||||
'master_phone' => $params['master_phone'],
|
||||
'master_email' => $params['master_email'],
|
||||
'other_contacts' => $params['other_contacts'],
|
||||
'area_manager' => $params['area_manager'] ?? 0,
|
||||
// 'is_contract' => $params['is_contract'],
|
||||
// 'account' => $params['account'],
|
||||
// 'password' => $params['password'],
|
||||
// 'deposit' => $params['deposit'],
|
||||
// 'deposit_time' => $params['deposit_time'],
|
||||
'qualification' => $params['qualification'],
|
||||
'admin_id' => $params['admin_id'] ?? 0,
|
||||
'level_one' => $params['contract']['party_a'] ?? 0,
|
||||
// 'status' => $params['status']
|
||||
]);
|
||||
if ($params['contract']) {
|
||||
$contractId = self::contract($params['id'], $params);
|
||||
Company::update(['contract_id' => $contractId], ['id' => $params['id']]);
|
||||
}
|
||||
if($params['admin_id']){
|
||||
$admin=Admin::where('company_id', $params['id'])->find();
|
||||
Admin::where('id' , $params['admin_id'])->update(['company_id' => $params['id']]);
|
||||
User::where('admin_id',$params['admin_id'])->update(['company_id' => $params['id'],'qualification'=>$params['qualification'],'province'=>$params['province'],'city'=>$params['city'],'area'=>$params['area'],'street'=>$params['street'],'address'=>$params['address'],'is_contract'=>$admin['is_contract'],'mobile'=>$admin['phone']]);
|
||||
if($admin['id']!=$params['admin_id']){
|
||||
Admin::where('id',$admin['id'])->update(['company_id' =>0]);
|
||||
User::where('admin_id' , $admin['id'])->update(['company_id' => 0]);
|
||||
}
|
||||
}
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage(), $e->getFile());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2023/07/15 14:43
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
return Company::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author likeadmin
|
||||
* @date 2023/07/15 14:43
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
$data = Company::findOrEmpty($params['id'])->toArray();
|
||||
if ($data) {
|
||||
$data['other_contacts'] = json_decode($data['other_contacts'], true);
|
||||
$data['qualification'] = json_decode($data['qualification'], true);
|
||||
$data['admin_name'] = Db::name('admin')->where('id', $data['admin_id'])->value('name');
|
||||
$data['area_manager_name'] = Db::name('admin')->where('id', $data['area_manager'])->value('name');
|
||||
$data['contract'] = Db::name('contract')->where('party_b', $data['id'])
|
||||
->withAttr('party_a_name', function ($value, $data) {
|
||||
return Db::name('company')->where('id', $data['party_a'])->value('company_name');
|
||||
})
|
||||
->find();
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
public static function contract($companyId, $params)
|
||||
{
|
||||
$model = Contract::where(['party_b' => $companyId])->find();
|
||||
if (empty($model)) {
|
||||
$model = new Contract();
|
||||
$model->contract_no = time();
|
||||
$model->create_time = time();
|
||||
$model->type = 1;
|
||||
}
|
||||
$model->update_time = time();
|
||||
$model->party_a = $params['contract']['party_a'] ?? 0;
|
||||
$model->contract_type = $params['contract']['contract_type'] ?? 0;
|
||||
$model->file = $params['contract']['file'] ?? '';
|
||||
$model->party_b = $companyId;
|
||||
$model->save();
|
||||
return $model->id;
|
||||
}
|
||||
|
||||
public static function getAllCompanyIds()
|
||||
{
|
||||
$companyId = request()->adminInfo['company_id'] ?? 0;
|
||||
$companyIds[] = $companyId;
|
||||
$companies = loopGetChild(Company::class, $companyId, 'level_one', 'id,level_one');
|
||||
if (!empty($companies)) {
|
||||
$companyIds = array_merge(array_column($companies, 'id'), $companyIds);
|
||||
}
|
||||
return array_filter($companyIds);
|
||||
}
|
||||
}
|
@ -99,36 +99,6 @@ class ConfigLogic
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 根据类型获取字典类型
|
||||
* @param $type
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author 段誉
|
||||
* @date 2022/9/27 19:09
|
||||
*/
|
||||
public static function getDictTypeValueByType($type)
|
||||
{
|
||||
if (!is_string($type)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$type = explode(',', $type);
|
||||
$lists = DictData::whereIn('type_value', $type)->select()->toArray();
|
||||
|
||||
if (empty($lists)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$result = [];
|
||||
foreach ($lists as $dict) {
|
||||
$result[$dict['name']] = $dict;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -1,264 +0,0 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\logic;
|
||||
|
||||
|
||||
use app\api\controller\JunziqianController;
|
||||
use app\api\logic\SmsLogic;
|
||||
use app\common\logic\CompanyLogic;
|
||||
use app\common\logic\contract\ContractLogic;
|
||||
use app\common\logic\UserLogic;
|
||||
use app\common\model\ShopContract;
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\ShopMerchant;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* ShopContract逻辑
|
||||
* Class ShopContractLogic
|
||||
* @package app\adminapi\logic
|
||||
*/
|
||||
class ShopContractLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2023/09/13 17:01
|
||||
*/
|
||||
public static function add(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
ShopContract::create([
|
||||
'contract_no' => $params['contract_no'],
|
||||
'type' => $params['type'],
|
||||
'contract_url' => $params['contract_url'],
|
||||
'evidence_url' => $params['evidence_url'],
|
||||
'url' => $params['url'],
|
||||
'signing_timer' => $params['signing_timer'],
|
||||
]);
|
||||
|
||||
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/09/13 17:01
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
ShopContract::where('id', $params['id'])->update([
|
||||
'file' => $params['file'],
|
||||
]);
|
||||
|
||||
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/09/13 17:01
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
return ShopContract::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author likeadmin
|
||||
* @date 2023/09/13 17:01
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
$data = Db::name('shop_contract')->where('id', $params['id'])
|
||||
->withAttr('party_b_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'];
|
||||
$shopMerchant = ShopMerchant::where(['id' => $data['party_b']])->field($field)->find()->toArray();
|
||||
$shopMerchant['qualification'] = json_decode($shopMerchant['qualification'], true);
|
||||
if($shopMerchant['qualification'] && isset($shopMerchant['qualification']['other_qualifications'])){
|
||||
$shopMerchant['qualification']['other_qualifications']=json_decode($shopMerchant['qualification']['other_qualifications'],true);
|
||||
}
|
||||
return $shopMerchant;
|
||||
})
|
||||
->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'];
|
||||
$shopMerchant = ShopMerchant::where(['id' => $data['party_a']])->field($field)->find()->toArray();
|
||||
if($shopMerchant['qualification'] && isset($shopMerchant['qualification']['other_qualifications'])){
|
||||
$shopMerchant['qualification']['other_qualifications']=json_decode($shopMerchant['qualification']['other_qualifications'],true);
|
||||
}
|
||||
return $shopMerchant;
|
||||
})
|
||||
->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_shop_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 Draftingcontracts($params,$type=1)
|
||||
{
|
||||
$result = ShopMerchantLogic::detail($params);
|
||||
if ($result && isset($result['contract']) && isset($result['contract']['file']) && $result['contract']['file'] != '') {
|
||||
if ($result['contract']['check_status'] == 3) {
|
||||
return self::setError('你已经生成过合同,请勿重复生成');
|
||||
}
|
||||
|
||||
$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'],
|
||||
];
|
||||
|
||||
$res = app(JunziqianController::class)->shopContractSigning($data, $result['contract']['id']);
|
||||
if ($res->success == true) {
|
||||
Db::name('shop_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);
|
||||
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"
|
||||
],
|
||||
];
|
||||
|
||||
$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"
|
||||
|
||||
];
|
||||
|
||||
$find = Db::name('shop_contract')->where('id', $params['id'])
|
||||
->withAttr('contract_type_name', function ($value, $data) {
|
||||
return Db::name('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['a'] =$res->data;
|
||||
} else {
|
||||
$url['b'] =$res->data;
|
||||
}
|
||||
if ($v['type'] == 'party_a') {
|
||||
$v['type'] = 'a';
|
||||
}
|
||||
if ($v['type'] == 'party_b') {
|
||||
$v['type'] = 'b';
|
||||
}
|
||||
//发送短信
|
||||
$sms = [
|
||||
'mobile' => $v['master_phone'],
|
||||
'name' => $v['fullName'],
|
||||
'type' => '《商户入驻合同》',
|
||||
'code' => 'api/Hetong/url?id=' . $find['id'].'&type='.$v['type'].'&t=1',
|
||||
'scene' => 'WQ'
|
||||
];
|
||||
$result = SmsLogic::contractUrl($sms);
|
||||
if ($result != true) {
|
||||
return self::setError(SmsLogic::getError());
|
||||
}
|
||||
} else {
|
||||
return self::setError($res->msg);
|
||||
}
|
||||
}
|
||||
Db::name('shop_contract')->where('id', $find['id'])->update(['url' => json_encode($url)]);
|
||||
return true;
|
||||
}else{
|
||||
return self::setError('没找到合同,联系管理员');
|
||||
}
|
||||
}
|
||||
}
|
@ -1,120 +0,0 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\logic;
|
||||
|
||||
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\Company;
|
||||
use app\common\model\contract\Contract;
|
||||
use app\common\model\contract\ShopContract;
|
||||
use app\common\model\ShopMerchant;
|
||||
use app\common\logic\BaseLogic;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* ShopMerchant逻辑
|
||||
* Class ShopMerchantLogic
|
||||
* @package app\adminapi\logic
|
||||
*/
|
||||
class ShopMerchantLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2023/09/13 16:45
|
||||
*/
|
||||
public static function add(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
ShopMerchant::create([
|
||||
|
||||
]);
|
||||
|
||||
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/09/13 16:45
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
ShopMerchant::where('id', $params['id'])->update([
|
||||
|
||||
]);
|
||||
|
||||
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/09/13 16:45
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
return ShopMerchant::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author likeadmin
|
||||
* @date 2023/09/13 16:45
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
$data = ShopMerchant::findOrEmpty($params['id'])->toArray();
|
||||
if ($data) {
|
||||
$where[]=['party_b','=', $data['id']];
|
||||
if(isset($params['contract_type'])){
|
||||
$where[]=['contract_type','=',$params['contract_type']];
|
||||
}
|
||||
$data['contract'] = ShopContract::where($where)->with(['party_a_info', 'contractType'])->find();
|
||||
|
||||
}
|
||||
return $data;
|
||||
// return ShopMerchant::findOrEmpty($params['id'])->toArray();
|
||||
}
|
||||
}
|
@ -65,10 +65,10 @@ class AdminLogic extends BaseLogic
|
||||
// self::insertDept($admin_id, $params['dept_id'] ?? []);
|
||||
// 岗位
|
||||
// self::insertJobs($admin_id, $params['jobs_id'] ?? []);
|
||||
// self::createUser($params, $password, $admin_id);
|
||||
// if($params['party_a']>0){
|
||||
// self::contract($admin_id, $params);//生成合同
|
||||
// }
|
||||
self::createUser($params, $password, $admin_id);
|
||||
if($params['party_a']>0){
|
||||
self::contract($admin_id, $params);//生成合同
|
||||
}
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
@ -132,18 +132,18 @@ class AdminLogic extends BaseLogic
|
||||
AdminJobs::delByUserId($params['id']);
|
||||
// 角色
|
||||
self::insertRole($params['id'], $role_id_arr);
|
||||
// if($is_contract){
|
||||
// $datas=[
|
||||
// 'party_a' => $params['party_a'],
|
||||
// 'party_b' => $params['id'],
|
||||
// 'contract_type' => $params['contract_type'],
|
||||
// 'type' => 2,
|
||||
// 'file' => $params['file'],
|
||||
// ];
|
||||
// self::contract($params['id'], $datas);//生成合同
|
||||
// }
|
||||
if($is_contract){
|
||||
$datas=[
|
||||
'party_a' => $params['party_a'],
|
||||
'party_b' => $params['id'],
|
||||
'contract_type' => $params['contract_type'],
|
||||
'type' => 2,
|
||||
'file' => $params['file'],
|
||||
];
|
||||
self::contract($params['id'], $datas);//生成合同
|
||||
}
|
||||
//修改用户同步信息
|
||||
// self::createUser($params, $data['password'] ?? '', $data['id']);
|
||||
self::createUser($params, $data['password'] ?? '', $data['id']);
|
||||
// 部门
|
||||
// self::insertDept($params['id'], $params['dept_id'] ?? []);
|
||||
// // 岗位
|
||||
@ -188,7 +188,7 @@ class AdminLogic extends BaseLogic
|
||||
AdminDept::delByUserId($params['id']);
|
||||
AdminJobs::delByUserId($params['id']);
|
||||
//修改用户同步信息
|
||||
Db::name('user')->where(['admin_id'=>$params['id']])->update(['delete_time'=>time()]);
|
||||
Db::name('user')->where(['admin_id'=>$params['id']])->update(['is_disable'=>1]);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
@ -238,21 +238,22 @@ class AdminLogic extends BaseLogic
|
||||
public static function detail($params, $action = 'detail'): array
|
||||
{
|
||||
$admin = Admin::field([
|
||||
'id', 'account', 'name', 'disable', 'root',
|
||||
'id', 'account', 'name', 'disable', 'root', 'company_id',
|
||||
'multipoint_login', 'avatar', 'sex', 'province', 'city', 'area', 'street', 'address', 'qualification', 'is_contract', 'id_card,phone'
|
||||
])->findOrEmpty($params['id'])->toArray();
|
||||
])->with(['company' => function ($query) {
|
||||
$query->field('id,company_name');
|
||||
}])->findOrEmpty($params['id'])->toArray();
|
||||
$admin['qualification'] = $admin['qualification']!=null?json_decode($admin['qualification'], true):[];
|
||||
$admin['company']=Company::where(['admin_id'=>$admin['id']])->field('id,company_name')->find();
|
||||
// $admin['contract']=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 (empty($admin['contract']['party_a'])) {
|
||||
// $admin['contract']['party_a_info'] = '';
|
||||
// } else {
|
||||
// $admin['contract']['party_a_info'] = Company::where(['id' => $admin['contract']['party_a']])->field('id,company_name,organization_code,master_name,master_phone,master_email')->find();
|
||||
// }
|
||||
$admin['contract']=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 (empty($admin['contract']['party_a'])) {
|
||||
$admin['contract']['party_a_name'] = '';
|
||||
} else {
|
||||
$admin['contract']['party_a_name'] = Company::where(['id' => $admin['contract']['party_a']])->value('company_name');
|
||||
}
|
||||
if ($action == 'detail') {
|
||||
return $admin;
|
||||
}
|
||||
@ -364,7 +365,6 @@ class AdminLogic extends BaseLogic
|
||||
public static function createUser($admin, $password, $adminId)
|
||||
{
|
||||
$user = User::where(['admin_id' => $adminId])->find();
|
||||
unset($admin['id'],$admin['contract']);
|
||||
if (empty($user)) {
|
||||
$userSn = User::createUserSn();
|
||||
User::create([
|
||||
@ -376,20 +376,22 @@ class AdminLogic extends BaseLogic
|
||||
'channel' => 3,
|
||||
'admin_id' => $adminId,
|
||||
'qualification'=>$admin['qualification'],
|
||||
'province'=>$admin['province'],
|
||||
'city'=>$admin['city'],
|
||||
'area'=>$admin['area'],
|
||||
'street'=>$admin['street'],
|
||||
'address'=>$admin['address'],
|
||||
]);
|
||||
} else {
|
||||
if(isset($admin['avatar']) && $admin['avatar']!=''){
|
||||
$user->avatar = $admin['avatar'];
|
||||
}
|
||||
if(isset($admin['name']) && $admin['name']!=''){
|
||||
$user->nickname = $admin['name'];
|
||||
}
|
||||
if(isset($admin['disable']) && $admin['disable']!=''){
|
||||
$user->is_disable = $admin['disable'];
|
||||
}
|
||||
$user->save($admin);
|
||||
if(isset($admin['qualification']) && $admin['qualification']!=''){
|
||||
$user->qualification = $admin['qualification'];
|
||||
}
|
||||
$user->admin_id=$adminId;
|
||||
$user->save();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\logic\category_business;
|
||||
namespace app\adminapi\logic\category_business;
|
||||
|
||||
|
||||
use app\common\model\category_business\CategoryBusiness;
|
145
app/adminapi/logic/contract/ContractLogic.php
Normal file
145
app/adminapi/logic/contract/ContractLogic.php
Normal file
@ -0,0 +1,145 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\logic\contract;
|
||||
|
||||
|
||||
use app\common\model\contract\Contract;
|
||||
use app\common\logic\BaseLogic;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* Contract逻辑
|
||||
* Class ContractLogic
|
||||
* @package app\adminapi\logic\contract
|
||||
*/
|
||||
class ContractLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2023/07/18 14:28
|
||||
*/
|
||||
public static function add(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
Contract::create([
|
||||
'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 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): array
|
||||
{
|
||||
$data = Db::name('contract')->where('id', $params['id'])
|
||||
->withAttr('party_b_name', function ($value, $data) {
|
||||
if ($data['type'] == 1) {
|
||||
return Db::name('company')->where('id', $data['party_b'])->value('company_name');
|
||||
} else {
|
||||
return Db::name('admin')->where('id', $data['party_b'])->value('name');
|
||||
}
|
||||
})
|
||||
->withAttr('party_a_name', function ($value, $data) {
|
||||
return Db::name('company')->where('id', $data['party_a'])->value('company_name');
|
||||
|
||||
})
|
||||
->withAttr('area_manager_name', function ($value, $data) {
|
||||
return Db::name('admin')->where('id', $data['area_manager'])->value('name');
|
||||
})
|
||||
->withAttr('contract_type_name', function ($value, $data) {
|
||||
return Db::name('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();
|
||||
return $data;
|
||||
}
|
||||
}
|
@ -1,174 +0,0 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\logic\create_task_template;
|
||||
|
||||
|
||||
use app\adminapi\logic\ConfigLogic;
|
||||
use app\common\model\create_task_template\CreateTaskTemplate;
|
||||
use app\common\logic\BaseLogic;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* CreateTaskTemplate逻辑
|
||||
* Class CreateTaskTemplateLogic
|
||||
* @package app\adminapi\logic\create_task_template
|
||||
*/
|
||||
class CreateTaskTemplateLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 14:50
|
||||
*/
|
||||
public static function add(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
CreateTaskTemplate::create([
|
||||
'title' => $params['title'],
|
||||
'admin_id' => $params['admin_id'],
|
||||
'task_role_id' => $params['task_role_id'],
|
||||
'type' => $params['type'],
|
||||
'stage_day_one' => $params['stage_day_one'],
|
||||
'money' => $params['money'],
|
||||
'proportion_one' => $params['proportion_one'],
|
||||
'stage_day_two' => $params['stage_day_two'],
|
||||
'proportion_two' => $params['proportion_two'],
|
||||
'money_two' => $params['money_two'],
|
||||
'stage_day_three' => $params['stage_day_three'],
|
||||
'new_money_three' => $params['new_money_three'],
|
||||
'money_longtime' => $params['money_longtime'],
|
||||
'types' => $params['types'],
|
||||
'recharge' => $params['recharge'],
|
||||
'content' => $params['content']
|
||||
]);
|
||||
|
||||
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/12/18 14:50
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
CreateTaskTemplate::where('id', $params['id'])->update([
|
||||
'title' => $params['title'],
|
||||
'admin_id' => $params['admin_id'],
|
||||
'task_role_id' => $params['task_role_id'],
|
||||
'type' => $params['type'],
|
||||
'stage_day_one' => $params['stage_day_one'],
|
||||
'money' => $params['money'],
|
||||
'proportion_one' => $params['proportion_one'],
|
||||
'stage_day_two' => $params['stage_day_two'],
|
||||
'proportion_two' => $params['proportion_two'],
|
||||
'money_two' => $params['money_two'],
|
||||
'stage_day_three' => $params['stage_day_three'],
|
||||
'new_money_three' => $params['new_money_three'],
|
||||
'money_longtime' => $params['money_longtime'],
|
||||
'types' => $params['types'],
|
||||
'recharge' => $params['recharge'],
|
||||
'content' => $params['content']
|
||||
]);
|
||||
|
||||
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/12/18 14:50
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
return CreateTaskTemplate::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 14:50
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
return CreateTaskTemplate::findOrEmpty($params['id'])->toArray();
|
||||
}
|
||||
|
||||
public static function taskTypeList($taskRoleId=0)
|
||||
{
|
||||
$type = '';
|
||||
switch ($taskRoleId) {
|
||||
case 1:
|
||||
$type = 'town_task_type_master';
|
||||
break;
|
||||
case 2:
|
||||
$type = 'town_task_type_marketing_director';
|
||||
break;
|
||||
case 3:
|
||||
$type = 'town_task_type';
|
||||
break;
|
||||
case 4:
|
||||
$type = 'village_task_type';
|
||||
break;
|
||||
case 5:
|
||||
$type = 'task_type';
|
||||
break;
|
||||
}
|
||||
if ($type) {
|
||||
$data = ConfigLogic::getDictByType($type);
|
||||
return $data;
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
public static function getList($role)
|
||||
{
|
||||
return CreateTaskTemplate::field(['id', 'title', 'admin_id', 'task_role_id', 'type', 'stage_day_one', 'money', 'proportion_one', 'stage_day_two', 'proportion_two', 'money_two', 'stage_day_three', 'new_money_three', 'money_longtime', 'types', 'recharge', 'content'])
|
||||
->order(['id' => 'desc'])
|
||||
->whereIn('task_role_id', explode(',', $role))
|
||||
->select()
|
||||
->toArray();
|
||||
}
|
||||
}
|
@ -1,167 +0,0 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\logic\informationg;
|
||||
|
||||
|
||||
use app\common\model\informationg\UserInformationg;
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\informationg\UserInformationgDemand;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* UserInformationg逻辑
|
||||
* Class UserInformationgLogic
|
||||
* @package app\adminapi\logic\informationg
|
||||
*/
|
||||
class UserInformationgLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2023/08/01 15:00
|
||||
*/
|
||||
public static function add(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
UserInformationg::create([
|
||||
'create_user_id' => $params['create_user_id'],
|
||||
'user_id' => $params['user_id'],
|
||||
'area_id' => $params['area_id'],
|
||||
'street_id' => $params['street_id'],
|
||||
'village_id' => $params['village_id'],
|
||||
'brigade_id' => $params['brigade_id'],
|
||||
'address' => $params['address'],
|
||||
'name' => $params['name'],
|
||||
'phone' => $params['phone'],
|
||||
'sex' => $params['sex'],
|
||||
'age' => $params['age'],
|
||||
'wechat' => $params['wechat'],
|
||||
'family' => $params['family'],
|
||||
'child' => $params['child'],
|
||||
'child_arr' => $params['child_arr'],
|
||||
'highway' => $params['highway'],
|
||||
'smart_phone' => $params['smart_phone'],
|
||||
'status' => $params['status']
|
||||
]);
|
||||
|
||||
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/08/01 15:00
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
UserInformationg::where('id', $params['id'])->update([
|
||||
'create_user_id' => $params['create_user_id'],
|
||||
'user_id' => $params['user_id'],
|
||||
'area_id' => $params['area_id'],
|
||||
'street_id' => $params['street_id'],
|
||||
'village_id' => $params['village_id'],
|
||||
'brigade_id' => $params['brigade_id'],
|
||||
'address' => $params['address'],
|
||||
'name' => $params['name'],
|
||||
'phone' => $params['phone'],
|
||||
'sex' => $params['sex'],
|
||||
'age' => $params['age'],
|
||||
'wechat' => $params['wechat'],
|
||||
'family' => $params['family'],
|
||||
'child' => $params['child'],
|
||||
'child_arr' => $params['child_arr'],
|
||||
'highway' => $params['highway'],
|
||||
'smart_phone' => $params['smart_phone'],
|
||||
'status' => $params['status']
|
||||
]);
|
||||
|
||||
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/08/01 15:00
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
return UserInformationg::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author likeadmin
|
||||
* @date 2023/08/01 15:00
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
$item = UserInformationg::where('id', $params['id'])->field('*,area_id area_name,street_id street_name,village_id village_name,brigade_id brigade_name')->find();
|
||||
$item['family'] = json_decode($item['family'], true);
|
||||
$item['child_arr'] = json_decode($item['child_arr'], true);
|
||||
$data = UserInformationgDemand::where('information_id', $params['id'])->order('id', 'desc')->select();
|
||||
$item['datas'] = [];
|
||||
$datas = [];
|
||||
if ($data) {
|
||||
foreach ($data as $k => $v) {
|
||||
$a = $v['data']; // json_decode($v['data'], true);
|
||||
$arr = [
|
||||
'id' => $v['id'],
|
||||
'category_id' => $v['category_id'],
|
||||
'category_child' => $v['category_child'],
|
||||
'create_time' => $v['create_time'],
|
||||
'update_time' => $v['update_time'],
|
||||
'datas' => $a,
|
||||
'data_field' => json_decode($v['data_field']),
|
||||
'ai_question' => $v['ai_question'],
|
||||
'ai_aianalyse' => $v['ai_aianalyse'],
|
||||
];
|
||||
if ($a) {
|
||||
array_push($datas, $arr);
|
||||
}
|
||||
}
|
||||
$item['datas'] = $datas;
|
||||
}
|
||||
return $item->toArray();
|
||||
}
|
||||
}
|
@ -99,13 +99,11 @@ class RechargeLogic extends BaseLogic
|
||||
]);
|
||||
|
||||
// 更新用户余额及累计充值金额
|
||||
$userInfo = User::where(['id' => $order['user_id']])->findOrEmpty();
|
||||
if ($userInfo['total_recharge_amount'] >= $order['order_amount']) {
|
||||
User::where(['id' => $order['user_id']])
|
||||
->dec('total_recharge_amount', $order['order_amount'])
|
||||
->dec('user_money', $order['order_amount'])
|
||||
->update();
|
||||
}
|
||||
User::where(['id' => $order['user_id']])
|
||||
->dec('total_recharge_amount', $order['order_amount'])
|
||||
->dec('user_money', $order['order_amount'])
|
||||
->update();
|
||||
|
||||
// 记录日志
|
||||
AccountLogLogic::add(
|
||||
$order['user_id'],
|
||||
|
@ -80,18 +80,5 @@ class DictDataLogic extends BaseLogic
|
||||
return DictData::findOrEmpty($params['id'])->toArray();
|
||||
}
|
||||
|
||||
public static function getContractPartyACompanyTypeList()
|
||||
{
|
||||
return DictData::whereIn('id', [30,16,41])->order('sort')->select()->toArray();
|
||||
}
|
||||
|
||||
public static function getTaskApproveTypeList()
|
||||
{
|
||||
return DictData::where(['type_value' => 'task_approve_type', 'status' => 1])->column('value');
|
||||
}
|
||||
|
||||
public static function getShareholderMoneyTaskApproveTypeList()
|
||||
{
|
||||
return DictData::where(['type_value' => 'shareholder_money_task_approve_type', 'status' => 1])->column('value');
|
||||
}
|
||||
}
|
@ -20,8 +20,6 @@ use app\common\logic\BaseLogic;
|
||||
use app\common\model\contract\Contract;
|
||||
use app\common\model\dict\DictData;
|
||||
use app\common\model\user\User;
|
||||
use app\common\service\ConfigService;
|
||||
use think\facade\Config;
|
||||
use think\facade\Db;
|
||||
|
||||
/**
|
||||
@ -54,7 +52,7 @@ class UserLogic extends BaseLogic
|
||||
// $user->sex = $user->getData('sex');
|
||||
$user['qualification']=json_decode($user->qualification,true);
|
||||
if($user->is_contract==1){
|
||||
$user['contract']=Contract::where(['type'=>2,'party_b'=>$userId])->with(['party_a_info','contractType'])->find();
|
||||
$user['contract']=Contract::where(['type'=>2,'party_b'=>$userId])->with('party_a,contractType')->find();
|
||||
}
|
||||
return $user->toArray();
|
||||
}
|
||||
@ -124,70 +122,4 @@ class UserLogic extends BaseLogic
|
||||
}
|
||||
}
|
||||
|
||||
public static function addUser($params)
|
||||
{
|
||||
// 手机号已被使用
|
||||
$mobileUser = User::where(['account' => $params['account']])->find();
|
||||
if (!empty($mobileUser)) {
|
||||
self::setError('手机号已被注册');
|
||||
return false;
|
||||
}
|
||||
$count = User::where('company_id', $params['company_id'])->count();
|
||||
$value = DictData::where('id', 28)->value('value');
|
||||
if ($count >= $value) {
|
||||
self::setError('你创建的账号已达上限');
|
||||
return false;
|
||||
}
|
||||
$group_id = $params['group_id'];
|
||||
// 每个公司市场部长只有1个
|
||||
if($group_id == 16) {
|
||||
$marketManger = User::where(['group_id' =>$group_id,'company_id'=>$params['company_id']])->findOrEmpty();
|
||||
if (!$marketManger->isEmpty()) {
|
||||
self::setError('公司已创建市场部长账号');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// 每个公司服务部长只有1个
|
||||
if($group_id == 14) {
|
||||
$marketManger = User::where(['group_id' =>$group_id,'company_id'=>$params['company_id']])->findOrEmpty();
|
||||
if (!$marketManger->isEmpty()) {
|
||||
self::setError('公司已创建服务部长账号');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
$userSn = User::createUserSn();
|
||||
$passwordSalt = Config::get('project.unique_identification');
|
||||
$password = create_password(123456, $passwordSalt);
|
||||
if ($params['avatar'] != '') {
|
||||
$avatar = $params['avatar'];
|
||||
} else {
|
||||
$avatar = ConfigService::get('default_image', 'user_avatar');
|
||||
}
|
||||
|
||||
|
||||
User::create([
|
||||
'sn' => $userSn,
|
||||
'avatar' => $avatar,
|
||||
'is_captain' => $group_id == 2? 1: 0,
|
||||
'nickname' => $params['nickname'],
|
||||
'account' => $params['account'],
|
||||
'mobile' => $params['account'],
|
||||
'id_card' => $params['id_card'],
|
||||
'password' => $password,
|
||||
'channel' => 0,
|
||||
'sex' => $params['sex'],
|
||||
'province' => $params['province'],
|
||||
'city' => $params['city'],
|
||||
'area' => $params['area'],
|
||||
'street' => $params['street'],
|
||||
'village' => $params['village'],
|
||||
'brigade' => $params['brigade'],
|
||||
'address' => $params['address'],
|
||||
'qualification' => json_encode($params['qualification']),
|
||||
'company_id' => $params['company_id'],
|
||||
'group_id' => $group_id,
|
||||
]);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -1,104 +0,0 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\validate;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* app更新验证器
|
||||
* Class AppUpdateValidate
|
||||
* @package app\adminapi\validate
|
||||
*/
|
||||
class AppUpdateValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
'title' => 'require',
|
||||
'content' => 'require',
|
||||
'type' => 'require',
|
||||
'version' => 'require',
|
||||
'dow_url' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
'title' => '标题',
|
||||
'content' => '内容',
|
||||
'type' => '1ios 2安卓',
|
||||
'version' => '版本',
|
||||
'dow_url' => 'app链接',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return AppUpdateValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/08/31 11:08
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->only(['title','content','type','version','dow_url']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return AppUpdateValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/08/31 11:08
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id','title','content','type','version','dow_url']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return AppUpdateValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/08/31 11:08
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return AppUpdateValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/08/31 11:08
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
}
|
@ -1,96 +0,0 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\validate;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* CompanyComplaintFeedback验证器
|
||||
* Class CompanyComplaintFeedbackValidate
|
||||
* @package app\adminapi\validate
|
||||
*/
|
||||
class CompanyComplaintFeedbackValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
'content' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
'content' => '内容',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return CompanyComplaintFeedbackValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/09/23 15:08
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->only(['content']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return CompanyComplaintFeedbackValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/09/23 15:08
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id','content']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return CompanyComplaintFeedbackValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/09/23 15:08
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return CompanyComplaintFeedbackValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/09/23 15:08
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
}
|
@ -1,100 +0,0 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\validate;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* CompanyForm验证器
|
||||
* Class CompanyFormValidate
|
||||
* @package app\adminapi\validate
|
||||
*/
|
||||
class CompanyFormValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
'company_name' => 'require',
|
||||
'organization_code' => 'require',
|
||||
'master_name' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
'company_name' => '商户名称',
|
||||
'organization_code' => '社会信用统一代码',
|
||||
'master_name' => '法人名称',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return CompanyFormValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/09/15 14:00
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->only(['company_name','organization_code','master_name']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return CompanyFormValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/09/15 14:00
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id','company_name','organization_code','master_name']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return CompanyFormValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/09/15 14:00
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return CompanyFormValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/09/15 14:00
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
}
|
@ -32,10 +32,9 @@ class CompanyValidate extends BaseValidate
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
'company_name' => 'require|unique:Company',
|
||||
'company_name' => 'require',
|
||||
'organization_code' => 'require',
|
||||
'master_name' => 'require',
|
||||
// 'id_card' => 'require',
|
||||
'master_position' => 'require',
|
||||
'master_phone' => 'require',
|
||||
'master_email' => 'require',
|
||||
@ -53,7 +52,6 @@ class CompanyValidate extends BaseValidate
|
||||
'company_name' => '公司名称',
|
||||
'organization_code' => '组织机构代码',
|
||||
'master_name' => '主联系人姓名',
|
||||
// 'id_card' => '主联系人身份证',
|
||||
'master_position' => '主联系人职务',
|
||||
'master_phone' => '主联系人手机',
|
||||
'master_email' => '主联系人邮箱',
|
||||
|
@ -1,94 +0,0 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\validate;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* ShopContract验证器
|
||||
* Class ShopContractValidate
|
||||
* @package app\adminapi\validate
|
||||
*/
|
||||
class ShopContractValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return ShopContractValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/09/13 17:01
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->remove('id', true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return ShopContractValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/09/13 17:01
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return ShopContractValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/09/13 17:01
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return ShopContractValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/09/13 17:01
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
}
|
@ -1,94 +0,0 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\validate;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* ShopMerchant验证器
|
||||
* Class ShopMerchantValidate
|
||||
* @package app\adminapi\validate
|
||||
*/
|
||||
class ShopMerchantValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return ShopMerchantValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/09/13 16:45
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->remove('id', true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return ShopMerchantValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/09/13 16:45
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return ShopMerchantValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/09/13 16:45
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return ShopMerchantValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/09/13 16:45
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
}
|
@ -1,94 +0,0 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\validate\create_task_template;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* CreateTaskTemplate验证器
|
||||
* Class CreateTaskTemplateValidate
|
||||
* @package app\adminapi\validate\create_task_template
|
||||
*/
|
||||
class CreateTaskTemplateValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return CreateTaskTemplateValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 14:50
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->remove('id', true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return CreateTaskTemplateValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 14:50
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return CreateTaskTemplateValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 14:50
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return CreateTaskTemplateValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 14:50
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
}
|
@ -1,102 +0,0 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\validate\informationg;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* UserInformationg验证器
|
||||
* Class UserInformationgValidate
|
||||
* @package app\adminapi\validate\informationg
|
||||
*/
|
||||
class UserInformationgValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
'user_id' => 'require',
|
||||
'name' => 'require',
|
||||
'phone' => 'require',
|
||||
'wechat' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
'user_id' => '用户id',
|
||||
'name' => '姓名',
|
||||
'phone' => '联系电话',
|
||||
'wechat' => '微信',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return UserInformationgValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/08/01 15:00
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->only(['user_id','name','phone','wechat']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return UserInformationgValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/08/01 15:00
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id','user_id','name','phone','wechat']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return UserInformationgValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/08/01 15:00
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return UserInformationgValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/08/01 15:00
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
}
|
@ -36,8 +36,8 @@ class RechargeRefundValidate extends BaseValidate
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'recharge_id.require' => '参数缺失recharge_id',
|
||||
'record_id.require' => '参数缺失record_id',
|
||||
'recharge_id.require' => '参数缺失',
|
||||
'record_id.require' => '参数缺失',
|
||||
];
|
||||
|
||||
|
||||
|
@ -1,94 +0,0 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\validate\task;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 任务验证器
|
||||
* Class TaskValidate
|
||||
* @package app\adminapi\validate\task
|
||||
*/
|
||||
class TaskValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return TaskValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/08/05 13:39
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->remove('id', true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return TaskValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/08/05 13:39
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return TaskValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/08/05 13:39
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return TaskValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/08/05 13:39
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
}
|
@ -1,94 +0,0 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\validate\task_scheduling;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 任务公司排期验证器
|
||||
* Class TaskSchedulingValidate
|
||||
* @package app\adminapi\validate\task_scheduling
|
||||
*/
|
||||
class TaskSchedulingValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return TaskSchedulingValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/08/08 10:08
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->remove('id', true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return TaskSchedulingValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/08/08 10:08
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return TaskSchedulingValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/08/08 10:08
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return TaskSchedulingValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/08/08 10:08
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
}
|
@ -1,94 +0,0 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\validate\task_scheduling_plan;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 任务排期日历验证器
|
||||
* Class TaskSchedulingPlanValidate
|
||||
* @package app\adminapi\validate\task_scheduling_plan
|
||||
*/
|
||||
class TaskSchedulingPlanValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return TaskSchedulingPlanValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/08/08 10:34
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->only([]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return TaskSchedulingPlanValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/08/08 10:34
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return TaskSchedulingPlanValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/08/08 10:34
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return TaskSchedulingPlanValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/08/08 10:34
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
}
|
@ -1,100 +0,0 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\validate\task_template;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 任务模板验证器
|
||||
* Class TaskTemplateValidate
|
||||
* @package app\adminapi\validate\task_template
|
||||
*/
|
||||
class TaskTemplateValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
'title' => 'require',
|
||||
'type' => 'require',
|
||||
'status' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
'title' => '主题',
|
||||
'type' => '任务类型',
|
||||
'status' => '状态',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return TaskTemplateValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/08/06 17:30
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->only(['title','type','status']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return TaskTemplateValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/08/06 17:30
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id','title','type','status']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return TaskTemplateValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/08/06 17:30
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return TaskTemplateValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/08/06 17:30
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
}
|
@ -54,8 +54,8 @@ class AdjustUserMoney extends BaseValidate
|
||||
return true;
|
||||
}
|
||||
|
||||
$surplusMoney = $user->user_money - $vaule;
|
||||
if ($surplusMoney < 0) {
|
||||
$surplusMoeny = $user->user_money - $vaule;
|
||||
if ($surplusMoeny < 0) {
|
||||
return '用户可用余额仅剩' . $user->user_money;
|
||||
}
|
||||
|
||||
|
@ -1,111 +0,0 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\validate\user;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 用户菜单验证器
|
||||
* Class UserMenuValidate
|
||||
* @package app\adminapi\validate\user
|
||||
*/
|
||||
class UserMenuValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
'pid' => 'require',
|
||||
'type' => 'require',
|
||||
'name' => 'require',
|
||||
'icon' => 'require',
|
||||
'sort' => 'require',
|
||||
'paths' => 'require',
|
||||
'is_show' => 'require',
|
||||
'is_disable' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
'pid' => '上级菜单',
|
||||
'type' => '权限类型: M=目录,C=菜单,A=按钮',
|
||||
'name' => '菜单名称',
|
||||
'icon' => '菜单图标',
|
||||
'sort' => '菜单排序',
|
||||
'paths' => '路由地址',
|
||||
'params' => '路由参数',
|
||||
'is_show' => '是否显示: 0=否, 1=是',
|
||||
'is_disable' => '是否禁用: 0=否, 1=是',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return UserMenuValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/08/23 09:38
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->only(['pid','type','name','icon','sort','paths','params','is_show','is_disable']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return UserMenuValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/08/23 09:38
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id','pid','type','name','icon','sort','paths','params','is_show','is_disable']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return UserMenuValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/08/23 09:38
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return UserMenuValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/08/23 09:38
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
}
|
@ -1,98 +0,0 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\validate\user;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 用户角色验证器
|
||||
* Class UserRoleValidate
|
||||
* @package app\adminapi\validate\user
|
||||
*/
|
||||
class UserRoleValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
'name' => 'require',
|
||||
'desc' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
'name' => '名称',
|
||||
'desc' => '描述',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return UserRoleValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/08/23 09:38
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->only(['name','desc']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return UserRoleValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/08/23 09:38
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id','name','desc']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return UserRoleValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/08/23 09:38
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return UserRoleValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/08/23 09:38
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
}
|
@ -35,21 +35,14 @@ class AccountLogController extends BaseApiController
|
||||
return $this->dataLists(new AccountLogLists());
|
||||
}
|
||||
|
||||
//个人月份统计
|
||||
//月份统计
|
||||
public function year_count()
|
||||
{
|
||||
$params=$this->request->param();
|
||||
$data = [['month' => date('Y') . '-01'], ['month' => date('Y') . '-02'], ['month' => date('Y') . '-03'], ['month' => date('Y') . '-04'], ['month' => date('Y') . '-05'], ['month' => date('Y') . '-06'], ['month' => date('Y') . '-07'], ['month' => date('Y') . '-08'], ['month' => date('Y') . '-09'], ['month' => date('Y') . '-10'], ['month' => date('Y') . '-11'], ['month' => date('Y') . '-12']];
|
||||
$data = [['month'=>date('Y').'-01'],['month'=>date('Y').'-02'],['month'=>date('Y').'-03'],['month'=>date('Y').'-04'],['month'=>date('Y').'-05'],['month'=>date('Y').'-06'],['month'=>date('Y').'-07'],['month'=>date('Y').'-08'],['month'=>date('Y').'-09'],['month'=>date('Y').'-10'],['month'=>date('Y').'-11'],['month'=>date('Y').'-12']];
|
||||
$year = date('Y');
|
||||
if(isset($params['user_id']) && $params['user_id'] > 0){
|
||||
$where[] =['user_id','=', $params['user_id']];
|
||||
}else{
|
||||
$where[] = ['user_id', '=', $this->userId];
|
||||
}
|
||||
$change_amount_1 = Db::name('user_account_log')
|
||||
->whereYear('create_time', $year)
|
||||
->where('action', 1)
|
||||
->where($where)
|
||||
->field('DATE_FORMAT(FROM_UNIXTIME(create_time), "%Y-%m") as month, SUM(change_amount) as total')
|
||||
->group('month')
|
||||
->order('month')
|
||||
@ -57,45 +50,32 @@ class AccountLogController extends BaseApiController
|
||||
$change_amount_2 = Db::name('user_account_log')
|
||||
->whereYear('create_time', $year)
|
||||
->where('action', 2)
|
||||
->where($where)
|
||||
|
||||
->field('DATE_FORMAT(FROM_UNIXTIME(create_time), "%Y-%m") as month, SUM(change_amount) as total')
|
||||
->group('month')
|
||||
->order('month')
|
||||
->select();
|
||||
foreach ($data as $k => $v) {
|
||||
foreach ($change_amount_1 as $key => $val) {
|
||||
if ($v['month'] == $val['month']) {
|
||||
foreach($data as $k=>$v){
|
||||
foreach($change_amount_1 as $key=>$val){
|
||||
if($v['month'] == $val['month']){
|
||||
$data[$k]['income'] = $val['total'];
|
||||
if (!isset($data[$k]['expenditure'])) {
|
||||
if(!isset($data[$k]['expenditure'])){
|
||||
$data[$k]['expenditure'] = 0;
|
||||
}
|
||||
$data[$k]['income'] = $val['total'];
|
||||
}
|
||||
}
|
||||
foreach ($change_amount_2 as $key => $val) {
|
||||
if ($v['month'] == $val['month']) {
|
||||
foreach($change_amount_2 as $key=>$val){
|
||||
if($v['month'] == $val['month']){
|
||||
$data[$k]['expenditure'] = $val['total'];
|
||||
if (!isset($data[$k]['income'])) {
|
||||
if(!isset($data[$k]['income'])){
|
||||
$data[$k]['income'] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!isset($data[$k]['income']) || !isset($data[$k]['expenditure'])) {
|
||||
if(!isset($data[$k]['income'])||!isset($data[$k]['expenditure'])){
|
||||
unset($data[$k]);
|
||||
}
|
||||
}
|
||||
return $this->success('ok', array_reverse($data));
|
||||
}
|
||||
|
||||
//公司日流水统计
|
||||
public function company_lists()
|
||||
{
|
||||
return $this->success('ok',(new AccountLogLists())->company_lists());
|
||||
}
|
||||
//公司月流水统计
|
||||
public function company_year_count()
|
||||
{
|
||||
return $this->success('ok',(new AccountLogLists())->company_year_count());
|
||||
return $this->success('ok',array_reverse($data));
|
||||
}
|
||||
}
|
||||
|
@ -1,51 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\api\lists\approve\ApproveLists;
|
||||
use app\common\logic\approve\ApproveLogic;
|
||||
use app\common\model\Approve;
|
||||
use Symfony\Component\HttpClient\HttpClient;
|
||||
use think\Exception;
|
||||
use think\facade\Db;
|
||||
|
||||
class ApproveController extends BaseApiController
|
||||
{
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new ApproveLists());
|
||||
}
|
||||
|
||||
public function approveType()
|
||||
{
|
||||
$list = Db::name('flow_type')->where(['status' => 1])->field(['id, title'])->select()->toArray();
|
||||
return $this->success('成功', $list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 前台通用审批接口 审批后的业务逻辑,需要具体拆解
|
||||
*/
|
||||
public function audit()
|
||||
{
|
||||
try {
|
||||
$params = $this->request->param(); // id check_status remark
|
||||
$approve = Approve::find($params['id']);
|
||||
if (!$approve) {
|
||||
throw new Exception('数据不存在');
|
||||
}
|
||||
ApproveLogic::audit($approve, $params, $this->userInfo);
|
||||
return $this->success('操作成功');
|
||||
} catch (Exception $exception) {
|
||||
return $this->fail(ApproveLogic::getError() ?? $exception->getMessage());
|
||||
}
|
||||
}
|
||||
public function detail()
|
||||
{
|
||||
$param = $this->request->param();
|
||||
$detail = ApproveLogic::detail($param['id']);
|
||||
if (!$detail) {
|
||||
$this->fail('数据不存在');
|
||||
}
|
||||
return $this->success('成功', $detail->toArray());
|
||||
}
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\common\model\category_business\CategoryBusiness;
|
||||
|
||||
/**
|
||||
* 商机分类
|
||||
* Class SmsController
|
||||
* @package app\api\controller
|
||||
*/
|
||||
class CategoryBusinessController extends BaseApiController
|
||||
{
|
||||
|
||||
public array $notNeedLogin = ['list'];
|
||||
|
||||
|
||||
/**
|
||||
*/
|
||||
public function list()
|
||||
{
|
||||
$lists = CategoryBusiness::field(['id', 'name', 'pid', 'sort', 'status'])
|
||||
->order(['id' => 'desc'])
|
||||
->select()
|
||||
->toArray();
|
||||
return $this->success('操作成功',linear_to_tree($lists, 'children'));
|
||||
}
|
||||
}
|
@ -1,722 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
|
||||
use app\adminapi\validate\CompanyValidate;
|
||||
use app\common\logic\contract\ContractLogic;
|
||||
use app\common\logic\finance\ShareProfit;
|
||||
use app\common\logic\RedisLogic;
|
||||
use app\common\logic\ShopRequestLogic;
|
||||
use app\common\logic\task\TaskLogic;
|
||||
use app\common\model\Company;
|
||||
use app\common\model\contract\Contract;
|
||||
use app\common\model\task\Task;
|
||||
use app\common\model\task_scheduling\TaskScheduling;
|
||||
use app\common\model\task_scheduling_plan\TaskSchedulingPlan;
|
||||
use app\common\model\task_template\TaskTemplate;
|
||||
use app\job\TaskAdd;
|
||||
use app\job\TaskInformationJob;
|
||||
use app\job\VillageTaskAdd;
|
||||
use app\job\VillageTaskSettlementJob;
|
||||
use think\Exception;
|
||||
use think\facade\Log;
|
||||
use app\job\TaskTenZehn;
|
||||
use think\facade\Db;
|
||||
use app\common\model\ShopMerchant;
|
||||
use app\common\model\contract\ShopContract;
|
||||
|
||||
class CeshiController extends BaseApiController
|
||||
{
|
||||
public array $notNeedLogin = [ 'index',
|
||||
'ceshi',
|
||||
'ceshi1',
|
||||
'ceshi2',
|
||||
'service_group_task_add_test', // 小组服务任务下发
|
||||
'service_group_task_settlement_test', // 小组服务任务结算
|
||||
'town_task_add_ceshi', // 镇农科任务下发
|
||||
'town_task_settlement_ceshi', // 镇农科任务结算
|
||||
'authentication', // 企业认证
|
||||
'initiate_contract', // 发起合同
|
||||
'Draftingcontracts', // 发送合同
|
||||
'postsms', // 发送短信
|
||||
'addSupplyMerchant', // 添加供应商
|
||||
'signSupplyMerchantContract', // 生成合同
|
||||
'countRate',
|
||||
'village_task_add_test',
|
||||
'village_task_settlement_test',
|
||||
'testShopApi'
|
||||
];
|
||||
|
||||
public function index()
|
||||
{ //1201
|
||||
|
||||
$id = 9;
|
||||
$shopMerchant = ShopMerchant::find(['id', $id]);
|
||||
// $data=json_decode($parmas['data'],true);
|
||||
// if($data['status']==1){
|
||||
// if($data['organizationRegNo']!=$shopMerchant->organization_code){
|
||||
// Log::error(['认证回调错误:',$parmas]);
|
||||
// return json(['success' => false, 'msg' => '认证回调错误']);
|
||||
// }
|
||||
|
||||
$shopMerchant->save(['is_authentication' => 1]);
|
||||
// 生成合同
|
||||
$createContractData = [
|
||||
'id' => $id,
|
||||
'party_a' => 1,
|
||||
'party_a_name' => '泸州市海之农科技有限公司',
|
||||
'party_b' => $id,
|
||||
'party_b_name' => $shopMerchant->company_name,
|
||||
'contract_type' => 22,
|
||||
];
|
||||
$model = new ShopContract();
|
||||
$model->contract_no = time();
|
||||
$model->create_time = time();
|
||||
$model->check_status = 1;
|
||||
$model->update_time = time();
|
||||
$model->setAttrs($createContractData);
|
||||
$res = $model->save($createContractData);
|
||||
// }
|
||||
halt($res);
|
||||
|
||||
$select = Db::name('company_form')->where('type', 0)
|
||||
->select();
|
||||
$id = 0;
|
||||
foreach ($select as $key => $value) {
|
||||
$id = $value['id'];
|
||||
if ($value['organization_code'] != '' || $value['organization_code'] != null) {
|
||||
// $pattern = "/\*/";
|
||||
$name = $value['master_name'];
|
||||
|
||||
// if(preg_match($pattern, $name)){
|
||||
// $name=$value['master_name'];
|
||||
// }
|
||||
// if ($value['master_email']) {
|
||||
$email = $value['master_email'];
|
||||
// } else {
|
||||
// $email = substr(md5(uniqid()), rand(0, 22), 10) . "@lihai.com";
|
||||
// }
|
||||
$shopMerchantCertificationData = [
|
||||
'name' => $name,
|
||||
'organization_code' => $value['organization_code'],
|
||||
'business_license' => 'https://lihai001.oss-cn-chengdu.aliyuncs.com/def/561f8202305171526091317.png',
|
||||
'master_name' => $value['master_name'],
|
||||
'master_email' => $email,
|
||||
'id' => $value['id'],
|
||||
];
|
||||
// Db::name('company_form')->where('id', $value['id'])->update(['master_email' => $email]);
|
||||
queue(TaskTenZehn::class,$shopMerchantCertificationData);
|
||||
} else {
|
||||
Db::name('company_form')->where('id', $value['id'])->update(['type' => -1]);
|
||||
continue;
|
||||
}
|
||||
// $a=app(JunziqianController::class)->ShopMerchantCertification($shopMerchantCertificationData);
|
||||
}
|
||||
|
||||
halt($id);
|
||||
}
|
||||
|
||||
public function ceshi1()
|
||||
{
|
||||
//认证一条龙
|
||||
$shopMerchantCertificationData = [
|
||||
'name' => 1212,
|
||||
'organization_code' => 2323,
|
||||
'business_license' => 'https://lihai001.oss-cn-chengdu.aliyuncs.com/def/561f8202305171526091317.png',
|
||||
'master_name' => 3423,
|
||||
'master_email' => 343,
|
||||
'id' => 123,
|
||||
];
|
||||
app(JunziqianController::class)->ShopMerchantCertification($shopMerchantCertificationData);
|
||||
halt(111);
|
||||
}
|
||||
public function ceshi2()
|
||||
{
|
||||
//重新认证
|
||||
$shopMerchantCertificationData = [
|
||||
'name' => 1212,
|
||||
'organization_code' => 2323,
|
||||
'business_license' => 'https://lihai001.oss-cn-chengdu.aliyuncs.com/def/561f8202305171526091317.png',
|
||||
'master_name' => 3423,
|
||||
'master_email' => 343,
|
||||
'id' => 123,
|
||||
];
|
||||
app(JunziqianController::class)->organizationReapply($shopMerchantCertificationData);
|
||||
halt(111);
|
||||
}
|
||||
|
||||
/**
|
||||
* 企业认证
|
||||
*/
|
||||
public function authentication()
|
||||
{
|
||||
$params = (new CompanyValidate())->goCheck('detail');
|
||||
$company = Db::name('company')->where('id', $params['id'])->find();
|
||||
$qualification = json_decode($company['qualification'], true);
|
||||
if ($company && $qualification['business_license']) {
|
||||
$data = [
|
||||
'name' => $company['company_name'],
|
||||
'organization_code' => $company['organization_code'],
|
||||
'business_license' => 'https://lihai001.oss-cn-chengdu.aliyuncs.com/def/561f8202305171526091317.png', //$qualification['business_license'],
|
||||
'master_name' => $company['master_name'],
|
||||
'master_email' => $company['master_email'],
|
||||
'master_phone' => $company['master_phone'],
|
||||
'master_id_card' => $company['master_id_card'],
|
||||
'id' => $company['id'],
|
||||
];
|
||||
$res = app(JunziqianController::class)->EnterpriseCertification($data);
|
||||
Log::info(['企业认证同步结果',$res]);
|
||||
if ($res->success == true) {
|
||||
// 企业人脸上传
|
||||
// $company['master_email'] = $email; // 法人邮箱
|
||||
// $faceCreateRe = CompanyLogic::originationFaceCreate($company);
|
||||
// if ($faceCreateRe !== true) {
|
||||
// return $this->fail($faceCreateRe);
|
||||
// }
|
||||
//
|
||||
if ($company['company_type'] == 30) {
|
||||
// 平台公司不用初始化生成合同 合同签约暂不用人脸识别,预留人脸采集状态为已采集
|
||||
Db::name('company')->where('id', $params['id'])->update([ 'is_contract'=>1,'face_create_status'=>1]);
|
||||
} else {
|
||||
Db::name('company')->where('id', $params['id'])->update([ 'face_create_status'=>1]);
|
||||
}
|
||||
|
||||
// 加入缓存中,is_callback用于判断是否获取到异步通知
|
||||
RedisLogic::getInstance()->set('authentication_company_id_'.$company['id'], json_encode(['company_id'=>$company['id'],'is_callback'=>0, 'timing'=>time()]));
|
||||
// return $this->success('认证成功',[],1, 1);
|
||||
return $this->success('系统认证中,请稍后刷新页面查看', ['email' => $res->data], 1, 1);
|
||||
} else {
|
||||
return $this->fail($res->msg);
|
||||
}
|
||||
} else {
|
||||
return $this->fail("公司不存在");
|
||||
}
|
||||
}
|
||||
|
||||
/**发起合同
|
||||
* 请求参数如下
|
||||
* id: 14
|
||||
* party_a: 13
|
||||
* party_a_name: 史丹利农业集团股份有限公司
|
||||
* party_b: 14
|
||||
* party_b_name: 中国乐凯集团有限公司
|
||||
* contract_type: 25
|
||||
* contract_no:
|
||||
*/
|
||||
public function initiate_contract()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
if (isset($params['party_a']) && $params['party_a'] > 0) {
|
||||
$params['party_a'] = $params['party_a'];
|
||||
} else {
|
||||
$params['party_a'] = $this->adminInfo['company_id'];
|
||||
}
|
||||
$area_manager = Company::where('id', $params['party_a'])->value('area_manager');
|
||||
$params['area_manager'] = $area_manager;
|
||||
$params['type'] = 1;
|
||||
$params['party_b'] = $params['id'];
|
||||
unset($params['id']);
|
||||
$result = ContractLogic::initiate_contract($params);
|
||||
if (!empty($result) && $result['code'] == 1) {
|
||||
return $this->success($result['msg'], $result['data'], 1, 1);
|
||||
}
|
||||
return $this->fail(ContractLogic::getError());
|
||||
}
|
||||
|
||||
/** 发送合同 发送君子签签约请求,成功后会发送回短信
|
||||
* id: 14
|
||||
* contract_id: 14
|
||||
*/
|
||||
public function Draftingcontracts()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
$result = ContractLogic::Draftingcontracts($params);
|
||||
if ($result == true) {
|
||||
return $this->success('发送合同成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(ContractLogic::getError());
|
||||
}
|
||||
|
||||
/**发送短信
|
||||
*
|
||||
*/
|
||||
public function postsms()
|
||||
{
|
||||
$params = (new CompanyValidate())->goCheck('detail');
|
||||
$id = Contract::where('party_b', $params['id'])->value('id');
|
||||
$res = ContractLogic::postsms(['id' => $id]);
|
||||
if ($res == true) {
|
||||
return $this->success('发送成功', [], 1, 1);
|
||||
} else {
|
||||
return $this->fail(ContractLogic::getError());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 小组服务公司任务下发 线上事故调试和紧急修复预案接口
|
||||
*/
|
||||
public function service_group_task_add_test()
|
||||
{
|
||||
//任务下发
|
||||
$companyId = $this->request->param('company_id');
|
||||
$time = strtotime(date('Y-m-d')); // 今天的00:00:00
|
||||
// 注意 cron_time
|
||||
$plan_all = TaskScheduling::where('cron_time', '<', time())
|
||||
->where('status', 1)
|
||||
->where('company_type', 18)
|
||||
->where('company_id', $companyId)
|
||||
->with('company_info')
|
||||
->select()
|
||||
->toArray();
|
||||
$plan_ids = [];
|
||||
dd($plan_all);
|
||||
foreach ($plan_all as $k => $v) {
|
||||
|
||||
$all = TaskTemplate::where('status', 1)->where('task_scheduling', $v['id'])->limit(30)->select()->toArray();
|
||||
|
||||
$plan_ids[] = $v['id'];
|
||||
if ($all) {
|
||||
$plan_all[$k]['template'] = $all;
|
||||
} else {
|
||||
unset($plan_all[$k]);
|
||||
}
|
||||
}
|
||||
$company_id = [];
|
||||
foreach ($plan_all as $k => $v) {
|
||||
foreach ($v['template'] as $kk => $vv) {
|
||||
// queue(TaskAdd::class,['data'=>$vv,'data_two'=>$v]);
|
||||
TaskLogic::CronAdd($vv, $v);
|
||||
}
|
||||
$company_id[] = $v['company_id'];
|
||||
}
|
||||
Company::where('id', 'in', $company_id)->inc('day_count')->update();
|
||||
TaskScheduling::where('id', 'in', $plan_ids)->update(['cron_time' => time()]);
|
||||
Log::info('小组服务公司定时任务下发执行成功' . date('Y-m-d H:i:s'));
|
||||
return $this->success('定时任务下发执行成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* 小组服务公司任务结算 线上事故调试和紧急修复预案接口
|
||||
*/
|
||||
public function service_group_task_settlement_test()
|
||||
{
|
||||
//
|
||||
$all = TaskSchedulingPlan::whereDay('end_time','today')
|
||||
->withJoin(['scheduling'], 'left')
|
||||
->where('scheduling.company_type', 18)
|
||||
->where('scheduling.company_id', 34)
|
||||
// ->where('is_pay',0)
|
||||
->with(['template_info'])
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
foreach($all as $k=>$data){
|
||||
try {
|
||||
TaskSchedulingPlan::where('id', $data['id'])->update(['is_pay' => 1]);
|
||||
$company = Company::where('id', $data['company_id'])->field('id,deposit,responsible_area,company_money,shareholder_money,user_id,day_count,company_type,province,city,area,street,village,brigade')->find(); // 可能要判断预存金是否满足
|
||||
$arr['status'] = 0;
|
||||
$arr['company_account_type'] = 1;
|
||||
//信息更新
|
||||
if ($data['template_info']['type'] == 31) {
|
||||
if ($data['template_info']['information_count'] < $data['template_info']['information_day_count']) {
|
||||
Log::info('信息更新任务,信息更新未达到要求:' . json_encode($data));
|
||||
Task::where('id', $data['task_id'])->update(['status' => 5]);
|
||||
TaskTemplate::where('id',$data['template_id'])->update(['information_count'=>$data['template_info']['information_day_count']]);
|
||||
return false;
|
||||
}
|
||||
$name = '小组队长';
|
||||
$arr['status'] = 1;
|
||||
$task = Task::where('id', $data['task_id'])->field('director_uid,money')->where('status', 3)->find();
|
||||
$arr['money'] = $task['money'];
|
||||
Task::where('id', $data['task_id'])->update(['status' => 3]);
|
||||
} elseif
|
||||
//交易金额
|
||||
($data['template_info']['type'] == 33) {
|
||||
$shang_date_total_price = App(RemoteController::class)->shang_date_total_price($company,[],$data['template_id']);
|
||||
if ($shang_date_total_price == false) {
|
||||
Log::info('交易金额任务,交易金额未达到要求:' . json_encode($data));
|
||||
Task::where('id', $data['task_id'])->update(['status' => 5]);
|
||||
return false;
|
||||
}
|
||||
$transaction_pool=$data['template_info']['transaction_pool'];//交易金额剩余池
|
||||
$count_money=bcadd($shang_date_total_price['arr']['total_price'],$transaction_pool,2);//交易金额加资金池金额
|
||||
if($count_money>$shang_date_total_price['arr']['day_money']){
|
||||
$day_money=bcsub($count_money,$shang_date_total_price['arr']['day_money'],2);//当计算剩余池before_transaction_pool
|
||||
$shang_date_total_price['arr']['before_transaction_pool']=$transaction_pool;//变化前
|
||||
$shang_date_total_price['arr']['after_count_transaction_pool']=$count_money;//变化后
|
||||
$shang_date_total_price['arr']['after_transaction_pool']=$day_money;//变化后
|
||||
Task::where('id', $data['task_id'])->update(['status' => 3,'extend'=>json_encode(['transaction'=>$shang_date_total_price])]);
|
||||
TaskTemplate::where('id',$data['template_info']['id'])->update(['transaction_pool'=>$day_money]);
|
||||
$shang_date_total_price['arr']['status']=1;
|
||||
}else{
|
||||
Log::info('交易金额任务,交易金额小于今日金额:' . json_encode($data));
|
||||
Task::where('id', $data['task_id'])->update(['status' => 5]);
|
||||
return false;
|
||||
}
|
||||
$name = $shang_date_total_price['name'];
|
||||
$arr['status'] = $shang_date_total_price['arr']['status'];
|
||||
$task = Task::where('id', $data['task_id'])->field('money')->find();
|
||||
$arr['money'] = $task['money'];
|
||||
} elseif
|
||||
//三轮车
|
||||
($data['template_info']['type'] == 32){
|
||||
$task = Task::where('id', $data['task_id'])->field('director_uid,money')->where('status', 3)->with('director_info')->find();
|
||||
if(empty($task)){
|
||||
Log::info('三轮车任务 ' . $data['template_info']['title'] . '结算失败,任务为空:' . json_encode($data));
|
||||
Task::where('id', $data['task_id'])->update(['status' => 5]);
|
||||
return true;
|
||||
}
|
||||
$name=$task['director_info']['nickname'];
|
||||
$arr['status'] = 1;
|
||||
$arr['money'] = $task['money'];
|
||||
}elseif
|
||||
//入股任务
|
||||
($data['template_info']['type'] == 35){
|
||||
$task_35 = Task::where('id', $data['task_id'])->field('director_uid,status,money,start_time,end_time')->with('director_info')->find();
|
||||
if($task_35){
|
||||
$day= $data['template_info']['stage_day_one'] + $data['template_info']['stage_day_two'];
|
||||
// if($task_35['status']==3 && $data['template_info']['day_count']<=$day){
|
||||
// $name = $task_35['director_info']['nickname'];
|
||||
// $arr['status'] = 1;
|
||||
// $arr['money'] = $task_35['money'];
|
||||
// $arr['company_account_type'] = 2;
|
||||
// }else{
|
||||
if ($task_35['status'] == 3) {
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* 判断入股任务 单次类型 是否超时
|
||||
* 未超时时刷新开始结束时间
|
||||
* 超时则关闭
|
||||
*/
|
||||
if($data['template_info']['day_count']<=$day){
|
||||
TaskSchedulingPlan::where('id', $data['id'])->update(['is_pay' => 0]);
|
||||
try{
|
||||
Task::where('id', $data['task_id'])->update(['create_time' => $task_35['start_time']+86400,'update_time' =>time(),'start_time'=>$task_35['start_time']+86400,'end_time'=>$task_35['start_time']+86400+86399]);
|
||||
}catch(\Exception $e){
|
||||
$start_time = strtotime(date('Y-m-d'));
|
||||
Task::where('id', $data['task_id'])->update(['create_time' => $start_time+86400,'update_time' =>time(),'start_time'=>$start_time+86400,'end_time'=> $start_time + 86400+86399]);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if($data['template_info']['day_count']>$day){
|
||||
Task::where('id', $data['task_id'])->update(['status' =>5]);
|
||||
Log::info('入股任务 ' . $data['template_info']['title'] . '结算失败,任务为超时:' . json_encode($data));
|
||||
return false;
|
||||
}
|
||||
// }
|
||||
}else{
|
||||
Log::info('入股任务 ' . $data['template_info']['title'] . '结算失败,任务为空:' . json_encode($data));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
//其他类型任务
|
||||
$task = Task::where('id', $data['task_id'])->with('director_info')->find();
|
||||
if ($task['status'] == 3) {
|
||||
$name = $task['director_info']['nickname'];
|
||||
$arr['status'] = 1;
|
||||
$arr['money'] = $task['money'];
|
||||
} else if ($task['status'] == 2) {
|
||||
// 是否超时
|
||||
$day= $data['template_info']['stage_day_one'] + $data['template_info']['stage_day_two'];
|
||||
|
||||
if($data['template_info']['day_count'] >= $day){
|
||||
Task::where('id', $data['task_id'])->update(['status' =>5]);
|
||||
Log::info( $data['template_info']['title'] . '结算失败,任务为超时:' . json_encode($data));
|
||||
return false;
|
||||
}
|
||||
|
||||
if($data['template_info']['day_count'] < $day){
|
||||
TaskSchedulingPlan::where('id', $data['id'])->update(['is_pay' => 0]);
|
||||
try{
|
||||
Task::where('id', $data['task_id'])->update(['create_time' => $task['start_time']+86400,'update_time' =>time(),'start_time'=>$task['start_time']+86400,'end_time'=>$task['start_time']+86400+86399]);
|
||||
}catch(\Exception $e){
|
||||
$start_time = strtotime(date('Y-m-d'));
|
||||
Task::where('id', $data['task_id'])->update(['create_time' => $start_time+86400,'update_time' =>time(),'start_time'=>$start_time+86400,'end_time'=> $start_time + 86400+86399]);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
Log::error('line:'.$e->getLine().'异常报错:任务结算失败:' . $data['template_info']['title'] . $e->getMessage() . json_encode($data));
|
||||
return false;
|
||||
}
|
||||
if ($arr['status'] == 1) {
|
||||
$arr['company_id'] = $data['scheduling']['company_id'];
|
||||
$arr['msg'] = '来自任务【' . $data['template_info']['title'] . '】,完成方:' . $name . ',任务结算';
|
||||
// $arr['proportion_one'] = $data['template_info']['proportion_one'];
|
||||
// $arr['proportion_two'] = $data['template_info']['proportion_two'];
|
||||
$arr['sn'] = $data['sn'];
|
||||
$arr['id'] = $data['id'];
|
||||
(new ShareProfit())->first($arr, $company,$data);
|
||||
} else {
|
||||
Task::where('id', $data['task_id'])->update(['status' => 5]);
|
||||
Log::info('任务status=0结算失败:' . $data['template_info']['title'] . '未完成' . json_encode($data));
|
||||
}
|
||||
// queue(TaskInformationJob::class,$v);
|
||||
}
|
||||
Log::info('小组服务公司定时任务结算执行成功'.date('Y-m-d H:i:s'));
|
||||
return $this->success('小组服务公司定时任务结算执行成功');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 镇农科公司任务下发 线上事故调试和紧急修复预案接口
|
||||
*/
|
||||
public function town_task_add_ceshi()
|
||||
{
|
||||
//任务下发
|
||||
$companyId = $this->request->param('company_id');
|
||||
$taskTypeIds = $this->request->param('task_type_ids');
|
||||
$time = strtotime(date('Y-m-d'));
|
||||
// 查询系统 所有镇农科公司 未下发 的 任务安排
|
||||
$taskSchedulingList = TaskScheduling::where('cron_time', '<', time())
|
||||
->where('status', 1)
|
||||
->where('company_type', 16)
|
||||
->where('company_id', $companyId)
|
||||
->with('company_info')
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
$taskSchedulingIds = [];
|
||||
$companyIds = [];
|
||||
|
||||
foreach ($taskSchedulingList as $k => $taskScheduling) {
|
||||
$templateList = TaskTemplate::where('status', 1)->where('task_scheduling', $taskScheduling['id'])->limit(30)->select()->toArray();
|
||||
|
||||
$taskSchedulingIds[] = $taskScheduling['id'];
|
||||
$companyIds[] = $taskScheduling['company_id'];
|
||||
foreach ($templateList as $template) {
|
||||
if (in_array($template['type'], explode(',', $taskTypeIds))) {
|
||||
TaskLogic::TownCronAdd($template); // 手动下发用
|
||||
}
|
||||
// queue(TownTaskAdd::class, $template);
|
||||
|
||||
}
|
||||
|
||||
if (empty($templateList)) {
|
||||
unset($taskSchedulingList[$k]);
|
||||
}
|
||||
}
|
||||
Company::where('id', 'in', $companyIds)->inc('day_count')->update();
|
||||
TaskScheduling::where('id', 'in', $taskSchedulingIds)->update(['cron_time' => time()]);
|
||||
Log::info('定时任务下发执行成功' . date('Y-m-d H:i:s'));
|
||||
return $this->success('定时任务下发执行成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* 镇农科公司任务结算 线上事故调试和紧急修复预案接口
|
||||
*/
|
||||
public function town_task_settlement_ceshi()
|
||||
{
|
||||
// 今日未结算的任务计划
|
||||
$taskSchedulingPlanList = TaskSchedulingPlan::whereDay('end_time','today')
|
||||
->withJoin(['scheduling'], 'left')
|
||||
->where('scheduling.company_type', 16)
|
||||
->where('is_pay',0)
|
||||
->with(['template_info'])
|
||||
->select()
|
||||
->toArray();
|
||||
dd($taskSchedulingPlanList);
|
||||
foreach($taskSchedulingPlanList as $taskSchedulingPlan) {
|
||||
if ($taskSchedulingPlan['company_id'] == 30 && $taskSchedulingPlan['template_info']['type'] == 50) {
|
||||
|
||||
TaskLogic::townTaskSettlement($taskSchedulingPlan);
|
||||
}
|
||||
}
|
||||
return $this->success('镇农科公司定时任务结算执行成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* 村管理公司任务下发
|
||||
*/
|
||||
public function village_task_add_test()
|
||||
{
|
||||
//任务下发
|
||||
$time = strtotime(date('Y-m-d'));
|
||||
// 查询系统 所有镇农科公司 未下发 的 任务安排
|
||||
$taskSchedulingList = TaskScheduling::where('cron_time', '<', time())
|
||||
->where('status', 1)
|
||||
->where('company_type', 17)
|
||||
->where('company_id', 33)
|
||||
->with('company_info')
|
||||
->select()
|
||||
->toArray();
|
||||
dd($taskSchedulingList);
|
||||
$taskSchedulingIds = [];
|
||||
$companyIds = [];
|
||||
foreach ($taskSchedulingList as $k => $taskScheduling) {
|
||||
$templateList = TaskTemplate::where('status', 1)->where('task_scheduling', $taskScheduling['id'])->limit(30)->select()->toArray();
|
||||
$taskSchedulingIds[] = $taskScheduling['id'];
|
||||
$companyIds[] = $taskScheduling['company_id'];
|
||||
foreach ($templateList as $template) {
|
||||
|
||||
if ($template['type'] == 69) {
|
||||
TaskLogic::VillageCronAdd($template); // 手动下发用
|
||||
}
|
||||
|
||||
|
||||
// queue(VillageTaskAdd::class, $template);
|
||||
|
||||
}
|
||||
|
||||
if (empty($templateList)) {
|
||||
unset($taskSchedulingList[$k]);
|
||||
}
|
||||
}
|
||||
Company::where('id', 'in', $companyIds)->inc('day_count')->update();
|
||||
TaskScheduling::where('id', 'in', $taskSchedulingIds)->update(['cron_time' => time()]);
|
||||
Log::info('村管理公司定时任务下发执行成功' . date('Y-m-d H:i:s'));
|
||||
return $this->success('村管理公司定时任务下发执行成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* 村管理公司任务结算
|
||||
*/
|
||||
public function village_task_settlement_test()
|
||||
{
|
||||
Log::info('村管理公司定时任务结算执行-开始'.date('Y-m-d H:i:s'));
|
||||
//today 今日未结算的任务计划
|
||||
$taskSchedulingPlanList = TaskSchedulingPlan::whereDay('end_time','yesterday')
|
||||
->withJoin(['scheduling'], 'left')
|
||||
->where('scheduling.company_type', 17)
|
||||
->where('scheduling.company_id', 33)
|
||||
->where('is_pay',0)
|
||||
->with(['template_info'])
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
foreach($taskSchedulingPlanList as $taskSchedulingPlan){
|
||||
|
||||
TaskLogic::villageTaskSettlement($taskSchedulingPlan);
|
||||
|
||||
// queue(VillageTaskSettlementJob::class, $taskSchedulingPlan);
|
||||
}
|
||||
Log::info('村管理公司定时任务结算执行-结束'.date('Y-m-d H:i:s'));
|
||||
return $this->success('村管理公司定时任务结算执行成功');
|
||||
}
|
||||
|
||||
|
||||
public function countRate()
|
||||
{
|
||||
// 第一个月
|
||||
$startTime1 = strtotime(date('Y-m-d', time())); // 任务下发当天 00:00:00
|
||||
$endTime1 = strtotime("+30 day", $startTime1); // 30天后的00:00:00
|
||||
|
||||
|
||||
// 第二个月
|
||||
$startTime2 = strtotime(date('Y-m-d', $endTime1)); // 第一个月截止日 00:00:00
|
||||
$endTime2 = strtotime("+30 day", $startTime2); // 30天后的00:00:00
|
||||
dd([date('Y-m-d H:i:s', $startTime1), date('Y-m-d H:i:s', $endTime1), date('Y-m-d H:i:s', $startTime2), date('Y-m-d H:i:s', $endTime2)]);
|
||||
$procureAmount = 1234;
|
||||
$step = $this->request->param('step', 1);
|
||||
// 商户入驻至今累计天数
|
||||
$targetProcureAmount = 10000;
|
||||
// 目标采购额每阶段增幅30%
|
||||
for ($i = 1; $i < $step; $i++) {
|
||||
$targetProcureAmount = self::increase($targetProcureAmount);
|
||||
}
|
||||
dd($targetProcureAmount);
|
||||
$rate = bcdiv($procureAmount, $targetProcureAmount, 2);
|
||||
return $rate;
|
||||
}
|
||||
|
||||
private static function increase($value)
|
||||
{
|
||||
return bcmul($value, 1.3,2);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加供应链商户
|
||||
*/
|
||||
public function addSupplyMerchant()
|
||||
{
|
||||
try {
|
||||
// 添加商户数据
|
||||
$params = $this->request->param();
|
||||
$data = [
|
||||
'mer_intention_id' => 0, // 商城商户入驻申请id,签约完成后回调使用
|
||||
'company_name' => $params['company_name']??'',
|
||||
'mer_name' => $params['mer_name']??'', // 店铺名称
|
||||
'organization_code' => $params['organization_code']??'',
|
||||
'city' => $params['city']??'',
|
||||
'area' => $params['area']??'',
|
||||
'street' => $params['street']??'',
|
||||
'address' => $params['address']??'',
|
||||
'master_name' => $params['master_name']??'',
|
||||
'master_phone' => $params['master_phone']??'',
|
||||
'master_email' => $master_email??'',
|
||||
'type_name' => $params['type_name'] ?? '', //店铺类型
|
||||
'category_name' => $params['category_name'] ?? '', //商户分类
|
||||
'qualification' => !empty($params['images'])?$params['images']:json_encode([])
|
||||
];
|
||||
$shopMerchantModel = ShopMerchant::create($data);
|
||||
|
||||
$shopMerchantCertificationData = [
|
||||
'name' => $shopMerchantModel->company_name,
|
||||
'organization_code' => $shopMerchantModel->organization_code,
|
||||
'business_license' => 'https://lihai001.oss-cn-chengdu.aliyuncs.com/def/561f8202305171526091317.png',
|
||||
'master_name' => $shopMerchantModel->master_name,
|
||||
'master_email' => $shopMerchantModel->master_email,
|
||||
'master_phone' => $shopMerchantModel->master_phone,
|
||||
'id' => $shopMerchantModel->id,
|
||||
];
|
||||
$re = app(JunziqianController::class)->ShopMerchantCertification($shopMerchantCertificationData);
|
||||
|
||||
return $this->success('成功', $shopMerchantModel->toArray());
|
||||
} catch (Exception $e) {
|
||||
return $this->fail($e->getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 生成合同
|
||||
public function signSupplyMerchantContract()
|
||||
{
|
||||
try {
|
||||
$params = $this->request->param();
|
||||
// 生成合同
|
||||
$createContractData = [
|
||||
'id' => $params['id'],
|
||||
'party_a' => $params['party_a'],
|
||||
'party_a_name' => $params['party_a_name'],
|
||||
'party_b' => $params['party_b'],
|
||||
'party_b_name' => $params['party_b_name'],
|
||||
'contract_type' => 58, // 供应链商户合同
|
||||
];
|
||||
$model = new ShopContract();
|
||||
$model->contract_no = time();
|
||||
$model->create_time = time();
|
||||
$model->check_status = 1;
|
||||
$model->update_time = time();
|
||||
$model->setAttrs($createContractData);
|
||||
$res = $model->save($createContractData);
|
||||
return $this->success('成功', $res->toArray());
|
||||
} catch (Exception $e) {
|
||||
return $this->fail($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function testShopApi()
|
||||
{
|
||||
$id = $this->request->param('id');
|
||||
$templateInfo = TaskTemplate::where(['id'=>$id])->find();
|
||||
$townCompany = Company::where(['id' => $templateInfo['company_id']])->find();
|
||||
|
||||
$param['start_time'] = strtotime(date('Y-m-d', $templateInfo['cretate_time'])) + 86400;
|
||||
$param['end_time'] = time();
|
||||
$param['mer_intention_id'] = 131;
|
||||
// $param['goods_id'] = '17,18';
|
||||
$param['type_id'] = 10;
|
||||
|
||||
|
||||
// todo 返回字段要对接
|
||||
$result = ShopRequestLogic::getGeneralMerchantProductListing($param);
|
||||
dd($result);
|
||||
}
|
||||
}
|
@ -1,13 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\common\model\dict\DictData;
|
||||
use think\facade\Db;
|
||||
|
||||
class CommonController extends BaseApiController
|
||||
{
|
||||
public array $notNeedLogin = ['city', 'area', 'street','province','village','brigade','dict_data_lists','dict_data_lists_by_type_value','getMiniProgramInfo'];
|
||||
public array $notNeedLogin = ['city', 'area', 'street','province','village','brigade'];
|
||||
|
||||
//**省列表 */
|
||||
public function province()
|
||||
@ -45,36 +43,4 @@ class CommonController extends BaseApiController
|
||||
$data = Db::name('geo_brigade')->select();
|
||||
return $this->data($data->toArray());
|
||||
}
|
||||
|
||||
//**字典列表 */
|
||||
public function dict_data_lists($type_id)
|
||||
{
|
||||
$data= DictData::where(['type_id' => $type_id])
|
||||
->append(['status_desc'])
|
||||
->limit(100)
|
||||
->order(['sort' => 'desc', 'id' => 'desc'])
|
||||
->select();
|
||||
|
||||
return $this->data($data->toArray());
|
||||
|
||||
}
|
||||
|
||||
public function dict_data_lists_by_type_value($type_value)
|
||||
{
|
||||
$data= DictData::where(['type_value' => $type_value])
|
||||
->append(['status_desc'])
|
||||
->limit(100)
|
||||
->order(['sort' => 'desc', 'id' => 'desc'])
|
||||
->select();
|
||||
|
||||
return $this->data($data->toArray());
|
||||
|
||||
}
|
||||
|
||||
public function getMiniProgramInfo()
|
||||
{
|
||||
$param = $this->request->param();
|
||||
$data = Db::name('miniprogram')->where(['name' => $param['name']])->order('id', 'desc')->find();
|
||||
return $this->data($data);
|
||||
}
|
||||
}
|
||||
|
@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\common\model\company\CompanyAccountLog;
|
||||
|
||||
class CompanyAccountLogController extends BaseApiController{
|
||||
|
||||
public function lists(){
|
||||
[$page,$limit]=$this->getPage();
|
||||
$where=[];
|
||||
$where['company_id']=$this->userInfo['company_id'];
|
||||
$where['change_object']=CompanyAccountLog::SHAREHOLDER;
|
||||
// $where['change_type']=CompanyAccountLog::TASK_INC_SHAREHOLDER_MONEY;
|
||||
$count=CompanyAccountLog::where($where)->count();
|
||||
$lists=CompanyAccountLog::where($where)->page($page,$limit)->order('id','desc')->select();
|
||||
return $this->success('ok',['count'=>$count,'list'=>$lists]);
|
||||
}
|
||||
}
|
@ -2,20 +2,13 @@
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\common\logic\CompanyLogic;
|
||||
use app\common\logic\contract\ContractLogic;
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\auth\AdminRole;
|
||||
use app\common\model\auth\SystemRole;
|
||||
use app\common\model\Company;
|
||||
use app\common\model\company\CompanyAccountLog;
|
||||
use app\common\model\CompanyDepositVoucher;
|
||||
use app\common\model\contract\Contract;
|
||||
use app\common\model\task\Task;
|
||||
use app\common\model\user\User;
|
||||
use app\common\model\user\UserAccountLog;
|
||||
use think\Exception;
|
||||
use think\facade\Db;
|
||||
use app\common\model\informationg\UserInformationg;
|
||||
use app\common\model\informationg\UserInformationgDemand;
|
||||
|
||||
/**
|
||||
* Class CompanyController
|
||||
@ -23,16 +16,14 @@ use app\common\model\informationg\UserInformationgDemand;
|
||||
*/
|
||||
class CompanyController extends BaseApiController
|
||||
{
|
||||
public array $notNeedLogin = ['street_company'];
|
||||
|
||||
|
||||
//**签约公司*/
|
||||
public function index()
|
||||
{
|
||||
[$page, $limit] = $this->getPage();
|
||||
$myCompany = Company::findOrEmpty($this->userInfo['company_id'])->toArray();
|
||||
$admin = Admin::findOrEmpty($this->userInfo['admin_id']);
|
||||
$myCompany = Company::findOrEmpty($admin['company_id'])->toArray();
|
||||
$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', 'village_name', 'brigade_name', 'area_manager_name']);
|
||||
$query = Company::whereIn('id', $companyIds)->append(['province_name', 'city_name', 'area_name', 'street_name', 'area_manager_name']);
|
||||
$count = $query->count();
|
||||
$companies = $query->page($page)->limit($limit)->select()->each(function ($company) {
|
||||
$company['other_contacts'] = json_decode($company['other_contacts'], true);
|
||||
@ -42,39 +33,22 @@ class CompanyController extends BaseApiController
|
||||
return $this->success('', ['count' => $count, 'data' => $companies]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 未签约
|
||||
*/
|
||||
public function unsigned()
|
||||
{
|
||||
$myCompany = Company::findOrEmpty($this->userInfo['company_id'])->toArray();
|
||||
$query = Company::where(['street' => $myCompany['street'], 'company_type' => [17, 18], 'is_contract' => 0])->where('id', '<>', $this->userInfo['company_id']);
|
||||
$count = $query->count();
|
||||
$companies = $query->field('*,street street_name,area area_name,city city_name,province province_name,village village_name,brigade brigade_name')->select()->toArray();
|
||||
return $this->success('', ['count' => $count, 'data' => $companies]);
|
||||
}
|
||||
|
||||
public function view()
|
||||
{
|
||||
$id = $this->request->param('id', 0);
|
||||
if (empty($id)) {
|
||||
$query = Company::find($this->userInfo['company_id']);
|
||||
$admin = Admin::findOrEmpty($this->userInfo['admin_id']);
|
||||
$query = Company::find($admin['company_id']);
|
||||
} else {
|
||||
$query = Company::find($id);
|
||||
}
|
||||
if (!$query) {
|
||||
return $this->fail('公司不存在');
|
||||
}
|
||||
$company = $query->append(['province_name', 'city_name', 'area_name', 'street_name', 'area_manager_name', 'village_name', 'brigade_name'])->toArray();
|
||||
$company = $query->append(['province_name', 'city_name', 'area_name', 'street_name', 'area_manager_name'])->toArray();
|
||||
$company['other_contacts'] = json_decode($company['other_contacts'], true);
|
||||
$company['qualification'] = $company['qualification'] != null ? json_decode($company['qualification'], true) : '';
|
||||
if ($company['qualification'] && isset($company['qualification']['other_qualifications'])) {
|
||||
$company['qualification']['other_qualifications'] = json_decode($company['qualification']['other_qualifications'], true);
|
||||
}
|
||||
$contract = Contract::where('party_b', $id)->find();
|
||||
$contract = Contract::find($company['contract_id']);
|
||||
if (!empty($contract)) {
|
||||
if ($contract['type'] == 2) {
|
||||
$contract['party_b_name'] = User::where('id', $contract['party_b'])->value('nickname');
|
||||
if ($contract['admin_id'] != 0) {
|
||||
$contract['party_b_name'] = Admin::where('id', $contract['admin_id'])->value('name');
|
||||
} else {
|
||||
$contract['party_b_name'] = Db::name('company')->where('id', $contract['party_b'])->value('company_name');
|
||||
}
|
||||
@ -83,319 +57,55 @@ class CompanyController extends BaseApiController
|
||||
$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['day_money_count'] = UserAccountLog::where(['company_id' => $company['id'], 'action' => 1])->whereDay('create_time')->sum('change_amount');
|
||||
// $users = Admin::where('id', $company['admin_id'])->field('id,name,account,phone,qualification')->select()->toArray();
|
||||
// foreach ($users as &$user) {
|
||||
// $user['is_main'] = $user['id'] == $company['admin_id'] ? 1 : 0;
|
||||
// $user['qualification'] = $user['qualification'] != null ? json_decode($user['qualification'], true) : [];
|
||||
// unset($user['role_id'], $user['dept_id'], $user['jobs_id'], $user['id']);
|
||||
// }
|
||||
return $this->success('success', ['contract' => $contract ?? [], 'company' => $company]);
|
||||
$users = Admin::where('company_id', $company['id'])->field('id,name,account,phone,qualification')->select()->toArray();
|
||||
foreach ($users as &$user) {
|
||||
$user['is_main'] = $user['id'] == $company['admin_id'] ? 1 : 0;
|
||||
$user['qualification'] = $user['qualification'] != null ? json_decode($user['qualification'], true) : [];
|
||||
unset($user['role_id'], $user['dept_id'], $user['jobs_id'], $user['id']);
|
||||
}
|
||||
return $this->success('success', ['contract' => $contract ?? [], 'company' => $company, 'users' => $users]);
|
||||
}
|
||||
|
||||
public function areaManager()
|
||||
{
|
||||
[$page, $limit] = $this->getPage();
|
||||
$company = Company::find($this->userInfo['company_id']);
|
||||
$admin = Admin::find($this->userInfo['admin_id']);
|
||||
$company = Company::find($admin['company_id']);
|
||||
$query = Admin::where('id', $company['area_manager']);
|
||||
$count = $query->count();
|
||||
$data = $query->page($page)->limit($limit)->append(['province_name', 'city_name', 'area_name', 'street_name'])->field('id,name,account,avatar,province,city,area,street')->select()->toArray();
|
||||
return $this->success('success', ['count' => $count, 'data' => $data]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 公司人员
|
||||
*/
|
||||
public function users()
|
||||
{
|
||||
[$page, $limit] = $this->getPage();
|
||||
$params = $this->request->param();
|
||||
// if($companyId==0){
|
||||
// $companyId=$this->userInfo['company_id'];
|
||||
// }
|
||||
$wehre[] = ['company_id', '=', $this->userInfo['company_id']];
|
||||
if (isset($params['is_captain']) && $params['is_captain'] == 1) {
|
||||
$wehre[] = ['is_captain', '=', 1];
|
||||
}
|
||||
$query = User::where($wehre);
|
||||
$companyId = $this->request->param('company_id', 0);
|
||||
$query = User::where('company_id', $companyId);
|
||||
$count = $query->count();
|
||||
$users = $query->order('id', 'desc')->page($page)->limit($limit)->with(['company' => function ($query) {
|
||||
$users = $query->page($page)->limit($limit)->with(['company' => function ($query) {
|
||||
$query->field('id,company_name');
|
||||
}])->append(['province_name', 'city_name', 'area_name', 'street_name', 'village_name', 'brigade_name'])
|
||||
->field('id,avatar,real_name,account,mobile as phone,province,city,area,street,village,brigade,company_id,create_time,qualification,nickname,is_contract,is_captain')
|
||||
->select()->each(function ($item, $key) {
|
||||
if ($item['qualification'] != '') {
|
||||
$item['qualification'] = json_decode($item['qualification'], true);
|
||||
}
|
||||
if ($item['is_captain'] == 1) {
|
||||
$item['informationg_count'] = UserInformationg::where(['create_user_id' => $item['id'], 'status' => 1])->count();
|
||||
$item['informationg_update_count'] = UserInformationg::where(['create_user_id' => $item['id'], 'status' => 1, 'is_update' => 1])->count();
|
||||
$time = UserInformationgDemand::order('update_time', 'desc')->value('update_time');
|
||||
if ($time) {
|
||||
$item['informationg_update_time'] = date('Y-m-d H:i:s', $time);
|
||||
} else {
|
||||
$item['informationg_update_time'] = '';
|
||||
}
|
||||
}
|
||||
});
|
||||
}])->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')->select()->each(function($item,$key){
|
||||
if($item['qualification']!=''){
|
||||
$item['qualification']=json_decode($item['qualification'],true);
|
||||
}
|
||||
});
|
||||
return $this->success('success', ['count' => $count, 'data' => $users]);
|
||||
}
|
||||
|
||||
public function user($id)
|
||||
{
|
||||
$query = User::where('id', $id);
|
||||
$query = Admin::where('id', $id);
|
||||
$user = $query->with(['company' => function ($query) {
|
||||
$query->field('id,company_name');
|
||||
}])
|
||||
->field('id,sex,avatar,nickname name,account,mobile phone,id_card,qualification,province,province province_name,city,city city_name,area,area area_name,street,street street_name,village,village village_name,brigade,brigade brigade_name, is_contract,company_id,is_captain, group_id')
|
||||
->append(['is_service_manager'], true)
|
||||
->withAttr('is_service_manager', function ($value, $data) {
|
||||
return $data['group_id'] == 14 ?1 :0;
|
||||
})
|
||||
->find()
|
||||
->toArray();
|
||||
|
||||
$contract = Contract::where("type", 2)->where('party_b', $id)->append(['contract_type_name'])->find();
|
||||
}])->append(['province_name', 'city_name', 'area_name', 'street_name'])->field('id,sex,avatar,name,account,phone,id_card,qualification,province,city,area,street,is_contract,company_id')->find()->toArray();
|
||||
$contract = Contract::whereRaw("(type=1 and party_b={$user['company_id']}) or (type=2 and party_b={$user['id']})")->append(['contract_type_name'])->find();
|
||||
$user['contract'] = $contract;
|
||||
// $roleIds = AdminRole::where('admin_id', $user['id'])->column('role_id');
|
||||
// $user['roles'] = SystemRole::whereIn('id', $roleIds)->column('name');
|
||||
$roleIds = AdminRole::where('admin_id', $user['id'])->column('role_id');
|
||||
$user['roles'] = SystemRole::whereIn('id', $roleIds)->column('name');
|
||||
$user['qualification'] = $user['qualification'] != null ? json_decode($user['qualification'], true) : [];
|
||||
unset($user['role_id'], $user['dept_id'], $user['jobs_id']);
|
||||
return $this->success('success', $user);
|
||||
}
|
||||
|
||||
//**发起合同 */
|
||||
public function initiate_contract()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
$params['party_a'] = $this->userInfo['company_id'];
|
||||
$area_manager = Company::where('id', $params['party_a'])->value('area_manager');
|
||||
$params['area_manager'] = $area_manager;
|
||||
$params['type'] = 1;
|
||||
$result = ContractLogic::initiate_contract($params);
|
||||
if ($result == true) {
|
||||
return $this->success('发起成功,等待平台风控部上传合同');
|
||||
}
|
||||
return $this->fail(ContractLogic::getError());
|
||||
}
|
||||
// /**发送合同 */
|
||||
public function Draftingcontracts()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
$result = ContractLogic::Draftingcontracts($params, 1);
|
||||
if ($result == true) {
|
||||
return $this->success('生成合同成功');
|
||||
}
|
||||
return $this->fail(ContractLogic::getError());
|
||||
}
|
||||
|
||||
//**发送短信 */
|
||||
public function postsms()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
$id = Contract::where('party_b', $params['id'])->value('id');
|
||||
$res = ContractLogic::postsms(['id' => $id]);
|
||||
if ($res == true) {
|
||||
return $this->success('发送成功', [], 1, 1);
|
||||
} else {
|
||||
return $this->fail(ContractLogic::getError());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 股金管理
|
||||
*/
|
||||
public function shareholder_info()
|
||||
{
|
||||
// $params = $this->request->param();
|
||||
$find = Company::where('id', $this->userInfo['company_id'])->field('id,shareholder_money,village')->find()->toArray();
|
||||
$find['is_contract'] = 0;
|
||||
$find['check_status'] = 0;
|
||||
if ($find) {
|
||||
$contract = Contract::where('party_b', $this->userInfo['company_id'])->where('contract_type', 40)->field('id,contract_no,contract_url,create_time,check_status,status')->find();
|
||||
if ($contract) {
|
||||
if($contract['contract_url']=='' &&$contract['status']==1){
|
||||
app(JunziqianController::class)->download_file($contract['contract_no']);
|
||||
$contract_url = Contract::where('id', $contract['id'])->value('contract_url');
|
||||
$find['contract_url'] = env('url.url_prefix'). $contract_url;
|
||||
|
||||
}else{
|
||||
$find['contract_url'] = env('url.url_prefix') . $contract['contract_url'];
|
||||
}
|
||||
$find['contract_time'] = $contract['create_time'];
|
||||
$find['check_status'] = $contract['check_status'];
|
||||
if ($contract['status'] == 1) {
|
||||
$find['is_contract'] = 1;
|
||||
}
|
||||
}
|
||||
$village_info = Company::where('village', $find['village'])->where('company_type', 17)->find();
|
||||
if ($village_info) {
|
||||
$find['is_village'] = 1;
|
||||
} else {
|
||||
$find['is_village'] = 0;
|
||||
}
|
||||
// 股金任务是否完成
|
||||
$task = Task::where(['company_id' => $find['id'], 'type' => 35, 'status' => 3])->find();
|
||||
$find['is_done_task'] = 0;
|
||||
if (!empty($task)) {
|
||||
$find['is_done_task'] = 1;
|
||||
}
|
||||
} else {
|
||||
$find['contract_url'] = '';
|
||||
$find['contract_time'] = '';
|
||||
$find['is_village'] = 0;
|
||||
$find['is_done_task'] = 0;
|
||||
}
|
||||
return $this->success('ok', $find);
|
||||
}
|
||||
|
||||
//**发起股金合同 */
|
||||
public function initiate_shareholder_contract()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
$params['party_b'] = $this->userInfo['company_id'];
|
||||
if(!$params['party_b']){
|
||||
return $this->fail('请先绑定公司');
|
||||
}
|
||||
$Company = Company::where('id', $this->userInfo['company_id'])->where('company_type',18)->field('shareholder_money,village')->find();
|
||||
if($Company){
|
||||
$params['party_a'] = Company::where('village', $Company['village'])->where('company_type', 17)->value('id');
|
||||
}else{
|
||||
return $this->fail('您不是小组公司');
|
||||
|
||||
}
|
||||
if(!isset($params['party_a'])||$params['party_a']==0){
|
||||
return $this->fail('甲方公司不存在');
|
||||
}
|
||||
$area_manager = Company::where('id', $params['party_b'])->value('area_manager');
|
||||
$params['area_manager'] = $area_manager;
|
||||
$params['type'] = 1;
|
||||
$result = ContractLogic::initiate_contract($params);
|
||||
if ($result == true) {
|
||||
return $this->success('发起成功,等待平台风控部上传合同');
|
||||
}
|
||||
return $this->fail(ContractLogic::getError());
|
||||
}
|
||||
|
||||
/**
|
||||
* 小组服务公司股金上交
|
||||
*/
|
||||
public function pay_share_capital()
|
||||
{
|
||||
try {
|
||||
// 小组服务公司
|
||||
$serviceGroupCompany = Company::where('id', $this->userInfo['company_id'])->find()->toArray();
|
||||
// 村管理公司
|
||||
$villageCompany = Company::where(['village'=>$serviceGroupCompany['village'], 'company_type' => 17])->find()->toArray();
|
||||
Db::startTrans();
|
||||
// 上交股金金额
|
||||
$amount = $serviceGroupCompany['shareholder_money'];
|
||||
if ($amount == 0) {
|
||||
return $this->fail('股金金额不能为0');
|
||||
}
|
||||
$sharecapitalChangeLogData = [
|
||||
'subordinate_company_id' => $serviceGroupCompany['id'],
|
||||
'parent_company_id' => $villageCompany['id'],
|
||||
'amount' => $amount,
|
||||
'create_time' => time(),
|
||||
'update_time' => time(),
|
||||
];
|
||||
$sharecapitalChangeLogInsertId = Db::name('company_sharecapital_change_log')->insertGetId($sharecapitalChangeLogData);
|
||||
|
||||
// 小组服务公司股金变动 + 公司股金减少记录
|
||||
$leftAmount = bcsub($serviceGroupCompany['shareholder_money'], $amount, 2);
|
||||
Company::where('id', $this->userInfo['company_id'])->save(['shareholder_money'=> $leftAmount]);
|
||||
$company_log1 = [
|
||||
'sn' => generate_sn(UserAccountLog::class, 'sn', 20),
|
||||
'company_id' => $serviceGroupCompany['id'],
|
||||
'change_object' => 2, // 变动对象 1余额 2股金
|
||||
'change_type' => CompanyAccountLog::SHAREHOLDER_DEC_DEPOSIT, //变动类型
|
||||
'action' => 2, //1-增加 2-减少
|
||||
'left_amount' => $leftAmount, //变动后数量
|
||||
'change_amount' => $amount, //变动数量
|
||||
'extend' => json_encode(['company_sharecapital_change_log_id' => $sharecapitalChangeLogInsertId]),
|
||||
'status' => 1,
|
||||
];
|
||||
CompanyAccountLog::create($company_log1);
|
||||
|
||||
// 村管理公司股金变动 + 公司股金增加记录
|
||||
$addAmount = bcadd($villageCompany['shareholder_money'], $amount, 2);
|
||||
Company::where('id', $villageCompany['id'])->save(['shareholder_money'=>$addAmount]);
|
||||
|
||||
// 公司账户变动记录
|
||||
$company_log2 = [
|
||||
'sn' => generate_sn(UserAccountLog::class, 'sn', 20),
|
||||
'company_id' => $villageCompany['id'],
|
||||
'change_object' => 2, // 变动对象 1余额 2股金
|
||||
'change_type' => CompanyAccountLog::TASK_INC_SHAREHOLDER_MONEY, //变动类型
|
||||
'action' => 1, //1-增加 2-减少
|
||||
'left_amount' => $addAmount, //变动后数量
|
||||
'change_amount' => $amount, //变动数量
|
||||
'extend' => json_encode(['company_sharecapital_change_log_id' => $sharecapitalChangeLogInsertId]),
|
||||
'status' => 1,
|
||||
];
|
||||
CompanyAccountLog::create($company_log2);
|
||||
Db::commit();
|
||||
return $this->success('上交成功', [], 1, 1);
|
||||
} catch (Exception $e) {
|
||||
Db::rollback();
|
||||
return $this->fail($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function complaint_feedback()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
$company = Company::where('id', $this->userInfo['company_id'])->find()->toArray();
|
||||
Db::name('company_complaint_feedback')->insertGetId(['company_id'=>$company['id'], 'content'=>$params['content'],'create_time'=>time(), 'update_time'=>time()]);
|
||||
return $this->success('成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询镇农科公司
|
||||
*/
|
||||
public function street_company(){
|
||||
$street=$this->request->param('street_code', '');
|
||||
$area=$this->request->param('area_code', '');
|
||||
if (!empty($street)) {
|
||||
$company=Db::query("select * from la_company where company_type=:company_type and FIND_IN_SET(:street,responsible_area)", ['company_type' => 41,'street'=>$street], true);
|
||||
if($company){
|
||||
return $this->success('ok',['title'=>$company[0]['company_name'],'organization_code'=>$company[0]['organization_code']]);
|
||||
}else{
|
||||
return $this->fail('当前区域无镇农科公司');
|
||||
}
|
||||
}
|
||||
if(!empty($area)) {
|
||||
$company= Company::where(['company_type'=>15, 'area'=>$area])->findOrEmpty();
|
||||
if(!$company->isEmpty()){
|
||||
return $this->success('ok',['title'=>$company['company_name'],'organization_code'=>$company['organization_code']]);
|
||||
}else{
|
||||
return $this->fail('当前区域无供投公司');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询签约的甲方公司
|
||||
*/
|
||||
public function getPartyACompany()
|
||||
{
|
||||
$re = CompanyLogic::getPartyA($this->userInfo['company_id']);
|
||||
if ($re === false) {
|
||||
return $this->fail(CompanyLogic::getError());
|
||||
}
|
||||
return $this->success('成功',$re);
|
||||
}
|
||||
|
||||
public function getDepositRechargeTransferVoucherList()
|
||||
{
|
||||
[$page, $limit] = $this->getPage();
|
||||
$list = CompanyDepositVoucher::where(['company_id' => $this->userInfo['company_id']])
|
||||
->order(['id' => 'desc'])
|
||||
->page($page)->limit($limit)->select();;
|
||||
$count=CompanyDepositVoucher::where(['company_id' => $this->userInfo['company_id']])->count();
|
||||
return $this->success('success', ['count' => $count, 'data' => $list]);
|
||||
}
|
||||
}
|
||||
}
|
@ -5,7 +5,6 @@ namespace app\api\controller;
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\Company;
|
||||
use app\common\model\contract\Contract;
|
||||
use app\common\model\user\User;
|
||||
use think\facade\Db;
|
||||
|
||||
/**
|
||||
@ -19,14 +18,31 @@ class ContractController extends BaseApiController
|
||||
public function index()
|
||||
{
|
||||
[$page, $limit] = $this->getPage();
|
||||
if($this->userInfo['admin_id']==0){
|
||||
$query = Contract::where("type",2)->where('party_b',$this->userId);
|
||||
} else {
|
||||
$query = Contract::where("type",1)->where('party_a|party_b',$this->userInfo['company_id']);
|
||||
$admin = Admin::where('id', $this->userInfo['admin_id'])->find();
|
||||
if (empty($admin)) {
|
||||
return $this->success();
|
||||
}
|
||||
if (!empty($admin['company_id'])) {
|
||||
$query = Contract::whereRaw("(type=1 and party_b={$admin['company_id']}) or (type=2 and party_b={$admin['id']})");
|
||||
} else {
|
||||
$query = Contract::where('party_b', $admin['id']);
|
||||
}
|
||||
$query->where('status',1);
|
||||
$count = $query->count();
|
||||
$contract = $query->with(['party_a_info','party_b_info','contract_type'])->page($page)->limit($limit)->select();
|
||||
$contract = $query->page($page)->limit($limit)->select()->each(function ($item, $key) {
|
||||
$company_name= Db::name('company')->where('id', $item['party_a'])->value('company_name');
|
||||
$contract_type_name= Db::name('dict_data')->where('id', $item['contract_type'])->value('name');
|
||||
$datas=[
|
||||
'id'=>$item['id'],
|
||||
'company_name'=>$company_name,
|
||||
'contract_type_name'=>$contract_type_name,
|
||||
];
|
||||
$item->company=$datas;
|
||||
// if ($item->type == 2) {
|
||||
// $item['party_b_name'] = Admin::where('id', $item['party_b'])->value('name');
|
||||
// } else {
|
||||
// $item['party_b_name'] = Db::name('company')->where('id', $item['party_b'])->value('company_name');
|
||||
// }
|
||||
});
|
||||
return $this->success('success', ['count' => $count, 'data' => $contract]);
|
||||
}
|
||||
|
||||
@ -37,37 +53,29 @@ class ContractController extends BaseApiController
|
||||
return $this->fail('合同不存在');
|
||||
}
|
||||
if ($contract['type'] == 2) {
|
||||
$contract['party_b_name'] = User::where('id', $contract['party_b'])->value('nickname');
|
||||
$contract['party_b_name'] = Admin::where('id', $contract['party_b'])->value('name');
|
||||
} else {
|
||||
$contract['party_b_name'] = Db::name('company')->where('id', $contract['party_b'])->value('company_name');
|
||||
}
|
||||
$contract['party_a_name'] = Db::name('company')->where('id', $contract['party_a'])->value('company_name');
|
||||
|
||||
$contract['contract_type_name'] = Db::name('dict_data')->where('id', $contract['contract_type'])->value('name');
|
||||
$company = Company::where('id', $contract['party_a'])->find()->toArray();
|
||||
$company = Company::where('id', $contract['party_a'])->find();
|
||||
$province_name= Db::name('geo_province')->where(['province_code' => $company['province']])->value('province_name');
|
||||
$city_name= Db::name('geo_city')->where(['city_code' => $company['city']])->value('city_name');
|
||||
$area_name= Db::name('geo_area')->where(['area_code' => $company['area']])->value('area_name');
|
||||
$street_name= Db::name('geo_street')->where(['street_code' => $company['street']])->value('street_name');
|
||||
$village_name= Db::name('geo_village')->where(['village_code' => $company['village']])->value('village_name');
|
||||
$brigade_name= Db::name('geo_brigade')->where(['id' => $company['brigade']])->value('brigade_name');
|
||||
$company['province_name']=$province_name;
|
||||
$company['city_name']=$city_name;
|
||||
$company['area_name']=$area_name;
|
||||
$company['street_name']=$street_name;
|
||||
$company['village_name']=$village_name;
|
||||
$company['brigade_name']=$brigade_name;
|
||||
$company['address']= $province_name.$city_name.$area_name.$street_name.$village_name.$brigade_name.$company['address'];
|
||||
$company['address']= $province_name.$city_name.$area_name.$street_name.$company['address'];
|
||||
|
||||
$company['company_type_name'] = Db::name('dict_data')->where('id', $company['company_type'])->value('name');
|
||||
$company['other_contacts'] = json_decode($company['other_contacts'], true);
|
||||
$company['qualification'] = $company['qualification'] != null ? json_decode($company['qualification'], true) : '';
|
||||
// $users = Admin::where('id', $company['party_a'])->field('id,name,account,phone,qualification')->select()->toArray();
|
||||
// foreach ($users as &$user) {
|
||||
// $user['is_main'] = $user['id'] == $company['admin_id'] ? 1 : 0;
|
||||
// $user['qualification'] = $user['qualification'] != null ? json_decode($user['qualification'], true) : [];
|
||||
// unset($user['role_id'], $user['dept_id'], $user['jobs_id'], $user['id']);
|
||||
// }
|
||||
return $this->success('success', ['contract' => $contract, 'company' => $company]);
|
||||
$users = Admin::where('company_id', $company['party_a'])->field('id,name,account,phone,qualification')->select()->toArray();
|
||||
foreach ($users as &$user) {
|
||||
$user['is_main'] = $user['id'] == $company['admin_id'] ? 1 : 0;
|
||||
$user['qualification'] = $user['qualification'] != null ? json_decode($user['qualification'], true) : [];
|
||||
unset($user['role_id'], $user['dept_id'], $user['jobs_id'], $user['id']);
|
||||
}
|
||||
return $this->success('success', ['contract' => $contract, 'company' => $company, 'users' => $users]);
|
||||
}
|
||||
}
|
||||
|
@ -1,219 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\controller;
|
||||
use app\common\model\task_scheduling_plan\TaskSchedulingPlan;
|
||||
use app\job\TaskInformationJob;
|
||||
use app\job\TownTaskAdd;
|
||||
use app\job\TownTaskSettlementJob;
|
||||
use app\job\VillageTaskAdd;
|
||||
use app\job\VillageTaskSettlementJob;
|
||||
use think\facade\Log;
|
||||
use app\common\model\Company;
|
||||
use app\common\model\task_template\TaskTemplate;
|
||||
use app\common\model\task_scheduling\TaskScheduling;
|
||||
use app\job\TaskAdd;
|
||||
|
||||
|
||||
/**
|
||||
* index
|
||||
* Class IndexController
|
||||
* @package app\api\controller
|
||||
*/
|
||||
class CronController extends BaseApiController
|
||||
{
|
||||
public array $notNeedLogin = ['settlement','task_add', 'town_task_add', 'town_task_settlement','village_task_add', 'village_task_settlement'];
|
||||
|
||||
/**
|
||||
* 小组服务公司任务下发
|
||||
*/
|
||||
public function task_add(){
|
||||
//任务下发
|
||||
// $time=strtotime(date('Y-m-d',strtotime('-1 day')));
|
||||
$time = strtotime(date('Y-m-d'));
|
||||
// $tiem_end=$time+86399;
|
||||
// $plan_all = TaskScheduling::where('cron_time', '<', $time)->where('status', 1)->with('company_info')->select()->toArray();
|
||||
$plan_all = TaskScheduling::where('cron_time', '<', $time)->where('status', 1)->where('company_type', 18)->with('company_info')->select()->toArray();
|
||||
|
||||
$plan_ids = [];
|
||||
foreach ($plan_all as $k => $v) {
|
||||
$all = TaskTemplate::where('status', 1)->where('task_scheduling', $v['id'])->limit(30)->select()->toArray();
|
||||
$plan_ids[] = $v['id'];
|
||||
if ($all) {
|
||||
$plan_all[$k]['template'] = $all;
|
||||
} else {
|
||||
unset($plan_all[$k]);
|
||||
}
|
||||
}
|
||||
$company_id = [];
|
||||
foreach ($plan_all as $k => $v) {
|
||||
foreach ($v['template'] as $kk => $vv) {
|
||||
queue(TaskAdd::class,['data'=>$vv,'data_two'=>$v]);
|
||||
}
|
||||
$company_id[] = $v['company_id'];
|
||||
}
|
||||
Company::where('id', 'in', $company_id)->inc('day_count')->update();
|
||||
TaskScheduling::where('id', 'in', $plan_ids)->update(['cron_time' => time()]);
|
||||
Log::info('小组服务公司定时任务下发执行成功' . date('Y-m-d H:i:s'));
|
||||
return $this->success('定时任务下发执行成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* 小组服务公司任务结算
|
||||
*/
|
||||
public function settlement(){
|
||||
// $all=TaskSchedulingPlan::where('is_pay',0)->with(['template_info','scheduling'])->select()->toArray();
|
||||
$all = TaskSchedulingPlan::whereDay('end_time','today')
|
||||
->withJoin(['scheduling'], 'left')
|
||||
->where('scheduling.company_type', 18)
|
||||
->where('is_pay',0)
|
||||
->with(['template_info'])
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
foreach($all as $k=>$v){
|
||||
// 任务运行中,后台删除了任务模板
|
||||
if (empty($v['template_info'])) {
|
||||
continue;
|
||||
}
|
||||
queue(TaskInformationJob::class,$v);
|
||||
}
|
||||
Log::info('小组服务公司定时任务结算执行成功'.date('Y-m-d H:i:s'));
|
||||
return $this->success('小组服务公司定时任务结算执行成功');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 村管理公司任务下发
|
||||
*/
|
||||
public function village_task_add()
|
||||
{
|
||||
//任务下发
|
||||
$time = strtotime(date('Y-m-d'));
|
||||
// 查询系统 所有镇农科公司 未下发 的 任务安排
|
||||
$taskSchedulingList = TaskScheduling::where('cron_time', '<', $time)
|
||||
->where('status', 1)
|
||||
->where('company_type', 17)
|
||||
->with('company_info')
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
$taskSchedulingIds = [];
|
||||
$companyIds = [];
|
||||
foreach ($taskSchedulingList as $k => $taskScheduling) {
|
||||
$templateList = TaskTemplate::where('status', 1)->where('task_scheduling', $taskScheduling['id'])->limit(30)->select()->toArray();
|
||||
$taskSchedulingIds[] = $taskScheduling['id'];
|
||||
$companyIds[] = $taskScheduling['company_id'];
|
||||
foreach ($templateList as $template) {
|
||||
queue(VillageTaskAdd::class, $template);
|
||||
// TaskLogic::TownCronAdd($template); // 手动下发用
|
||||
}
|
||||
|
||||
if (empty($templateList)) {
|
||||
unset($taskSchedulingList[$k]);
|
||||
}
|
||||
}
|
||||
Company::where('id', 'in', $companyIds)->inc('day_count')->update();
|
||||
TaskScheduling::where('id', 'in', $taskSchedulingIds)->update(['cron_time' => time()]);
|
||||
Log::info('村管理公司定时任务下发执行成功' . date('Y-m-d H:i:s'));
|
||||
return $this->success('村管理公司定时任务下发执行成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* 村管理公司任务结算
|
||||
*/
|
||||
public function village_task_settlement()
|
||||
{
|
||||
Log::info('村管理公司定时任务结算执行-开始'.date('Y-m-d H:i:s'));
|
||||
//today 今日未结算的任务计划
|
||||
$taskSchedulingPlanList = TaskSchedulingPlan::whereDay('end_time','today')
|
||||
->withJoin(['scheduling'], 'left')
|
||||
->where('scheduling.company_type', 17)
|
||||
->where('is_pay',0)
|
||||
->with(['template_info'])
|
||||
->select()
|
||||
->toArray();
|
||||
foreach($taskSchedulingPlanList as $taskSchedulingPlan){
|
||||
// 任务运行中,后台删除了任务模板
|
||||
if (empty($taskSchedulingPlan['template_info'])) {
|
||||
continue;
|
||||
}
|
||||
queue(VillageTaskSettlementJob::class, $taskSchedulingPlan);
|
||||
}
|
||||
Log::info('村管理公司定时任务结算执行-结束'.date('Y-m-d H:i:s'));
|
||||
return $this->success('村管理公司定时任务结算执行成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* 镇合伙人公司任务下发
|
||||
*/
|
||||
public function town_task_add()
|
||||
{
|
||||
//任务下发
|
||||
$time = strtotime(date('Y-m-d'));
|
||||
// 查询系统 所有镇农科公司 未下发 的 任务安排
|
||||
$taskSchedulingList = TaskScheduling::where('cron_time', '<', $time)
|
||||
->where('status', 1)
|
||||
->where('company_type', 16)
|
||||
->with('company_info')
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
$taskSchedulingIds = [];
|
||||
$companyIds = [];
|
||||
foreach ($taskSchedulingList as $k => $taskScheduling) {
|
||||
$templateList = TaskTemplate::where('status', 1)->where('task_scheduling', $taskScheduling['id'])->limit(30)->select()->toArray();
|
||||
$taskSchedulingIds[] = $taskScheduling['id'];
|
||||
$companyIds[] = $taskScheduling['company_id'];
|
||||
foreach ($templateList as $template) {
|
||||
queue(TownTaskAdd::class, $template);
|
||||
// TaskLogic::TownCronAdd($template); // 手动下发用
|
||||
}
|
||||
|
||||
if (empty($templateList)) {
|
||||
unset($taskSchedulingList[$k]);
|
||||
}
|
||||
}
|
||||
Company::where('id', 'in', $companyIds)->inc('day_count')->update();
|
||||
TaskScheduling::where('id', 'in', $taskSchedulingIds)->update(['cron_time' => time()]);
|
||||
Log::info('镇农科公司定时任务下发执行成功' . date('Y-m-d H:i:s'));
|
||||
return $this->success('镇农科公司定时任务下发执行成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* 镇农科公司任务结算
|
||||
*/
|
||||
public function town_task_settlement()
|
||||
{
|
||||
Log::info('镇合伙人公司定时任务结算执行-开始'.date('Y-m-d H:i:s'));
|
||||
//today 今日未结算的任务计划
|
||||
$taskSchedulingPlanList = TaskSchedulingPlan::whereDay('end_time','today')
|
||||
->withJoin(['scheduling'], 'left')
|
||||
->where('scheduling.company_type', 16)
|
||||
->where('is_pay',0)
|
||||
->with(['template_info'])
|
||||
->select()
|
||||
->toArray();
|
||||
foreach($taskSchedulingPlanList as $taskSchedulingPlan){
|
||||
// 任务运行中,后台删除了任务模板
|
||||
if (empty($taskSchedulingPlan['template_info'])) {
|
||||
continue;
|
||||
}
|
||||
// 解耦 三个角色分开结算,避免某个角色的结算逻辑出现异常,导致整个镇农科公司的任务结算都终止
|
||||
$taskTemplateInfo = $taskSchedulingPlan['template_info'];
|
||||
// 负责人任务结算
|
||||
if ($taskTemplateInfo['extend']['task_role'] == 1) {
|
||||
queue(TownTaskSettlementJob::class, $taskSchedulingPlan);
|
||||
}
|
||||
// 市场部长任务结算
|
||||
if ($taskTemplateInfo['extend']['task_role'] == 2) {
|
||||
queue(TownTaskSettlementJob::class, $taskSchedulingPlan);
|
||||
}
|
||||
// 服务部长任务结算
|
||||
if ($taskTemplateInfo['extend']['task_role'] == 3) {
|
||||
queue(TownTaskSettlementJob::class, $taskSchedulingPlan);
|
||||
}
|
||||
}
|
||||
Log::info('镇镇合伙人公司定时任务结算执行-结束'.date('Y-m-d H:i:s'));
|
||||
return $this->success('镇农科公司定时任务结算执行成功');
|
||||
}
|
||||
}
|
@ -4,11 +4,8 @@ namespace app\api\controller;
|
||||
|
||||
|
||||
use app\api\logic\IndexLogic;
|
||||
use app\common\model\Company;
|
||||
use app\common\model\contract\VehicleContract;
|
||||
use app\Request;
|
||||
use think\facade\Db;
|
||||
use think\facade\Log;
|
||||
use think\response\Json;
|
||||
|
||||
|
||||
@ -21,83 +18,18 @@ class HetongController extends BaseApiController
|
||||
{
|
||||
|
||||
|
||||
public array $notNeedLogin = ['url','info', 'toFaceCreate', 'notifyOrganizationFaceCreate'];
|
||||
public array $notNeedLogin = ['url'];
|
||||
|
||||
public function url()
|
||||
{
|
||||
$id = Request()->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]);
|
||||
}
|
||||
$id=Request()->get('id');
|
||||
if($id){
|
||||
$url=Db::name('contract')->where('id',$id)->value('url');
|
||||
if($url){
|
||||
return redirect($url);
|
||||
}
|
||||
}
|
||||
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 '<style type="text/css"> * { padding: 0; margin: 0; } div { padding: 4px 48px; } a { color: #2E5CD5; cursor: pointer; text-decoration: none } a:hover { text-decoration: underline; } body { background: #fff; font-family: "Century Gothic", "Microsoft yahei"; color: #333; font-size: 18px; } h1 { font-size: 100px; font-weight: normal; margin-bottom: 12px; } p { line-height: 1.6em; font-size: 42px } </style> <div style="padding: 24px 48px;"> <h1>:) </h1> <p>'.$msg.'</p> </div>';
|
||||
}
|
||||
return '<style type="text/css"> * { padding: 0; margin: 0; } div { padding: 4px 48px; } a { color: #2E5CD5; cursor: pointer; text-decoration: none } a:hover { text-decoration: underline; } body { background: #fff; font-family: "Century Gothic", "Microsoft yahei"; color: #333; font-size: 18px; } h1 { font-size: 100px; font-weight: normal; margin-bottom: 12px; } p { line-height: 1.6em; font-size: 42px } </style> <div style="padding: 24px 48px;"> <h1>:) </h1> <p>合同不存在</p> </div>';
|
||||
|
||||
public function info(){
|
||||
$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 '<style type="text/css"> * { padding: 0; margin: 0; } div { padding: 4px 48px; } a { color: #2E5CD5; cursor: pointer; text-decoration: none } a:hover { text-decoration: underline; } body { background: #fff; font-family: "Century Gothic", "Microsoft yahei"; color: #333; font-size: 18px; } h1 { font-size: 100px; font-weight: normal; margin-bottom: 12px; } p { line-height: 1.6em; font-size: 42px } </style> <div style="padding: 24px 48px;"> <h1>:) </h1> <p></p> </div>';
|
||||
}
|
||||
|
||||
// 用户做人脸识别时,作跳板的短信链接
|
||||
public function toFaceCreate()
|
||||
{
|
||||
$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 '<style type="text/css"> * { padding: 0; margin: 0; } div { padding: 4px 48px; } a { color: #2E5CD5; cursor: pointer; text-decoration: none } a:hover { text-decoration: underline; } body { background: #fff; font-family: "Century Gothic", "Microsoft yahei"; color: #333; font-size: 18px; } h1 { font-size: 100px; font-weight: normal; margin-bottom: 12px; } p { line-height: 1.6em; font-size: 42px } </style> <div style="padding: 24px 48px;"> <h1>:) </h1> <p>'.$msg.'</p> </div>';
|
||||
}
|
||||
|
||||
public function notifyOrganizationFaceCreate()
|
||||
{
|
||||
$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 '<style type="text/css"> * { padding: 0; margin: 0; } div { padding: 4px 48px; } a { color: #2E5CD5; cursor: pointer; text-decoration: none } a:hover { text-decoration: underline; } body { background: #fff; font-family: "Century Gothic", "Microsoft yahei"; color: #333; font-size: 18px; } h1 { font-size: 100px; font-weight: normal; margin-bottom: 12px; } p { line-height: 1.6em; font-size: 42px } </style> <div style="padding: 24px 48px;"> <h1>:) </h1> <p>'.$msg.'</p> </div>';
|
||||
}
|
||||
}
|
||||
}
|
@ -11,23 +11,13 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
|
||||
use app\api\logic\IndexLogic;
|
||||
use app\common\logic\RedisLogic;
|
||||
use app\common\model\Company;
|
||||
use app\common\model\company\CompanyProperty;
|
||||
use app\common\model\contract\Contract;
|
||||
use app\common\model\contract\ShopContract;
|
||||
use app\common\model\contract\VehicleContract;
|
||||
use app\common\model\ShopMerchant;
|
||||
use app\common\model\vehicle\VehicleBuyRecord;
|
||||
use app\common\model\vehicle\VehicleRent;
|
||||
use Symfony\Component\HttpClient\HttpClient;
|
||||
use think\cache\driver\Redis;
|
||||
use think\facade\Db;
|
||||
use think\facade\Log;
|
||||
use think\model\Pivot;
|
||||
use think\response\Json;
|
||||
|
||||
|
||||
@ -38,11 +28,10 @@ use think\response\Json;
|
||||
*/
|
||||
class IndexController extends BaseApiController
|
||||
{
|
||||
public array $notNeedLogin = [
|
||||
'index', 'config', 'policy', 'decorate', 'notifyUrl',
|
||||
'notifyProperty', 'notifyAuthentication', 'notifyVehicleContractUpdate',
|
||||
'townCarRent','systemCarRent', 'selfCarRent', 'cancelRent', 'buyCar',
|
||||
'vehicleCarList', 'getCompanyBankInfo'];
|
||||
|
||||
|
||||
public array $notNeedLogin = ['index', 'config', 'policy', 'decorate','notifyUrl'];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 首页数据
|
||||
@ -59,6 +48,7 @@ class IndexController extends BaseApiController
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 全局配置
|
||||
* @return Json
|
||||
@ -70,9 +60,7 @@ class IndexController extends BaseApiController
|
||||
*/
|
||||
public function config()
|
||||
{
|
||||
$parmas = $this->request->param();
|
||||
$group_id = $this->userInfo ? $this->userInfo['group_id'] : 1;
|
||||
$result = IndexLogic::getConfigData($group_id, $parmas);
|
||||
$result = IndexLogic::getConfigData();
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
@ -104,744 +92,23 @@ class IndexController extends BaseApiController
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
/**签约回调 */
|
||||
public function notifyUrl()
|
||||
{
|
||||
$a = Request()->get();
|
||||
if ($a) {
|
||||
$find = Db::name('contract')->where('id', $a['id'])->find();
|
||||
if ($find) {
|
||||
if ($find['signing_timer'] == 0) {
|
||||
Db::name('contract')->where('id', $a['id'])->update(['signing_timer' => 1]);
|
||||
return json(['success' => true, 'msg' => '成功']);
|
||||
} else if ($find['signing_timer'] == 1) {
|
||||
Db::name('contract')->where('id', $a['id'])->update(['status' => 1, 'signing_timer' => 2]);
|
||||
if ($find['type'] == 1) {
|
||||
Db::name('company')->where('id', $find['party_a'])->update(['status' => 1, 'is_contract' => 1]);
|
||||
Db::name('company')->where('id', $find['party_b'])->update(['status' => 1, 'is_contract' => 1]);
|
||||
} else {
|
||||
Db::name('company')->where('id', $find['party_a'])->update(['status' => 1, 'is_contract' => 1]);
|
||||
Db::name('user')->where('id', $find['party_b'])->update(['is_contract' => 1]);
|
||||
}
|
||||
public function notifyUrl(){
|
||||
$a= Request()->get();
|
||||
if($a){
|
||||
$find=Db::name('contract')->where('id',$a['id'])->find();
|
||||
if($find){
|
||||
Db::name('contract')->where('id',$a['id'])->update(['status'=>1]);
|
||||
if($find['type']==1){
|
||||
Db::name('company')->where('id',$find['party_a'])->update(['status'=>1,'is_contract'=>1]);
|
||||
Db::name('company')->where('id',$find['party_b'])->update(['status'=>1,'is_contract'=>1]);
|
||||
}else{
|
||||
Db::name('company')->where('id',$find['party_a'])->update(['status'=>1,'is_contract'=>1]);
|
||||
Db::name('user')->where('id',$find['party_b'])->update(['is_contract'=>1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return json(['success' => true, 'msg' => '成功']);
|
||||
}
|
||||
/**商户合同签约回调 */
|
||||
public function shopContractNotifyUrl()
|
||||
{
|
||||
$a = Request()->param();
|
||||
Log::info(['商户合同签约回调', $a]);
|
||||
// 获取合同详情
|
||||
if ($a) {
|
||||
$find = Db::name('shop_contract')->where('id', $a['id'])->find();
|
||||
|
||||
if ($find) {
|
||||
// 合同一方已签约
|
||||
if ($find['signing_timer'] == 0) {
|
||||
Db::name('shop_contract')->where('id', $a['id'])->update(['signing_timer' => 1]);
|
||||
return json(['success' => true, 'msg' => '成功']);
|
||||
} else if ($find['signing_timer'] == 1) {
|
||||
// 合同另一方已签约,修改合同状态,修改公司状态
|
||||
Db::name('shop_contract')->where('id', $a['id'])->update(['status' => 1, 'signing_timer' => 2]);
|
||||
Db::name('shop_merchant')->where('id', $find['party_a'])->update(['status' => 1, 'is_contract' => 1]);
|
||||
Db::name('shop_merchant')->where('id', $find['party_b'])->update(['status' => 1, 'is_contract' => 1]);
|
||||
// 通知商城,商户签约完成
|
||||
$shopMerchant = ShopMerchant::find(['id' => $find['party_b']]);
|
||||
$requestUtil = HttpClient::create()->request('POST', env('url.shop_prefix') . '/api/merchant/syncStatus/'.$shopMerchant['mer_intention_id'], [
|
||||
'body' => ['status' => 1]
|
||||
]);
|
||||
Log::info(['商户合同签约回调-商城响应', env('url.shop_prefix') . '/api/merchant/syncStatus/'.$shopMerchant['mer_intention_id']]);
|
||||
Log::info(['商户合同签约回调-商城响应', $requestUtil->getContent()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return json(['success' => true, 'msg' => '成功']);
|
||||
return json(['success'=>true,'msg'=>'成功']);
|
||||
}
|
||||
|
||||
|
||||
//镇街车辆租赁回调
|
||||
public function townCarRent() {
|
||||
$id = Request()->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,
|
||||
'update_time' => time()
|
||||
]);
|
||||
if(!$updateLocalRes || $updateSverRes['code']==0){
|
||||
return json(['success' => false, 'msg' => '更新失败']);
|
||||
}
|
||||
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,
|
||||
'update_time' => time()
|
||||
]);
|
||||
if(!$updateLocalRes || $updateSverRes['code']==0){
|
||||
return json(['success' => false, 'msg' => '更新失败']);
|
||||
}else{
|
||||
return json(['success' => true, 'msg' => '更新成功']);
|
||||
}
|
||||
}
|
||||
return json(['success' => true, 'msg' => '更新成功@']);
|
||||
}
|
||||
|
||||
//系统车辆租赁回来
|
||||
public function systemCarRent()
|
||||
{
|
||||
//获取参数
|
||||
$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()
|
||||
{
|
||||
//获取参数
|
||||
$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,
|
||||
'update_time' => time()
|
||||
]);
|
||||
}
|
||||
//判断合同是否存在购买记录表中
|
||||
$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() {
|
||||
//获取参数
|
||||
$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'],
|
||||
'update_time' => time()
|
||||
]);
|
||||
if(!$updateLocalRes || $updateSverRes['code']==0){
|
||||
return json(['success' => false, 'msg' => '更新失败']);
|
||||
}else{
|
||||
return json(['success' => true, 'msg' => '更新成功']);
|
||||
}
|
||||
}else{
|
||||
return json(['success' => true, 'msg' => '成功']);
|
||||
}
|
||||
}
|
||||
|
||||
//车辆租赁签约合同状态更改
|
||||
public function notifyVehicleContractUpdate()
|
||||
{
|
||||
if (!$this->request->isPost()) {
|
||||
return $this->fail('请求方式错误');
|
||||
}
|
||||
$param = $this->request->post();
|
||||
if (empty($param['contract_logistic_id'])) {
|
||||
return $this->fail('缺少必要参数');
|
||||
}
|
||||
$model = VehicleContract::where('contract_logistic_id', $param['contract_logistic_id'])->find();
|
||||
if (empty($model)) {
|
||||
return $this->fail('数据不存在');
|
||||
}
|
||||
$cars = json_decode($model['cars_info'], true);
|
||||
$result = $model->where('id', $model['id'])->save($param);
|
||||
if ($result && isset($param['status']) && $param['status'] == 3) {
|
||||
$data = [];
|
||||
foreach ($cars as $k => $v) {
|
||||
$hasCar = VehicleRent::where('car_id',$v['id'])->findOrEmpty();
|
||||
if($hasCar->isEmpty()) {
|
||||
$data[$k]['car_id'] = $v['id'];
|
||||
$data[$k]['car_license'] = $v['license'];
|
||||
$data[$k]['type'] = 0;
|
||||
$data[$k]['status'] = 0;
|
||||
$data[$k]['company_id'] = $model['company_b_id'];
|
||||
$data[$k]['rent_time'] = 0;
|
||||
$data[$k]['rent_company_id'] = 0;
|
||||
$data[$k]['contract_id'] = $model['id'];
|
||||
$data[$k]['create_time'] = strtotime($model['create_time']);
|
||||
}
|
||||
}
|
||||
$vehicleRent = new VehicleRent();
|
||||
$vehicleRent->saveAll($data);
|
||||
}
|
||||
//返回
|
||||
return $result ? $this->success('更新成功') : $this->fail('更新失败');
|
||||
}
|
||||
|
||||
/**
|
||||
* 资产回调
|
||||
*/
|
||||
public function notifyProperty()
|
||||
{
|
||||
$parmas = Request()->post();
|
||||
if ($parmas) {
|
||||
if (!isset($parmas['company_id']) || $parmas['company_id'] < 0) {
|
||||
return json(['success' => false, 'msg' => '公司id不能为空']);
|
||||
}
|
||||
if (!isset($parmas['object_id'])) {
|
||||
return json(['success' => false, 'msg' => '对象id不能为空']);
|
||||
}
|
||||
$data = [];
|
||||
$object_id = explode(',', $parmas['object_id']);
|
||||
foreach ($object_id as $k => $v) {
|
||||
if ($v > 0) {
|
||||
$data[$k]['company_id'] = $parmas['company_id'];
|
||||
$data[$k]['object_id'] = $v;
|
||||
$data[$k]['type'] = 1;
|
||||
}
|
||||
}
|
||||
if (count($data) <= 0) {
|
||||
return json(['success' => false, 'msg' => '失败']);
|
||||
}
|
||||
$res = CompanyProperty::insertAll($data);
|
||||
if ($res) {
|
||||
return json(['success' => true, 'msg' => '成功']);
|
||||
} else {
|
||||
return json(['success' => false, 'msg' => '失败']);
|
||||
}
|
||||
}
|
||||
return json(['success' => false, 'msg' => '失败,没有参数']);
|
||||
}
|
||||
|
||||
/**
|
||||
* 认证回调
|
||||
*/
|
||||
public function notifyAuthentication()
|
||||
{
|
||||
$parmas = Request()->param();
|
||||
Log::info(['认证回调:',$parmas]);
|
||||
|
||||
try {
|
||||
$data=json_decode($parmas['data'],true);
|
||||
|
||||
if($data['status']==2){
|
||||
return json(['success' => false, 'msg' => '失败']);
|
||||
}
|
||||
if ($parmas) {
|
||||
// 商城系统商户入驻
|
||||
if (isset($parmas['type']) && $parmas['type'] == 'shop_merchant') {
|
||||
Db::name('company_form')->where('master_email',$data['emailOrMobile'])->update(['type' => 1]);
|
||||
$this->shopMerchantCall($parmas);
|
||||
return json(['success' => true, 'msg' => '成功']);
|
||||
} else {
|
||||
$data=json_decode($parmas['data'],true);
|
||||
// 成功回调标记
|
||||
$redis = RedisLogic::getInstance();
|
||||
$cache = $redis->get('authentication_company_id_'.$parmas['id']);
|
||||
if (!empty($cache)) {
|
||||
$cacheData = json_decode($cache, true);
|
||||
$cacheData['is_callback'] = 1;
|
||||
$redis->set('authentication_company_id_'.$parmas['id'], json_encode($cacheData));
|
||||
}
|
||||
if($data['status']==1){
|
||||
Company::where('id', $parmas['id'])->update(['is_authentication' => 1]);
|
||||
}
|
||||
if($data['status']==2){
|
||||
// 记录认证失败原因
|
||||
Db::name('company_authentication_fail_log')->insert(['company_id'=>$parmas['id'],'fail_reason'=>$data['msg'],'create_time'=>time()]);
|
||||
Company::where('id', $parmas['id'])->update([ 'is_contract'=>0]);
|
||||
}
|
||||
return json(['success' => true, 'msg' => '成功']);
|
||||
}
|
||||
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
Log::error('认证回调错误569:'.$e->getMessage());
|
||||
}
|
||||
|
||||
return json(['success' => false, 'msg' => '失败,没有参数']);
|
||||
}
|
||||
|
||||
private function shopMerchantCall($parmas)
|
||||
{
|
||||
$shopMerchant = ShopMerchant::find(['id', $parmas['id']]);
|
||||
Log::error($shopMerchant);
|
||||
if($shopMerchant==null){
|
||||
// Log::error(['没有商户580:',$parmas]);
|
||||
return json(['success' => false, 'msg' => '认证回调错误']);
|
||||
}
|
||||
$data=json_decode($parmas['data'],true);
|
||||
if($data['status']==1){
|
||||
if($data['organizationRegNo']!=$shopMerchant['organization_code']){
|
||||
Log::error(['认证回调错误586:',$parmas]);
|
||||
return json(['success' => false, 'msg' => '认证回调错误']);
|
||||
}
|
||||
|
||||
$shopMerchant->save(['is_authentication' => 1]);
|
||||
// 生成合同
|
||||
$createContractData = [
|
||||
'id' => $parmas['id'],
|
||||
'party_a' => 1,
|
||||
'party_a_name' => '泸州市海之农科技有限公司',
|
||||
'party_b' => $parmas['id'],
|
||||
'party_b_name' => $shopMerchant->company_name,
|
||||
'contract_type' => 22,
|
||||
];
|
||||
$model = new ShopContract();
|
||||
$model->contract_no = time();
|
||||
$model->create_time = time();
|
||||
$model->check_status = 1;
|
||||
$model->update_time = time();
|
||||
$model->setAttrs($createContractData);
|
||||
$res = $model->save($createContractData);
|
||||
}
|
||||
if($data['status']==2){
|
||||
// 记录认证失败原因
|
||||
Db::name('company_authentication_fail_log')->insert(['company_id'=>$parmas['id'], 'log_type'=>3, 'fail_reason'=>$data['msg'], 'create_time'=>time()]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function getCompanyBankInfo()
|
||||
{
|
||||
$parmas = $this->request->param();
|
||||
$company = Db::query("select company_name,qualification from la_company where company_type=:company_type and FIND_IN_SET(:street,responsible_area)", ['company_type' => 41,'street'=>$parmas['street_code']], true);
|
||||
|
||||
if (empty($company)) {
|
||||
return $this->success('成功', ['corporate_account'=> '22170201040004168', 'corporate_bank'=> '中国农业银行股份有限公司泸州石洞支行', 'company_name' => '泸州里海农业科技有限公司', 'corporate_bank_address'=> '泸州市龙马潭区张家祠东路竹林馨居东侧约60米']);
|
||||
}
|
||||
$company=$company[0];
|
||||
$company['qualification'] = json_decode($company['qualification'], true);
|
||||
|
||||
if (!empty($company['qualification']['corporate_account']) && !empty($company['qualification']['corporate_bank'])) {
|
||||
return $this->success('成功', ['corporate_account'=> $company['qualification']['corporate_account'], 'corporate_bank'=> $company['qualification']['corporate_bank'], 'company_name' => $company['company_name'], 'corporate_bank_address'=> $company['qualification']['corporate_bank_address'] ]);
|
||||
}
|
||||
|
||||
return $this->success('成功', ['corporate_account'=> '22170201040004168', 'corporate_bank'=> '中国农业银行股份有限公司泸州石洞支行', 'company_name' => '泸州里海农业科技有限公司', 'corporate_bank_address'=> '' ]);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -2,535 +2,40 @@
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\common\model\Company;
|
||||
use app\common\model\informationg\UserInformationg;
|
||||
use app\common\model\information\UserInformationg;
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\informationg\UserInformationgDemand;
|
||||
use app\common\model\task\Task;
|
||||
use app\common\model\task_template\TaskTemplate;
|
||||
use app\common\model\user\User;
|
||||
use think\response\Json;
|
||||
|
||||
class InformationController extends BaseApiController
|
||||
{
|
||||
public array $notNeedLogin = ['groupServiceInfo','captainInfo','farmerInfo','farmerInfoByPhone','farmerLandInfo','farmerPondInfo','farmerList'];
|
||||
|
||||
public function list()
|
||||
{
|
||||
$param = Request()->param();
|
||||
[$page, $limit] = $this->getPage();
|
||||
if (isset($param['user_id']) && $param['user_id'] > 0) {
|
||||
$data[] = ['create_user_id', '=', $param['user_id']];
|
||||
} else {
|
||||
$data[] = ['company_id', '=', $this->userInfo['company_id']];
|
||||
}
|
||||
if (isset($param['arr']) && count($param['arr']) > 0) {
|
||||
$data[] = ['id', 'in', $param['arr']];
|
||||
}
|
||||
if (isset($param['is_update'])) {
|
||||
if ($param['is_update'] > 0) {
|
||||
$data[] = ['is_update', '=', 1];
|
||||
} else {
|
||||
$data[] = ['is_update', '=', 0];
|
||||
}
|
||||
}
|
||||
$res = UserInformationg::list($data, $page, $limit);
|
||||
$data['create_user_id'] = $this->userId;
|
||||
$res = UserInformationg::list($data,$page,$limit);
|
||||
if ($res != true) {
|
||||
return $this->fail(BaseLogic::getError());
|
||||
return $this->fail( BaseLogic::getError());
|
||||
}
|
||||
return $this->success('ok', $res->toArray());
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$param = Request()->param();
|
||||
$user = User::where('id', $this->userId)->find();
|
||||
if (isset($param['street']) && $param['street'] > 0) {
|
||||
$param['street_id'] = $param['street'];
|
||||
} else {
|
||||
$param['street_id'] = $user['street'];
|
||||
}
|
||||
if (isset($param['village']) && $param['village'] > 0) {
|
||||
$param['village_id'] = $param['village'];
|
||||
} else {
|
||||
$param['village_id'] = $user['village'];
|
||||
}
|
||||
if (isset($param['brigade']) && $param['brigade'] > 0) {
|
||||
$param['brigade_id'] = $param['brigade'];
|
||||
} else {
|
||||
$param['brigade_id'] = $user['brigade'];
|
||||
}
|
||||
$param['admin_id'] = $this->userId;
|
||||
$param['company_id'] = $this->userInfo['company_id'];
|
||||
$param['province_id'] = $user['province'];
|
||||
$param['city_id'] = $user['city'];
|
||||
$param['area_id'] = $user['area'];
|
||||
$res = UserInformationg::add($param);
|
||||
if ($res != true) {
|
||||
return $this->fail(BaseLogic::getError());
|
||||
return $this->fail( BaseLogic::getError());
|
||||
}
|
||||
return $this->success('成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*/
|
||||
public function details()
|
||||
{
|
||||
public function details(){
|
||||
$param = Request()->param();
|
||||
$res = UserInformationg::details($param['id']);
|
||||
if ($res != true) {
|
||||
return $this->fail(BaseLogic::getError());
|
||||
return $this->fail( BaseLogic::getError());
|
||||
}
|
||||
return $this->success('成功', $res->toArray());
|
||||
return $this->success('成功',$res->toArray());
|
||||
}
|
||||
|
||||
/**
|
||||
* 商机更新
|
||||
*/
|
||||
public function opportunity_update()
|
||||
{
|
||||
$param = Request()->param();
|
||||
foreach ($param['datas'] as $k => $v) {
|
||||
$res = UserInformationg::informationg_demand($v, $param['id'], $this->userId);
|
||||
}
|
||||
if ($res != true) {
|
||||
return $this->fail(BaseLogic::getError());
|
||||
}
|
||||
if (isset($param['task_id']) && $param['task_id'] > 0) {
|
||||
$task = Task::where('id', $param['task_id'])->find();
|
||||
$extend = $task['extend'];
|
||||
if (isset($extend['informationg']['update'])) {
|
||||
$extend['informationg']['update'] += 1;
|
||||
} else {
|
||||
$extend['informationg']['update'] = 1;
|
||||
}
|
||||
$extend['informationg']['ids'][] = $param['id'];
|
||||
$task->extend = json_encode($extend);
|
||||
if ($extend['informationg']['update'] >= 5) {
|
||||
$task->status = 3;
|
||||
}
|
||||
$task->save();
|
||||
TaskTemplate::where('id', $task['template_id'])->inc('information_count', 1)->update();
|
||||
}
|
||||
|
||||
UserInformationg::where('id', $param['id'])->update(['update_time' => time(), 'is_update' => 1]);
|
||||
return $this->success('成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$param = Request()->param();
|
||||
$res = UserInformationg::edit($param);
|
||||
if ($res != true) {
|
||||
return $this->fail(BaseLogic::getError());
|
||||
}
|
||||
return $this->success('成功');
|
||||
}
|
||||
|
||||
//获取吓阻服务公司用户信息
|
||||
public function groupServiceInfo(): Json
|
||||
{
|
||||
//获取参数
|
||||
$params = $this->request->post(['user_id']);
|
||||
if(empty($params['user_id'])){
|
||||
return $this->fail('参数错误_worker');
|
||||
}
|
||||
$userData = User::field('id,company_id,nickname as name,avatar')->where('id',$params['user_id'])->findOrEmpty();
|
||||
if($userData->isEmpty()){
|
||||
return $this->fail('用户数据不存在');
|
||||
}
|
||||
$companyData = Company::field('id,company_name,company_type')->where('id',$userData['company_id'])->findOrEmpty();
|
||||
if($companyData->isEmpty() || $companyData['company_type'] != 18){
|
||||
return $this->fail('当前用户不是小组服务公司用户');
|
||||
}
|
||||
$userData['company_name'] = $companyData['company_name'];
|
||||
//获取小组服务公司下面的队长
|
||||
$captainList = User::field('id,nickname as name,avatar,province,province province_name,city,city city_name,area,area area_name,street,street street_name,village,village village_name,brigade,brigade brigade_name')->where('company_id',$userData['company_id'])->where('is_captain',1)->select()->each(function($item){
|
||||
$item['address'] = $item['province_name'].$item['city_name'].$item['area_name'].$item['street_name'].$item['village_name'].$item['brigade_name'];
|
||||
unset($item['province'],$item['province_name'],$item['city'],$item['city_name'],$item['area'],$item['area_name'],$item['street'],$item['street_name'],$item['village'],$item['village_name'],$item['brigade'],$item['brigade_name']);
|
||||
$farmerList = UserInformationg::where('create_user_id', $item['id'])->field('id')->select()->each(function($val){
|
||||
//获取农户档案详情
|
||||
$information = UserInformationgDemand::field('id,category_child,data')->where('information_id', $val['id'])->where('category_id',6)->where('category_child','in','7,32')->order('id', 'desc')->select()->toArray();
|
||||
//总面积
|
||||
$val['land_total_area'] = 0;
|
||||
$val['pond_total_area'] = 0;
|
||||
$val['animal_total_area'] = 0;
|
||||
$val['poultry_total_area'] = 0;
|
||||
//种养类型
|
||||
$val['is_zz_user'] = false;
|
||||
$val['is_sc_user'] = false;
|
||||
$val['is_jc_user'] = false;
|
||||
$val['is_jq_user'] = false;
|
||||
foreach($information as $v){
|
||||
if($v['category_child'] == 7){
|
||||
$val['is_zz_user'] = true;
|
||||
$val['land_total_area'] += floatval($v['data']['area']);
|
||||
}
|
||||
if($v['category_child'] == 32){
|
||||
if($v['data']['breeding_type'] == 1){//水产
|
||||
$val['is_sc_user'] = true;
|
||||
$val['pond_total_area'] += floatval($v['data']['area']);
|
||||
}elseif ($v['data']['breeding_type'] == 2) {//脯乳动物
|
||||
$val['is_jc_user'] = true;
|
||||
$val['animal_total_area'] += floatval($v['data']['area']);
|
||||
}elseif ($v['data']['breeding_type'] == 3){//家禽
|
||||
$val['is_jq_user'] = true;
|
||||
$val['poultry_total_area'] += floatval($v['data']['area']);
|
||||
}
|
||||
}
|
||||
}
|
||||
$val['total_area'] = $val['land_total_area'] + $val['pond_total_area'] + $val['animal_total_area'] + $val['poultry_total_area'];
|
||||
return $val;
|
||||
})->toArray();
|
||||
$item['farmer_total'] = count($farmerList);
|
||||
$item['farmer_area'] = array_sum(array_column($farmerList,'total_area'));
|
||||
$item['farmer_zz_total'] = 0;
|
||||
$item['farmer_sc_total'] = 0;
|
||||
$item['farmer_jc_total'] = 0;
|
||||
$item['farmer_jq_total'] = 0;
|
||||
$item['farmer_zz_area'] = 0;
|
||||
$item['farmer_sc_area'] = 0;
|
||||
$item['farmer_jc_area'] = 0;
|
||||
$item['farmer_jq_area'] = 0;
|
||||
foreach($farmerList as $v){
|
||||
if($v['is_zz_user']){
|
||||
$item['farmer_zz_total'] += 1;
|
||||
}
|
||||
if($v['is_sc_user']){
|
||||
$item['farmer_sc_total'] += 1;
|
||||
}
|
||||
if($v['is_jc_user']){
|
||||
$item['farmer_jc_total'] += 1;
|
||||
}
|
||||
if($v['is_jq_user']){
|
||||
$item['farmer_jq_total'] += 1;
|
||||
}
|
||||
$item['farmer_zz_area'] += $v['land_total_area'];
|
||||
$item['farmer_sc_area'] += $v['pond_total_area'];
|
||||
$item['farmer_jc_area'] += $v['animal_total_area'];
|
||||
$item['farmer_jq_area'] += $v['poultry_total_area'];
|
||||
}
|
||||
return $item;
|
||||
})->toArray();
|
||||
$userData['captain_list'] = $captainList;
|
||||
return $this->success('请求成功',$userData->toArray());
|
||||
}
|
||||
|
||||
//获取生产队长信息
|
||||
public function captainInfo(): Json
|
||||
{
|
||||
//获取参数
|
||||
$params = $this->request->post(['user_id']);
|
||||
if(empty($params['user_id'])){
|
||||
return $this->fail('参数错误_worker');
|
||||
}
|
||||
$userData = User::field('id,nickname as name,avatar,province,province province_name,city,city city_name,area,area area_name,street,street street_name,village,village village_name,brigade,brigade brigade_name')->where('id',$params['user_id'])->where('is_captain',1)->findOrEmpty();
|
||||
if($userData->isEmpty()){
|
||||
return $this->fail('用户数据不存在');
|
||||
}
|
||||
$userData['address'] = $userData['province_name'].$userData['city_name'].$userData['area_name'].$userData['street_name'].$userData['village_name'].$userData['brigade_name'];
|
||||
unset($userData['province'],$userData['province_name'],$userData['city'],$userData['city_name'],$userData['area'],$userData['area_name'],$userData['street'],$userData['street_name'],$userData['village'],$userData['village_name'],$userData['brigade'],$userData['brigade_name']);
|
||||
//获取生产队长下面的农户
|
||||
$farmerList = UserInformationg::where('create_user_id', $params['user_id'])->field('id,name,phone,area_id,street_id,village_id,brigade_id,area_id area_name,street_id street_name,village_id village_name,brigade_id brigade_name')->select()->each(function($item){
|
||||
$item['address'] = $item['area_name'].$item['street_name'].$item['village_name'].$item['brigade_name'];
|
||||
unset($item['area_id'],$item['area_name'],$item['street_id'],$item['street_name'],$item['village_id'],$item['village_name'],$item['brigade_id'],$item['brigade_name']);
|
||||
//获取农户档案详情
|
||||
$information = UserInformationgDemand::field('id,category_child,data')->where('information_id', $item['id'])->where('category_id',6)->where('category_child','in','7,32')->order('id', 'desc')->select()->toArray();
|
||||
//总面积
|
||||
$item['land_total_area'] = 0;
|
||||
$item['pond_total_area'] = 0;
|
||||
$item['animal_total_area'] = 0;
|
||||
$item['poultry_total_area'] = 0;
|
||||
//种养类型
|
||||
$item['is_zz_user'] = false;
|
||||
$item['is_sc_user'] = false;
|
||||
$item['is_jc_user'] = false;
|
||||
$item['is_jq_user'] = false;
|
||||
foreach($information as $v){
|
||||
if($v['category_child'] == 7){
|
||||
$item['is_zz_user'] = true;
|
||||
$item['land_total_area'] += floatval($v['data']['area']);
|
||||
}
|
||||
if($v['category_child'] == 32){
|
||||
if($v['data']['breeding_type'] == 1){//水产
|
||||
$item['is_sc_user'] = true;
|
||||
$item['pond_total_area'] += floatval($v['data']['area']);
|
||||
}elseif ($v['data']['breeding_type'] == 2) {//脯乳动物
|
||||
$item['is_jc_user'] = true;
|
||||
$item['animal_total_area'] += floatval($v['data']['area']);
|
||||
}elseif ($v['data']['breeding_type'] == 3){//家禽
|
||||
$item['is_jq_user'] = true;
|
||||
$item['poultry_total_area'] += floatval($v['data']['area']);
|
||||
}
|
||||
}
|
||||
}
|
||||
$item['total_area'] = $item['land_total_area'] + $item['pond_total_area'] + $item['animal_total_area'] + $item['poultry_total_area'];
|
||||
return $item;
|
||||
})->toArray();
|
||||
$userData['farmer_total'] = count($farmerList);
|
||||
$userData['farmer_area'] = array_sum(array_column($farmerList,'total_area'));
|
||||
$userData['farmer_zz_total'] = 0;
|
||||
$userData['farmer_sc_total'] = 0;
|
||||
$userData['farmer_jc_total'] = 0;
|
||||
$userData['farmer_jq_total'] = 0;
|
||||
$userData['farmer_zz_area'] = 0;
|
||||
$userData['farmer_sc_area'] = 0;
|
||||
$userData['farmer_jc_area'] = 0;
|
||||
$userData['farmer_jq_area'] = 0;
|
||||
foreach($farmerList as $v){
|
||||
if($v['is_zz_user']){
|
||||
$userData['farmer_zz_total'] += 1;
|
||||
}
|
||||
if($v['is_sc_user']){
|
||||
$userData['farmer_sc_total'] += 1;
|
||||
}
|
||||
if($v['is_jc_user']){
|
||||
$userData['farmer_jc_total'] += 1;
|
||||
}
|
||||
if($v['is_jq_user']){
|
||||
$userData['farmer_jq_total'] += 1;
|
||||
}
|
||||
$userData['farmer_zz_area'] += $v['land_total_area'];
|
||||
$userData['farmer_sc_area'] += $v['pond_total_area'];
|
||||
$userData['farmer_jc_area'] += $v['animal_total_area'];
|
||||
$userData['farmer_jq_area'] += $v['poultry_total_area'];
|
||||
}
|
||||
$userData['farmer_list'] = $farmerList;
|
||||
return $this->success('请求成功',$userData->toArray());
|
||||
}
|
||||
|
||||
//获取农户信息,该接口溯源系统调用
|
||||
public function farmerInfo(): Json
|
||||
{
|
||||
//获取参数
|
||||
$params = $this->request->post(['user_id']);
|
||||
if(empty($params['user_id'])){
|
||||
return $this->fail('参数错误_worker');
|
||||
}
|
||||
//获取农户信息
|
||||
$farmerInfo = UserInformationg::alias('f')
|
||||
->leftJoin('company c','f.company_id = c.id')
|
||||
->leftJoin('user u','u.id = f.create_user_id')
|
||||
->leftJoin('user g','g.id = c.user_id')
|
||||
->where('f.id', $params['user_id'])
|
||||
->field('f.id,f.create_user_id,f.company_id,f.name,f.phone,f.area_id,f.street_id,f.village_id,f.brigade_id,f.area_id area_name,f.street_id street_name,f.village_id village_name,f.brigade_id brigade_name,c.company_name,f.address,u.nickname as captain_name,g.nickname as group_name')
|
||||
->findOrEmpty()->toArray();
|
||||
if(empty($farmerInfo)){
|
||||
return $this->fail('用户不存在_worker');
|
||||
}
|
||||
unset($farmerInfo['area_id'],$farmerInfo['street_id'],$farmerInfo['village_id'],$farmerInfo['brigade_id']);
|
||||
$data = UserInformationgDemand::field('id,category_child,data')->where('information_id', $params['user_id'])->where('category_id',6)->where('category_child','in','7,32')->order('id', 'desc')->select()->toArray();
|
||||
//是否是种植户
|
||||
$farmerInfo['is_zz_user'] = false;
|
||||
//是否是水产养殖户
|
||||
$farmerInfo['is_sc_user'] = false;
|
||||
//是否是家禽养殖户
|
||||
$farmerInfo['is_jq_user'] = false;
|
||||
//是否是大型动物养殖户
|
||||
$farmerInfo['is_dw_user'] = false;
|
||||
//土地总面积
|
||||
$farmerInfo['total_land_area'] = 0;
|
||||
//池塘总面积
|
||||
$farmerInfo['total_pond_area'] = 0;
|
||||
//家禽养殖场总面积
|
||||
$farmerInfo['total_henhouse_area'] = 0;
|
||||
//动物养殖场总面积
|
||||
$farmerInfo['total_pasture_area'] = 0;
|
||||
foreach($data as $v){
|
||||
if($v['category_child'] == 7){
|
||||
$farmerInfo['is_zz_user'] = true;
|
||||
$farmerInfo['total_land_area'] += floatval($v['data']['area']);
|
||||
$farmerInfo['land_detail'][] = [
|
||||
'land_id' => $v['id'],
|
||||
'land_area' => $v['data']['area'],
|
||||
'land_notes' => $v['data']['notes'],
|
||||
];
|
||||
}
|
||||
if($v['category_child'] == 32){
|
||||
if($v['data']['breeding_type'] == 1){//水产
|
||||
$farmerInfo['is_sc_user'] = true;
|
||||
$farmerInfo['total_pond_area'] += floatval($v['data']['area']);
|
||||
$farmerInfo['pond_detail'][] = [
|
||||
'pond_id' => $v['id'],
|
||||
'pond_area' => $v['data']['area'],
|
||||
'pond_notes' => $v['data']['notes'],
|
||||
];
|
||||
}elseif ($v['data']['breeding_type'] == 2) {//脯乳动物
|
||||
$farmerInfo['is_jq_user'] = true;
|
||||
$farmerInfo['total_henhouse_area'] += floatval($v['data']['area']);
|
||||
}elseif ($v['data']['breeding_type'] == 3){//家禽
|
||||
$farmerInfo['is_dw_user'] = true;
|
||||
$farmerInfo['total_pasture_area'] += floatval($v['data']['area']);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $this->success('请求成功',$farmerInfo);
|
||||
}
|
||||
|
||||
//通过手机号码查找农户
|
||||
public function farmerInfoByPhone(): Json
|
||||
{
|
||||
$params = $this->request->post(['phone']);
|
||||
if(empty($params['phone'])){
|
||||
return $this->fail('参数错误');
|
||||
}
|
||||
$data = UserInformationg::where('phone',$params['phone'])
|
||||
->field('id,name,phone,area_id,street_id,village_id,brigade_id,area_id area_name,street_id street_name,village_id village_name,brigade_id brigade_name,address')
|
||||
->findOrEmpty();
|
||||
return !$data->isEmpty() ? $this->success('请求成功',$data->toArray()) : $this->fail('请求失败');
|
||||
}
|
||||
|
||||
//获取农户土地信息
|
||||
public function farmerLandInfo(): Json
|
||||
{
|
||||
//获取参数
|
||||
$params = $this->request->post(['user_id','land_id']);
|
||||
if(empty($params['user_id']) || empty($params['land_id'])){
|
||||
return $this->fail('参数错误_worker');
|
||||
}
|
||||
//获取农户信息
|
||||
$data = UserInformationgDemand::field('id,data')->where('id',$params['land_id'])->where('information_id', $params['user_id'])->where('category_id',6)->where('category_child',7)->findOrEmpty()->toArray();
|
||||
if(empty($data)){
|
||||
return $this->fail('数据不存在_worker');
|
||||
}
|
||||
$resData = [
|
||||
'land_id' => $data['id'],
|
||||
'land_area' => $data['data']['area']
|
||||
];
|
||||
return $this->success('请求成功',$resData);
|
||||
}
|
||||
|
||||
//获取农户鱼塘信息
|
||||
public function farmerPondInfo(): Json
|
||||
{
|
||||
//获取参数
|
||||
$params = $this->request->post(['user_id','pond_id']);
|
||||
if(empty($params['user_id']) || empty($params['pond_id'])){
|
||||
return $this->fail('参数错误_worker');
|
||||
}
|
||||
//获取农户信息
|
||||
$data = UserInformationgDemand::field('id,data')->where('id',$params['pond_id'])->where('information_id', $params['user_id'])->where('category_id',6)->where('category_child',32)->findOrEmpty()->toArray();
|
||||
if(empty($data) || empty($data['data'])){
|
||||
return $this->fail('数据不存在_worker');
|
||||
}
|
||||
if($data['data']['breeding_type'] != 1){
|
||||
return $this->fail('数据错误_work');
|
||||
}
|
||||
$resData = [
|
||||
'pond_id' => $data['id'],
|
||||
'pond_area' => $data['data']['area']
|
||||
];
|
||||
return $this->success('请求成功',$resData);
|
||||
}
|
||||
|
||||
//获取农户列表
|
||||
public function farmerList(): Json
|
||||
{
|
||||
$params = $this->request->post(['farmer_name','farmer_phone','group_name','captain_name','page_no','page_size']);
|
||||
if(empty($params['page_no']) || empty($params['page_size'])){
|
||||
return $this->fail('参数错误');
|
||||
}
|
||||
$search = [];
|
||||
if(!empty($params['farmer_name'])){
|
||||
$search[] = ['f.name','like','%'.$params['farmer_name'].'%'];
|
||||
}
|
||||
if(!empty($params['farmer_phone'])){
|
||||
$search[] = ['f.phone','like','%'.$params['farmer_phone'].'%'];
|
||||
}
|
||||
if(!empty($params['group_name'])){
|
||||
$search[] = ['g.nickname','like','%'.$params['group_name'].'%'];
|
||||
}
|
||||
if(!empty($params['captain_name'])){
|
||||
$search[] = ['u.nickname','like','%'.$params['captain_name'].'%'];
|
||||
}
|
||||
$data = UserInformationg::alias('f')
|
||||
->field('f.id,f.create_user_id,f.company_id,f.name,f.phone,f.area_id,f.street_id,f.village_id,f.brigade_id,c.company_name,u.nickname as captain_name,g.nickname as group_name,f.area_id area_name,f.street_id street_name,f.village_id village_name,f.brigade_id brigade_name,f.address')
|
||||
->leftJoin('company c','f.company_id = c.id')
|
||||
->leftJoin('user u','u.id = f.create_user_id')
|
||||
->leftJoin('user g','g.id = c.user_id')
|
||||
->where($search)
|
||||
->page($params['page_no'],$params['page_size'])->order('id desc')->select()
|
||||
->each(function($item){
|
||||
$item['address'] = $item['area_name'].$item['street_name'].$item['village_name'].$item['brigade_name'].$item['address'];
|
||||
unset($item['area_name'],$item['street_name'],$item['village_name'],$item['brigade_name'],$item['area_id'],$item['street_id'],$item['village_id'],$item['brigade_id']);
|
||||
$userInformationgDemand = UserInformationgDemand::field('id,category_child,data')->where('information_id', $item['id'])->where('category_id',6)->where('category_child','in','7,32')->order('id', 'desc')->select()->toArray();
|
||||
//是否是种植户
|
||||
$is_zz_user = false;
|
||||
//是否是水产养殖户
|
||||
$is_sc_user = false;
|
||||
//是否是家禽养殖户
|
||||
$is_jq_user = false;
|
||||
//是否是大型动物养殖户
|
||||
$is_dw_user = false;
|
||||
//土地总面积
|
||||
$total_land_area = 0;
|
||||
//池塘总面积
|
||||
$total_pond_area = 0;
|
||||
//家禽养殖场总面积
|
||||
$total_henhouse_area = 0;
|
||||
//动物养殖场总面积
|
||||
$total_pasture_area = 0;
|
||||
foreach($userInformationgDemand as $v){
|
||||
if($v['category_child'] == 7){
|
||||
$is_zz_user = true;
|
||||
$total_land_area += floatval($v['data']['area']);
|
||||
}
|
||||
if($v['category_child'] == 32){
|
||||
if($v['data']['breeding_type'] == 1){//水产
|
||||
$is_sc_user = true;
|
||||
$total_pond_area += floatval($v['data']['area']);
|
||||
}elseif ($v['data']['breeding_type'] == 2) {//脯乳动物
|
||||
$is_jq_user = true;
|
||||
$total_henhouse_area += floatval($v['data']['area']);
|
||||
}elseif ($v['data']['breeding_type'] == 3){//家禽
|
||||
$is_dw_user = true;
|
||||
$total_pasture_area += floatval($v['data']['area']);
|
||||
}
|
||||
}
|
||||
}
|
||||
$str = [];
|
||||
$area = [];
|
||||
if($is_zz_user){
|
||||
$str[] = '种植户';
|
||||
$area[] = $total_land_area;
|
||||
}
|
||||
if($is_sc_user){
|
||||
$str[] = '水产养殖户';
|
||||
$area[] = $total_pond_area;
|
||||
}
|
||||
if($is_jq_user){
|
||||
$str[] = '家禽养殖户';
|
||||
$area[] = $total_henhouse_area;
|
||||
}
|
||||
if($is_dw_user){
|
||||
$str[] = '家畜养殖户';
|
||||
$area[] = $total_pasture_area;
|
||||
}
|
||||
$item['farmer_type'] = implode('/',$str);
|
||||
$item['farmer_area'] = implode('/',$area);
|
||||
return $item;
|
||||
})->toArray();
|
||||
$count = UserInformationg::alias('f')
|
||||
->field('f.id,f.create_user_id,f.company_id,f.name,f.phone,f.area_id,f.street_id,f.village_id,f.brigade_id,c.company_name,u.nickname as captain_name,g.nickname as group_name,f.area_id area_name,f.street_id street_name,f.village_id village_name,f.brigade_id brigade_name,f.address')
|
||||
->leftJoin('company c','f.company_id = c.id')
|
||||
->leftJoin('user u','u.id = f.create_user_id')
|
||||
->leftJoin('user g','g.id = c.user_id')
|
||||
->where($search)
|
||||
->count();
|
||||
$result = [
|
||||
'count' => $count,
|
||||
'page_no' => $params['page_no'],
|
||||
'page_size' => $params['page_size'],
|
||||
'lists' => $data
|
||||
];
|
||||
return $this->success('请求成功',$result);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -2,47 +2,40 @@
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\common\model\contract\VehicleContract;
|
||||
use app\Request;
|
||||
use junziqian\sdk\bean\req\sign\ApplySignReq;
|
||||
use junziqian\sdk\bean\req\user\OrganizationCreateReq;
|
||||
use junziqian\sdk\bean\req\user\OrganizationFaceCreateReq;
|
||||
use junziqian\sdk\util\exception\ResultInfoException;
|
||||
use junziqian\sdk\util\RequestUtils;
|
||||
use junziqian\sdk\util\ShaUtils;
|
||||
use com\junziqian\sdk\bean\req\sign\ApplySignReq;
|
||||
use com\junziqian\sdk\bean\req\user\OrganizationCreateReq;
|
||||
use com\junziqian\sdk\util\exception\ResultInfoException;
|
||||
use com\junziqian\sdk\util\RequestUtils;
|
||||
use com\junziqian\sdk\util\ShaUtils;
|
||||
use CURLFile;
|
||||
use think\facade\Db;
|
||||
|
||||
class JunziqianController extends BaseApiController
|
||||
{
|
||||
public array $notNeedLogin = ['download_file'];
|
||||
public array $notNeedLogin = ['index', 'download_file'];
|
||||
|
||||
/**请求地址*/
|
||||
private $serviceUrl;
|
||||
private $serviceUrl = 'https://api.sandbox.junziqian.com';
|
||||
/**appkey*/
|
||||
private $appkey;
|
||||
private $appkey = '3121e0d911b7943d';
|
||||
/**secret*/
|
||||
private $appSecret;
|
||||
private $appSecret = '1e66d8b73121e0d911b7943d82bba174';
|
||||
|
||||
public function initialize()
|
||||
{
|
||||
$this->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;
|
||||
|
||||
public function index()
|
||||
{
|
||||
$data = [
|
||||
'name' => '我的合同',
|
||||
'signatories' => [['fullName' => '小米', 'identityType' => 1, 'identityCard' => '5002401XXXXXXXXX', 'mobile' => 18982406440, 'noNeedVerify' => 1, 'signLevel' => 1]],
|
||||
'url' => "https://dev.lihaink.cn/storage/202307/acbba88e77392348d3a8a4a1fdf210f1.pdf"
|
||||
];
|
||||
}
|
||||
/**
|
||||
* 填充签名数据
|
||||
* @param $req array
|
||||
@ -81,6 +74,8 @@ class JunziqianController extends BaseApiController
|
||||
public function EnterpriseCertification($data)
|
||||
{
|
||||
$requestUtils = new RequestUtils($this->serviceUrl, $this->appkey, $this->appSecret);
|
||||
//CURLFile 可以传url或filePath,但必须保证文件存在且有效,否则php不会报错,只会导致http请求返回null(并没有调到服务端)。
|
||||
//初始化合同参数
|
||||
$request = new OrganizationCreateReq();
|
||||
$request->name = $data['name'];
|
||||
$request->identificationType = 1; //证件类型:0多证,1多证合一
|
||||
@ -88,48 +83,22 @@ class JunziqianController extends BaseApiController
|
||||
$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参数,用于回调是辨别是商户认证会带
|
||||
// $request->emailOrMobile = ; //邮箱
|
||||
//发起创建企业请求
|
||||
$response = $requestUtils->doPost("/v2/user/organizationCreate", $request);
|
||||
return $response;
|
||||
// return $this->success('', (array)$response);
|
||||
}
|
||||
|
||||
//重新提交企业实名认证
|
||||
public function organizationReapply($data)
|
||||
{
|
||||
$requestUtils = new RequestUtils($this->serviceUrl, $this->appkey, $this->appSecret);
|
||||
//CURLFile 可以传url或filePath,但必须保证文件存在且有效,否则php不会报错,只会导致http请求返回null(并没有调到服务端)。
|
||||
//初始化合同参数
|
||||
$request = new OrganizationCreateReq();
|
||||
$request->name = $data['name'];
|
||||
$request->identificationType = 1; //证件类型:0多证,1多证合一
|
||||
@ -137,8 +106,6 @@ class JunziqianController extends BaseApiController
|
||||
$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);
|
||||
@ -153,24 +120,11 @@ class JunziqianController extends BaseApiController
|
||||
$requestUtils = new RequestUtils($this->serviceUrl, $this->appkey, $this->appSecret);
|
||||
//初始化合同参数
|
||||
$request = array(
|
||||
"emailOrMobile" => $param['master_email'], //TODO *
|
||||
"emailOrMobile" => $param['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;
|
||||
return $this->success('', (array)$response);
|
||||
}
|
||||
|
||||
//企业自定义公章
|
||||
@ -187,124 +141,24 @@ class JunziqianController extends BaseApiController
|
||||
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)
|
||||
public function Signing($data, $id)
|
||||
{
|
||||
$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);
|
||||
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);
|
||||
//CURLFile 可以传url或filePath,但必须保证文件存在且有效,否则php不会报错,只会导致http请求返回null(并没有调到服务端)。
|
||||
//初始化合同参数
|
||||
$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;
|
||||
}
|
||||
//[ ['fullName' => '小米', 'identityType' => 1, 'identityCard' => '5002401XXXXXXXXX', 'mobile' => 18982406440,'noNeedVerify'=>1,'signLevel'=>1] ]
|
||||
$request = new ApplySignReq();
|
||||
$request->contractName = $data['name'];
|
||||
$request->signatories = $data['signatories']; //签约方
|
||||
$request->serverCa = 1; //是否需要服务端云证书
|
||||
$request->fileType = 1; //合同上传方式 url
|
||||
$request->url = $data['url'];
|
||||
$request->notifyUrl = 'https://worker-task.lihaink.cn/notify_url?id=' . $id;
|
||||
//发起PING请求
|
||||
// halt($request);
|
||||
$response = $requestUtils->doPost("/v2/sign/applySign", $request);
|
||||
return $response;
|
||||
// return $this->success('', (array)$response);
|
||||
}
|
||||
|
||||
public function SigningLink($data)
|
||||
@ -314,6 +168,8 @@ class JunziqianController extends BaseApiController
|
||||
//初始化合同参数
|
||||
$response = $requestUtils->doPost("/v2/sign/link", $data);
|
||||
return $response;
|
||||
|
||||
// return $this->success('', (array)$response);
|
||||
}
|
||||
|
||||
public function sms($data)
|
||||
@ -333,7 +189,7 @@ class JunziqianController extends BaseApiController
|
||||
}
|
||||
|
||||
//html模板
|
||||
public function html_contract($data, $id)
|
||||
public function html_contract($data,$id)
|
||||
{
|
||||
$requestUtils = new RequestUtils($this->serviceUrl, $this->appkey, $this->appSecret);
|
||||
//CURLFile 可以传url或filePath,但必须保证文件存在且有效,否则php不会报错,只会导致http请求返回null(并没有调到服务端)。
|
||||
@ -344,23 +200,19 @@ class JunziqianController extends BaseApiController
|
||||
$request->serverCa = 1; //是否需要服务端云证书
|
||||
$request->fileType = 3;
|
||||
$request->htmlContent = $data['content'];
|
||||
$request->notifyUrl = env('url.url_prefix') . '/notify_url?id=' . $id;
|
||||
$request->needQifengSign = 1;
|
||||
$request->notifyUrl = 'https://worker-task.lihaink.cn/notify_url?id=' . $id;
|
||||
|
||||
//发起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::name('contract')->where('contract_no', $applyNo)->value('contract_url');
|
||||
if ($find) {
|
||||
return $this->success('获取成功', ['url' => env('url.url_prefix') . $find]);
|
||||
$find=Db::name('contract')->where('contract_no',$applyNo)->value('contract_url');
|
||||
if($find){
|
||||
return $this->success('获取成功', ['url' => 'https://worker-task.lihaink.cn'.$find]);
|
||||
}
|
||||
//初始化请求参数
|
||||
$request = array(
|
||||
@ -370,81 +222,11 @@ class JunziqianController extends BaseApiController
|
||||
if ($response->success == true) {
|
||||
$this->getDownload($response->data, root_path() . 'public/uploads/contract/' . $applyNo . '.pdf');
|
||||
Db::name('contract')->where('contract_no', $applyNo)->update(['contract_url' => '/uploads/contract/' . $applyNo . '.pdf']);
|
||||
return $this->success('获取成功', ['url' => env('url.url_prefix') . '/uploads/contract/' . $applyNo . '.pdf']);
|
||||
return $this->success('获取成功', ['url' => 'https://worker-task.lihaink.cn/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::name('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::name('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::name('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::name('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)
|
||||
{
|
||||
|
@ -14,17 +14,9 @@
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\common\cache\UserTokenCache;
|
||||
use app\common\model\Company;
|
||||
use app\api\validate\{LoginAccountValidate, RegisterValidate, WebScanLoginValidate, WechatLoginValidate};
|
||||
use app\api\logic\LoginLogic;
|
||||
use app\api\logic\UserLogic;
|
||||
use app\api\service\UserTokenService;
|
||||
use app\common\model\user\User;
|
||||
use Firebase\JWT\JWT;
|
||||
use Firebase\JWT\Key;
|
||||
use think\facade\{Db, Config};
|
||||
use app\common\service\FileService;
|
||||
use app\Request;
|
||||
|
||||
/**
|
||||
* 登录注册
|
||||
@ -34,7 +26,7 @@ use app\common\service\FileService;
|
||||
class LoginController extends BaseApiController
|
||||
{
|
||||
|
||||
public array $notNeedLogin = ['register', 'account', 'logout', 'codeUrl', 'oaLogin', 'mnpLogin', 'getScanCode', 'scanLogin', 'shop_account','checkToken', 'parseToken'];
|
||||
public array $notNeedLogin = ['register', 'account', 'logout', 'codeUrl', 'oaLogin', 'mnpLogin', 'getScanCode', 'scanLogin'];
|
||||
|
||||
|
||||
/**
|
||||
@ -54,10 +46,9 @@ class LoginController extends BaseApiController
|
||||
return $this->fail(LoginLogic::getError());
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
$params = Request()->param();
|
||||
$params['company_id'] = $this->userInfo['company_id'];
|
||||
public function add(){
|
||||
$params=Request()->param();
|
||||
$params['company_id']=$this->userInfo['company_id'];
|
||||
$result = LoginLogic::register($params);
|
||||
if (true === $result) {
|
||||
return $this->success('添加成功', [], 1, 1);
|
||||
@ -65,21 +56,11 @@ class LoginController extends BaseApiController
|
||||
return $this->fail(LoginLogic::getError());
|
||||
}
|
||||
|
||||
public function setInfo()
|
||||
{
|
||||
$params = Request()->param();
|
||||
$result = UserLogic::setInfo($params['user_id'], ['field' => 'is_captain', 'value' => $params['is_captain']]);
|
||||
if (false === $result) {
|
||||
return $this->fail(UserLogic::getError());
|
||||
}
|
||||
return $this->success('操作成功', [], 1, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 账号密码/手机号密码/手机号验证码登录
|
||||
* @return \think\response\Json
|
||||
* @author 段誉
|
||||
* @date 2022/9/16 10:42la_other_user
|
||||
* @date 2022/9/16 10:42
|
||||
*/
|
||||
public function account()
|
||||
{
|
||||
@ -91,22 +72,6 @@ class LoginController extends BaseApiController
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 商城登录
|
||||
*/
|
||||
public function shop_account()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
if (isset($params['shop_token']) && $params['shop_token'] != '') {
|
||||
$result = LoginLogic::shop($params['shop_token']);
|
||||
if (false === $result) {
|
||||
return $this->fail(LoginLogic::getError());
|
||||
}
|
||||
return $this->data($result);
|
||||
}
|
||||
return $this->fail('无登录信息');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 退出登录
|
||||
@ -257,36 +222,6 @@ class LoginController extends BaseApiController
|
||||
LoginLogic::updateUser($params, $this->userId);
|
||||
return $this->success('操作成功', [], 1, 1);
|
||||
}
|
||||
|
||||
public function checkToken(): \think\response\Json
|
||||
{
|
||||
$token = $this->request->post('token');
|
||||
if(empty($token)){
|
||||
return $this->fail('token参数错误');
|
||||
}
|
||||
$userInfo = (new UserTokenCache())->getUserInfo($token);
|
||||
if(!$userInfo){
|
||||
return $this->fail('token无效');
|
||||
}
|
||||
//获取公司信息
|
||||
$company = Company::field('company_name,company_type')->where('id',$userInfo['company_id'])->findOrEmpty();
|
||||
if(!$company->isEmpty()){
|
||||
$userInfo['company_name'] = $company['company_name'];
|
||||
$userInfo['company_type'] = $company['company_type'];
|
||||
}
|
||||
return $this->success('请求成功', $userInfo);
|
||||
}
|
||||
|
||||
public function parseToken()
|
||||
{
|
||||
$token = $this->request->post('token');
|
||||
if(empty($token)){
|
||||
return $this->fail('token参数不能为空');
|
||||
}
|
||||
$result = LoginLogic::parseToken($token);
|
||||
if (false === $result) {
|
||||
return $this->fail(LoginLogic::getError() ?? '登录失败');
|
||||
}
|
||||
return $this->success('请求成功', $result);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,324 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\common\logic\UserLogic as CommonUserLogic;
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\Company;
|
||||
use app\common\model\contract\Contract;
|
||||
use think\facade\Db;
|
||||
|
||||
/**
|
||||
* 搜索
|
||||
* Class PropertyController
|
||||
* @package app\api\controller
|
||||
*/
|
||||
class PropertyController extends BaseApiController
|
||||
{
|
||||
public array $notNeedLogin = ['propertyContractByCompany','propertyContractByPerson','propertyRentByCompany','propertyRentByPerson','propertyRentLists','propertyRentInf','carInfo','carTravelList','carSituationList','addCarSituation'];
|
||||
|
||||
|
||||
//公司签约
|
||||
public function propertyContractByCompany() {
|
||||
//获取参数
|
||||
$param = $this->request->param();
|
||||
$param['admin_id'] = $this->userId = 107;
|
||||
if(!isset($param['company_id'])) {
|
||||
return $this->fail('请选择公司');
|
||||
}
|
||||
if(!isset($param['num'])) {
|
||||
return $this->fail('请填写数量');
|
||||
}
|
||||
if(!isset($param['start_time'])) {
|
||||
return $this->fail('请选择开始时间');
|
||||
}
|
||||
if(!isset($param['end_time'])) {
|
||||
return $this->fail('请选择结束时间');
|
||||
}
|
||||
$party_a = Db::name('user')->where('id',$param['admin_id'])->value('company_id');
|
||||
if(!$party_a){
|
||||
return $this->fail('甲方公司不存在,请先完善公司信息');
|
||||
}
|
||||
//组装数据
|
||||
$value['party_a'] = $party_a;
|
||||
$value['party_b'] = $param['company_id'];
|
||||
$value['num'] = $param['num'];
|
||||
$value['type'] = 1;
|
||||
$value['start_time'] = strtotime($param['start_time']);
|
||||
$value['end_time'] = strtotime($param['end_time']);
|
||||
$value['admin_id'] = $param['admin_id'];
|
||||
$value['contract_no'] = 'HT'.date('YmdHis').rand(1000,9999);
|
||||
$value['create_time'] = time();
|
||||
//生成合同
|
||||
$res = Db::name('property_contract')->save($value);
|
||||
if($res){
|
||||
return $this->success('发起成功,等待平台风控部上传合同');
|
||||
}
|
||||
return $this->fail('发起失败');
|
||||
}
|
||||
|
||||
//个人签约
|
||||
public function propertyContractByPerson() {
|
||||
//获取参数
|
||||
$param = $this->request->param();
|
||||
$param['admin_id'] = $this->userId = 107;
|
||||
if(!isset($param['user_id'])) {
|
||||
return $this->fail('请选择签约人');
|
||||
}
|
||||
if(!isset($param['car_id'])) {
|
||||
return $this->fail('请选择三轮车');
|
||||
}
|
||||
if(!isset($param['start_time'])) {
|
||||
return $this->fail('请选择开始时间');
|
||||
}
|
||||
if(!isset($param['end_time'])) {
|
||||
return $this->fail('请选择结束时间');
|
||||
}
|
||||
if(!isset($param['rent_id'])) {
|
||||
return $this->fail('缺少关键参数');
|
||||
}
|
||||
//组装数据
|
||||
$value['party_a'] = Db::name('user')->where('id',$param['admin_id'])->value('company_id');
|
||||
$value['user_id'] = $param['user_id'];
|
||||
$value['num'] = 1;
|
||||
$value['type'] = 2;
|
||||
$value['start_time'] = strtotime($param['start_time']);
|
||||
$value['end_time'] = strtotime($param['end_time']);
|
||||
$value['admin_id'] = $param['admin_id'];
|
||||
$value['contract_no'] = 'HT'.date('YmdHis').rand(1000,9999);
|
||||
$value['create_time'] = time();
|
||||
//生成合同
|
||||
Db::startTrans();
|
||||
try {
|
||||
$insertId = Db::name('property_contract')->insertGetId($value);
|
||||
Db::name('property_contract_info')->save(
|
||||
[
|
||||
'contract_id' => $insertId,
|
||||
'car_id' => $param['car_id'],
|
||||
'rent_id' => $param['rent_id'],
|
||||
'user_id' => $param['user_id'],
|
||||
]
|
||||
);
|
||||
Db::commit();
|
||||
return $this->success('发起成功,等待平台风控部上传合同');
|
||||
}catch(\Exception $e){
|
||||
Db::rollback();
|
||||
return $this->fail('发起失败'.$e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
//生成公司租赁信息
|
||||
public function propertyRentByCompany() {
|
||||
//获取参数
|
||||
$contract_id = $this->request->param('contract_id');
|
||||
//验证参数
|
||||
if(!isset($contract_id)){
|
||||
return $this->fail('请选择合同');
|
||||
}
|
||||
try {
|
||||
//获取合同数据
|
||||
$contractInfo = Db::name('property_contract')->where('id',$contract_id)->find();
|
||||
$carsids = Db::name('property')->where('status',0)->limit($contractInfo['num'])->column('id');
|
||||
}catch (\Exception $e) {
|
||||
return $this->fail($e->getMessage());
|
||||
}
|
||||
$data['cars'] = [];
|
||||
foreach($carsids as $v){
|
||||
$arr['id'] = $v;
|
||||
$arr['status'] = 0;
|
||||
array_push($data['cars'],$arr);
|
||||
}
|
||||
$value['company_id'] = $contractInfo['party_b'];
|
||||
$value['company_from_id'] = $contractInfo['party_a'];
|
||||
$value['contract_id'] = $contractInfo['id'];
|
||||
$value['num'] = $contractInfo['num'];
|
||||
$value['start_time'] = $contractInfo['start_time'];
|
||||
$value['end_time'] = $contractInfo['end_time'];
|
||||
$value['cars'] = json_encode($data['cars']);
|
||||
//生成数据
|
||||
Db::startTrans();
|
||||
try {
|
||||
Db::name('property_rent')->save($value);
|
||||
Db::name('property')->where('id','in',$carsids)->update(['status'=>1]);
|
||||
Db::commit();
|
||||
return $this->success('租赁成功');
|
||||
}catch(\Exception $e){
|
||||
Db::rollback();
|
||||
return $this->fail('租赁失败');
|
||||
}
|
||||
}
|
||||
|
||||
//生成个人租赁信息
|
||||
public function propertyRentByPerson(){
|
||||
//获取参数
|
||||
$contract_id = $this->request->param('contract_id');
|
||||
//验证参数
|
||||
if(!isset($contract_id)){
|
||||
return $this->fail('请选择合同');
|
||||
}
|
||||
try {
|
||||
//获取合同数据
|
||||
$contractInfo = Db::name('property_contract')->alias('c')->leftJoin('property_contract_info i','c.id = i.contract_id')->where('c.id',$contract_id)->find();
|
||||
|
||||
}catch (\Exception $e) {
|
||||
return $this->fail($e->getMessage());
|
||||
}
|
||||
$value['user_id'] = $contractInfo['user_id'];
|
||||
$value['company_from_id'] = $contractInfo['party_a'];
|
||||
$value['contract_id'] = $contract_id;
|
||||
$value['num'] = 1;
|
||||
$value['start_time'] = $contractInfo['start_time'];
|
||||
$value['end_time'] = $contractInfo['end_time'];
|
||||
$value['cars'] = json_encode(['id'=>$contractInfo['car_id'],'status'=>1]);
|
||||
//生成数据
|
||||
Db::startTrans();
|
||||
try {
|
||||
Db::name('property_rent')->save($value);
|
||||
$rentInfo = Db::name('property_rent')->where('id',$contractInfo['rent_id'])->find();
|
||||
$cars = json_decode($rentInfo['cars'],true);
|
||||
foreach($cars as $k=>$v) {
|
||||
if($v['id'] == $contractInfo['car_id']) {
|
||||
$cars[$k]['status'] = 1;
|
||||
}
|
||||
}
|
||||
$cars = json_encode($cars);
|
||||
Db::name('property_rent')->where('id',$contractInfo['rent_id'])->update(['cars'=>$cars]);
|
||||
Db::commit();
|
||||
return $this->success('租赁成功');
|
||||
}catch(\Exception $e){
|
||||
Db::rollback();
|
||||
return $this->fail('租赁失败');
|
||||
}
|
||||
}
|
||||
|
||||
//获取租赁列表
|
||||
public function propertyRentLists() {
|
||||
//获取参数
|
||||
$company_id = $this->request->param('company_id');
|
||||
//获取数据
|
||||
$data = Db::name('property_rent')->withoutField('cars')->where('company_id',$company_id)->select()->each(function($item,$key){
|
||||
$item['diif_time'] = ceil(($item['end_time']-$item['start_time'])/86400);
|
||||
$item['start_time'] = date('Y-m-d',$item['start_time']);
|
||||
$item['end_time'] = date('Y-m-d',$item['end_time']);
|
||||
$company = Db::name('company')->where('id',$item['company_from_id'])->find();
|
||||
$item['company_user'] = $company['master_name'];
|
||||
$item['company_phone'] = $company['master_phone'];
|
||||
$item['contract_file'] = Db::name('property_contract')->where('id',$item['contract_id'])->value('contract_url');
|
||||
$item['model'] = '电动三轮车';
|
||||
return $item;
|
||||
})->toArray();
|
||||
//返回
|
||||
return $this->success('获取成功',$data,1,1);
|
||||
}
|
||||
|
||||
//获取租赁详情列表
|
||||
public function propertyRentInfo() {
|
||||
//获取参数
|
||||
$rent_id = $this->request->param('rent_id');
|
||||
//获取数据
|
||||
$data = Db::name('property_rent')->where('id',$rent_id)->find();
|
||||
$company = Db::name('company')->where('id',$data['company_from_id'])->find();
|
||||
$data['company_name'] = $company['company_name'];
|
||||
$data['company_phone'] = $company['master_phone'];
|
||||
$data['cars'] = json_decode($data['cars'],true);
|
||||
foreach($data['cars'] as $k=>$v) {
|
||||
$data['cars'][$k]['status_name'] = $v['status'] == 1 ? '已租赁' : '未租赁';
|
||||
$data['cars'][$k]['car_info'] = Db::name('property')->where('id',$v['id'])->find();
|
||||
if($v['status'] == 1) {
|
||||
$rentInfo = Db::name('property_contract_info')->where('rent_id',$rent_id)->where('car_id',$v['id'])->find();
|
||||
$data['cars'][$k]['user_info'] = Db::name('user')->field('nickname,mobile')->where('id',$rentInfo['user_id'])->find();
|
||||
}
|
||||
}
|
||||
//返回
|
||||
return $this->success('获取成功',$data,1,1);
|
||||
}
|
||||
|
||||
//车辆详情
|
||||
public function carInfo() {
|
||||
//获取参数
|
||||
$car_id = $this->request->param('car_id');
|
||||
$rent_id = $this->request->param('rent_id');
|
||||
if(!isset($car_id) || !isset($rent_id)) {
|
||||
return $this->fail('参数错误');
|
||||
}
|
||||
//获取数据
|
||||
$data = Db::name('property_rent')->alias('p')
|
||||
->leftJoin('company c','p.company_from_id = c.id')
|
||||
->leftJoin('user u','u.id = p.user_id')
|
||||
->field('p.*,c.company_name,c.master_phone as company_phone,u.nickname as user_name,u.mobile as user_phone')
|
||||
->where('p.id',$rent_id)->find();
|
||||
|
||||
$data['cars'] = json_decode($data['cars'],true);
|
||||
if($car_id != $data['cars']['id']) {
|
||||
return $this->fail('参数错误');
|
||||
}
|
||||
$carInfo = Db::name('property')->field('name as car_name,pic as car_pic')->where('id',$car_id)->find();
|
||||
$data['cars']['car_name'] = $carInfo['car_name'];
|
||||
$data['cars']['car_pic'] = $carInfo['car_pic'];
|
||||
//返回
|
||||
return $this->success('获取成功',$data,1,1);
|
||||
}
|
||||
|
||||
//车辆行驶记录
|
||||
public function carTravelList() {
|
||||
//获取参数
|
||||
$car_id = $this->request->param('car_id');
|
||||
$rent_id = $this->request->param('rent_id');
|
||||
$page_size = $this->request->param('page_size',10);
|
||||
$page_num = $this->request->param('page_num',1);
|
||||
if(!isset($car_id) || !isset($rent_id)) {
|
||||
return $this->fail('参数错误');
|
||||
}
|
||||
$kilometers_count = 0;
|
||||
$data = Db::name('property_rent_car_travel')->field('create_time,kilometers')->where('car_id',$car_id)->where('rent_id',$rent_id)->order('create_time desc')->paginate([
|
||||
'list_rows'=> $page_size,
|
||||
'page' => $page_num,
|
||||
])->each(function($item,$key) use (&$kilometers_count){
|
||||
$kilometers_count += $item['kilometers'];
|
||||
return $item;
|
||||
})->toArray();
|
||||
$data['kilometers_count'] = $kilometers_count;
|
||||
return $this->success('获取成功',$data,1,1);
|
||||
}
|
||||
|
||||
//三轮车近况列表
|
||||
public function carSituationList() {
|
||||
//获取参数
|
||||
$car_id = $this->request->param('car_id');
|
||||
$rent_id = $this->request->param('rent_id');
|
||||
$page_size = $this->request->param('page_size',10);
|
||||
$page_num = $this->request->param('page_num',1);
|
||||
if(!isset($car_id) || !isset($rent_id)) {
|
||||
return $this->fail('参数错误');
|
||||
}
|
||||
$data = Db::name('property_rent_car_situation')->field('create_time,content')->where('car_id',$car_id)->where('rent_id',$rent_id)->order('create_time desc')->paginate([
|
||||
'list_rows'=> $page_size,
|
||||
'page' => $page_num,
|
||||
])->toArray();
|
||||
|
||||
return $this->success('获取成功',$data,1,1);
|
||||
}
|
||||
|
||||
//填写三轮车近况
|
||||
public function addCarSituation() {
|
||||
//获取参数
|
||||
$car_id = $this->request->param('car_id');
|
||||
$rent_id = $this->request->param('rent_id');
|
||||
$content = $this->request->param('content');
|
||||
if(!isset($car_id) || !isset($rent_id) || !isset($content)) {
|
||||
return $this->fail('参数错误');
|
||||
}
|
||||
$data = [
|
||||
'car_id' => $car_id,
|
||||
'rent_id' => $rent_id,
|
||||
'content' => $content,
|
||||
'create_time' => time(),
|
||||
];
|
||||
$res = Db::name('property_rent_car_situation')->insert($data);
|
||||
if($res) {
|
||||
return $this->success('添加成功');
|
||||
}else {
|
||||
return $this->fail('添加失败');
|
||||
}
|
||||
}
|
||||
}
|
@ -16,7 +16,7 @@ namespace app\api\controller;
|
||||
use app\api\lists\recharge\RechargeLists;
|
||||
use app\api\logic\RechargeLogic;
|
||||
use app\api\validate\RechargeValidate;
|
||||
use app\common\model\company\CompanyAccountLog;
|
||||
|
||||
|
||||
/**
|
||||
* 充值控制器
|
||||
@ -36,18 +36,6 @@ class RechargeController extends BaseApiController
|
||||
{
|
||||
return $this->dataLists(new RechargeLists());
|
||||
}
|
||||
public function deposit_lists()
|
||||
{
|
||||
$params=$this->request->param();
|
||||
$list=CompanyAccountLog::where('company_id',$this->userInfo['company_id'])->page($params['page_no'],15)->order('id', 'desc')->select();
|
||||
$datas=[];
|
||||
foreach($list as $k=>$v){
|
||||
$datas[$k]['create_time']=$v['create_time'];
|
||||
$datas[$k]['order_amount']=$v['change_amount'];
|
||||
$datas[$k]['tips']='押金充值'.$v['change_amount'];
|
||||
}
|
||||
return $this->success('ok',['count'=>0,'extend'=>[],'lists'=>$datas,'page_no'=>$params['page_no'],'page_size'=>$params['page_size']]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user