From eecc48ad9a6f0a2ee9e2a039bc63587cb2138ea9 Mon Sep 17 00:00:00 2001 From: chenbo <709206448@qq.com> Date: Thu, 14 Dec 2023 13:34:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=89=8D=E7=AB=AF=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/CeshiController.php | 73 ++++++++++++++------------ 1 file changed, 38 insertions(+), 35 deletions(-) diff --git a/app/api/controller/CeshiController.php b/app/api/controller/CeshiController.php index 9e98e7260..6bcb6430f 100644 --- a/app/api/controller/CeshiController.php +++ b/app/api/controller/CeshiController.php @@ -306,12 +306,12 @@ class CeshiController extends BaseApiController $all = TaskSchedulingPlan::whereDay('end_time','today') ->withJoin(['scheduling'], 'left') ->where('scheduling.company_type', 18) - ->where('scheduling.company_id', 43) - ->where('is_pay',0) + ->where('scheduling.company_id', 34) +// ->where('is_pay',0) ->with(['template_info']) ->select() ->toArray(); - dd($all); + foreach($all as $k=>$data){ try { TaskSchedulingPlan::where('id', $data['id'])->update(['is_pay' => 1]); @@ -377,34 +377,37 @@ class CeshiController extends BaseApiController $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($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; - } +// 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; @@ -423,7 +426,7 @@ class CeshiController extends BaseApiController 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)); + Log::info( $data['template_info']['title'] . '结算失败,任务为超时:' . json_encode($data)); return false; } @@ -579,7 +582,7 @@ class CeshiController extends BaseApiController { Log::info('村管理公司定时任务结算执行-开始'.date('Y-m-d H:i:s')); //today 今日未结算的任务计划 - $taskSchedulingPlanList = TaskSchedulingPlan::whereDay('end_time','today') + $taskSchedulingPlanList = TaskSchedulingPlan::whereDay('end_time','yesterday') ->withJoin(['scheduling'], 'left') ->where('scheduling.company_type', 17) ->where('scheduling.company_id', 33) @@ -587,11 +590,11 @@ class CeshiController extends BaseApiController ->with(['template_info']) ->select() ->toArray(); - dd($taskSchedulingPlanList); + foreach($taskSchedulingPlanList as $taskSchedulingPlan){ - if ($taskSchedulingPlan['template_info']['type'] == 69) { + TaskLogic::villageTaskSettlement($taskSchedulingPlan); - } + // queue(VillageTaskSettlementJob::class, $taskSchedulingPlan); } Log::info('村管理公司定时任务结算执行-结束'.date('Y-m-d H:i:s'));