update
This commit is contained in:
parent
e7e0dd9a9b
commit
ca1a923965
@ -23,26 +23,6 @@ class CronController extends BaseApiController
|
|||||||
{
|
{
|
||||||
public array $notNeedLogin = ['settlement','task_add', 'town_task_add', 'town_task_settlement','village_task_add'];
|
public array $notNeedLogin = ['settlement','task_add', 'town_task_add', 'town_task_settlement','village_task_add'];
|
||||||
|
|
||||||
/**
|
|
||||||
* 小组服务公司任务结算
|
|
||||||
*/
|
|
||||||
public function settlement(){
|
|
||||||
// $all=TaskSchedulingPlan::where('is_pay',0)->with(['template_info','scheduling'])->select()->toArray();
|
|
||||||
$all = TaskSchedulingPlan::whereDay('end_time','today')
|
|
||||||
->withJoin(['scheduling'], 'left')
|
|
||||||
->where('scheduling.company_type', 18)
|
|
||||||
->where('is_pay',0)
|
|
||||||
->with(['template_info'])
|
|
||||||
->select()
|
|
||||||
->toArray();
|
|
||||||
foreach($all as $k=>$v){
|
|
||||||
queue(TaskInformationJob::class,$v);
|
|
||||||
}
|
|
||||||
Log::info('小组服务公司定时任务结算执行成功'.date('Y-m-d H:i:s'));
|
|
||||||
return $this->success('小组服务公司定时任务结算执行成功');
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 小组服务公司任务下发
|
* 小组服务公司任务下发
|
||||||
*/
|
*/
|
||||||
@ -78,60 +58,23 @@ class CronController extends BaseApiController
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 镇农科公司任务结算
|
* 小组服务公司任务结算
|
||||||
*/
|
*/
|
||||||
public function town_task_settlement()
|
public function settlement(){
|
||||||
{
|
// $all=TaskSchedulingPlan::where('is_pay',0)->with(['template_info','scheduling'])->select()->toArray();
|
||||||
Log::info('镇农科公司定时任务结算执行-开始'.date('Y-m-d H:i:s'));
|
$all = TaskSchedulingPlan::whereDay('end_time','today')
|
||||||
//today 今日未结算的任务计划
|
|
||||||
$taskSchedulingPlanList = TaskSchedulingPlan::whereDay('end_time','today')
|
|
||||||
->withJoin(['scheduling'], 'left')
|
->withJoin(['scheduling'], 'left')
|
||||||
->where('scheduling.company_type', 41)
|
->where('scheduling.company_type', 18)
|
||||||
->where('is_pay',0)
|
->where('is_pay',0)
|
||||||
->with(['template_info'])
|
->with(['template_info'])
|
||||||
->select()
|
->select()
|
||||||
->toArray();
|
->toArray();
|
||||||
foreach($taskSchedulingPlanList as $taskSchedulingPlan){
|
foreach($all as $k=>$v){
|
||||||
queue(TownTaskSettlementJob::class, $taskSchedulingPlan);
|
queue(TaskInformationJob::class,$v);
|
||||||
}
|
|
||||||
Log::info('镇农科公司定时任务结算执行-结束'.date('Y-m-d H:i:s'));
|
|
||||||
return $this->success('镇农科公司定时任务结算执行成功');
|
|
||||||
}
|
}
|
||||||
|
Log::info('小组服务公司定时任务结算执行成功'.date('Y-m-d H:i:s'));
|
||||||
|
return $this->success('小组服务公司定时任务结算执行成功');
|
||||||
|
|
||||||
/**
|
|
||||||
* 镇农科公司任务下发
|
|
||||||
*/
|
|
||||||
public function town_task_add()
|
|
||||||
{
|
|
||||||
//任务下发
|
|
||||||
$time = strtotime(date('Y-m-d'));
|
|
||||||
// 查询系统 所有镇农科公司 未下发 的 任务安排
|
|
||||||
$taskSchedulingList = TaskScheduling::where('cron_time', '<', $time)
|
|
||||||
->where('status', 1)
|
|
||||||
->where('company_type', 41)
|
|
||||||
->with('company_info')
|
|
||||||
->select()
|
|
||||||
->toArray();
|
|
||||||
|
|
||||||
$taskSchedulingIds = [];
|
|
||||||
$companyIds = [];
|
|
||||||
foreach ($taskSchedulingList as $k => $taskScheduling) {
|
|
||||||
$templateList = TaskTemplate::where('status', 1)->where('task_scheduling', $taskScheduling['id'])->limit(30)->select()->toArray();
|
|
||||||
$taskSchedulingIds[] = $taskScheduling['id'];
|
|
||||||
$companyIds[] = $taskScheduling['company_id'];
|
|
||||||
foreach ($templateList as $template) {
|
|
||||||
queue(TownTaskAdd::class, $template);
|
|
||||||
// TaskLogic::TownCronAdd($template); // 手动下发用
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($templateList)) {
|
|
||||||
unset($taskSchedulingList[$k]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Company::where('id', 'in', $companyIds)->inc('day_count')->update();
|
|
||||||
TaskScheduling::where('id', 'in', $taskSchedulingIds)->update(['cron_time' => time()]);
|
|
||||||
Log::info('镇农科公司定时任务下发执行成功' . date('Y-m-d H:i:s'));
|
|
||||||
return $this->success('镇农科公司定时任务下发执行成功');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -190,4 +133,61 @@ class CronController extends BaseApiController
|
|||||||
Log::info('村管理公司定时任务结算执行-结束'.date('Y-m-d H:i:s'));
|
Log::info('村管理公司定时任务结算执行-结束'.date('Y-m-d H:i:s'));
|
||||||
return $this->success('村管理公司定时任务结算执行成功');
|
return $this->success('村管理公司定时任务结算执行成功');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 镇农科公司任务下发
|
||||||
|
*/
|
||||||
|
public function town_task_add()
|
||||||
|
{
|
||||||
|
//任务下发
|
||||||
|
$time = strtotime(date('Y-m-d'));
|
||||||
|
// 查询系统 所有镇农科公司 未下发 的 任务安排
|
||||||
|
$taskSchedulingList = TaskScheduling::where('cron_time', '<', $time)
|
||||||
|
->where('status', 1)
|
||||||
|
->where('company_type', 41)
|
||||||
|
->with('company_info')
|
||||||
|
->select()
|
||||||
|
->toArray();
|
||||||
|
|
||||||
|
$taskSchedulingIds = [];
|
||||||
|
$companyIds = [];
|
||||||
|
foreach ($taskSchedulingList as $k => $taskScheduling) {
|
||||||
|
$templateList = TaskTemplate::where('status', 1)->where('task_scheduling', $taskScheduling['id'])->limit(30)->select()->toArray();
|
||||||
|
$taskSchedulingIds[] = $taskScheduling['id'];
|
||||||
|
$companyIds[] = $taskScheduling['company_id'];
|
||||||
|
foreach ($templateList as $template) {
|
||||||
|
queue(TownTaskAdd::class, $template);
|
||||||
|
// TaskLogic::TownCronAdd($template); // 手动下发用
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($templateList)) {
|
||||||
|
unset($taskSchedulingList[$k]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Company::where('id', 'in', $companyIds)->inc('day_count')->update();
|
||||||
|
TaskScheduling::where('id', 'in', $taskSchedulingIds)->update(['cron_time' => time()]);
|
||||||
|
Log::info('镇农科公司定时任务下发执行成功' . date('Y-m-d H:i:s'));
|
||||||
|
return $this->success('镇农科公司定时任务下发执行成功');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 镇农科公司任务结算
|
||||||
|
*/
|
||||||
|
public function town_task_settlement()
|
||||||
|
{
|
||||||
|
Log::info('镇农科公司定时任务结算执行-开始'.date('Y-m-d H:i:s'));
|
||||||
|
//today 今日未结算的任务计划
|
||||||
|
$taskSchedulingPlanList = TaskSchedulingPlan::whereDay('end_time','today')
|
||||||
|
->withJoin(['scheduling'], 'left')
|
||||||
|
->where('scheduling.company_type', 41)
|
||||||
|
->where('is_pay',0)
|
||||||
|
->with(['template_info'])
|
||||||
|
->select()
|
||||||
|
->toArray();
|
||||||
|
foreach($taskSchedulingPlanList as $taskSchedulingPlan){
|
||||||
|
queue(TownTaskSettlementJob::class, $taskSchedulingPlan);
|
||||||
|
}
|
||||||
|
Log::info('镇农科公司定时任务结算执行-结束'.date('Y-m-d H:i:s'));
|
||||||
|
return $this->success('镇农科公司定时任务结算执行成功');
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user