From e6abc74302eb5d73ec418158fd2fba95a4b8a72b Mon Sep 17 00:00:00 2001 From: chenbo <709206448@qq.com> Date: Tue, 19 Sep 2023 18:17:15 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=BB=A3=E7=A0=81=E9=A1=BA?= =?UTF-8?q?=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../logic/task_template/TaskTemplateLogic.php | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) 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'],