镇管理公司创建任务模板,校验公司有没有创建服务部长的用户账号
This commit is contained in:
parent
460d2b65ea
commit
20db4a4dd3
@ -22,6 +22,7 @@ use app\common\logic\BaseLogic;
|
|||||||
use app\common\model\company\CompanyProperty;
|
use app\common\model\company\CompanyProperty;
|
||||||
use app\common\model\informationg\UserInformationg;
|
use app\common\model\informationg\UserInformationg;
|
||||||
use app\common\model\task_scheduling\TaskScheduling;
|
use app\common\model\task_scheduling\TaskScheduling;
|
||||||
|
use app\common\model\user\User;
|
||||||
use think\facade\Db;
|
use think\facade\Db;
|
||||||
|
|
||||||
|
|
||||||
@ -250,6 +251,11 @@ class TaskTemplateLogic extends BaseLogic
|
|||||||
try {
|
try {
|
||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
|
|
||||||
|
$serviceManagerUser = (new User())->searchServiceManager($params['company_id']);
|
||||||
|
if (empty($serviceManagerUser)) {
|
||||||
|
self::setError('公司还没有服务部长,无法指派任务');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
$find = TaskTemplate::where('task_scheduling', $params['task_scheduling'])->where('company_id',$params['company_id'])->where('type',$params['type'])->field('id,types,type')->find();
|
$find = TaskTemplate::where('task_scheduling', $params['task_scheduling'])->where('company_id',$params['company_id'])->where('type',$params['type'])->field('id,types,type')->find();
|
||||||
if($find && $params['type'] == $find['type']){
|
if($find && $params['type'] == $find['type']){
|
||||||
self::setError('已经有同一种任务类型了');
|
self::setError('已经有同一种任务类型了');
|
||||||
|
@ -220,4 +220,9 @@ class User extends BaseModel
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function searchServiceManager($companyId)
|
||||||
|
{
|
||||||
|
return User::where(['company_id' => $companyId, 'group_id'=> 14])->find();
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user