add 后台添加镇负责人任务模板
This commit is contained in:
parent
02f1b63096
commit
6af8ff4f71
@ -256,6 +256,15 @@ class TaskTemplateLogic extends BaseLogic
|
||||
Db::startTrans();
|
||||
|
||||
// $params['extend']['task_role'] 扩展字段 任务角色 1总负责人 2市场部长 3服务部长
|
||||
$taskScheduleAmount = 200;
|
||||
if ($params['extend']['task_role'] == 1) {
|
||||
$taskScheduleAmount = 300;
|
||||
$serviceManagerUser = (new User())->searchMaster($params['company_id']);
|
||||
if (empty($serviceManagerUser)) {
|
||||
self::setError('公司还没有负责人,无法指派任务');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if ($params['extend']['task_role'] == 2) {
|
||||
$serviceManagerUser = (new User())->searchMarketingManager($params['company_id']);
|
||||
if (empty($serviceManagerUser)) {
|
||||
@ -280,22 +289,22 @@ class TaskTemplateLogic extends BaseLogic
|
||||
}
|
||||
|
||||
$moeny = TaskTemplate::where('company_id', $params['company_id'])->sum('money');
|
||||
if($moeny + $params['money'] > 200){
|
||||
if($moeny + $params['money'] > $taskScheduleAmount){
|
||||
self::setError('任务模板一阶段合计金额不能大于任务调度金额');
|
||||
return false;
|
||||
}
|
||||
$moneyTwo = TaskTemplate::where('company_id', $params['company_id'])->sum('money_two');
|
||||
if($moneyTwo + $params['money_two'] > 200){
|
||||
if($moneyTwo + $params['money_two'] > $taskScheduleAmount){
|
||||
self::setError('任务模板二阶段合计金额不能大于任务调度金额');
|
||||
return false;
|
||||
}
|
||||
$newMoneyThree = TaskTemplate::where('company_id', $params['company_id'])->sum('new_money_three');
|
||||
if($newMoneyThree + $params['new_money_three'] > 200){
|
||||
if($newMoneyThree + $params['new_money_three'] > $taskScheduleAmount){
|
||||
self::setError('任务模板三阶段合计金额不能大于任务调度金额');
|
||||
return false;
|
||||
}
|
||||
$moneyThree = TaskTemplate::where('company_id', $params['company_id'])->sum('money_three');
|
||||
if($moneyThree + $params['money_three']>200){
|
||||
if($moneyThree + $params['money_three']>$taskScheduleAmount){
|
||||
self::setError('任务模板长期合计金额不能大于任务调度金额');
|
||||
return false;
|
||||
}
|
||||
|
@ -221,15 +221,25 @@ class User extends BaseModel
|
||||
}
|
||||
}
|
||||
|
||||
// 查询镇农科服务部长
|
||||
public function searchServiceManager($companyId)
|
||||
{
|
||||
return User::where(['company_id' => $companyId, 'group_id'=> 14])->find();
|
||||
}
|
||||
|
||||
// 查询镇农科负责人
|
||||
public function searchMaster($companyId)
|
||||
{
|
||||
return User::where(['company_id' => $companyId, 'group_id'=> 15])->find();
|
||||
}
|
||||
|
||||
// 查询镇农科市场部长
|
||||
public function searchMarketingManager($companyId)
|
||||
{
|
||||
return User::where(['company_id' => $companyId, 'group_id'=> 16])->find();
|
||||
}
|
||||
|
||||
// 查询村联络员
|
||||
public function searchLiaisonMan($companyId)
|
||||
{
|
||||
return User::where(['company_id' => $companyId, 'group_id'=> 17])->find();
|
||||
|
Loading…
x
Reference in New Issue
Block a user