diff --git a/app/common/logic/task_template/TaskTemplateLogic.php b/app/common/logic/task_template/TaskTemplateLogic.php index 601f92854..20a49bb58 100644 --- a/app/common/logic/task_template/TaskTemplateLogic.php +++ b/app/common/logic/task_template/TaskTemplateLogic.php @@ -45,17 +45,7 @@ class TaskTemplateLogic extends BaseLogic { try { Db::startTrans(); - // 如果是公司第一次创建安排任务,初始化公司的可提现周期 - $templateCount = TaskTemplate::where(['company_id'=>$params['company_id']])->count(); - if ($templateCount == 0) { - $dictData = ConfigLogic::getDictTypeValueByType('withdraw_cycle'); - $cycle = $dictData['withdraw_cycle_1']['value']; // 数据字典-提现周期 单位:天数 - $today = strtotime(date('Y-m-d')); - $withdrawDeadline = $today + $cycle * 24 * 60 * 60 + 86400; - $company = Company::find([$params['company_id']]); - $company->withdraw_deadline = $withdrawDeadline; - $company->save(); - } + $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']){ self::setError('已经有同一种任务类型了'); @@ -97,6 +87,19 @@ class TaskTemplateLogic extends BaseLogic if($params['type']==35){ $params['extend']=['shareholder'=>['user_id'=>$params['task_admin']]]; } + + // 如果是公司第一次创建安排任务,初始化公司的可提现周期 + $templateCount = TaskTemplate::where(['company_id'=>$params['company_id']])->count(); + if ($templateCount == 0) { + $dictData = ConfigLogic::getDictTypeValueByType('withdraw_cycle'); + $cycle = $dictData['withdraw_cycle_1']['value']; // 数据字典-提现周期 单位:天数 + $today = strtotime(date('Y-m-d')); + $withdrawDeadline = $today + $cycle * 24 * 60 * 60 + 86400; + $company = Company::find([$params['company_id']]); + $company->withdraw_deadline = $withdrawDeadline; + $company->save(); + } + TaskTemplate::create([ 'title' => $params['title'], 'admin_id' => $params['admin_id'],