47 lines
1.8 KiB
PHP
47 lines
1.8 KiB
PHP
<?php
|
|
namespace app\api\controller;
|
|
|
|
use app\common\logic\finance\ShareProfit;
|
|
use app\common\logic\task\TaskLogic;
|
|
use app\common\model\task\Task;
|
|
use app\common\model\task_scheduling_plan\TaskSchedulingPlan;
|
|
|
|
class CeshiController extends BaseApiController
|
|
{
|
|
public array $notNeedLogin = ['index','ceshi'];
|
|
|
|
public function index()
|
|
{
|
|
$all=TaskSchedulingPlan::whereDay('start_time','yesterday')->with(['template_info','scheduling'])->select();
|
|
foreach($all as $k=>$data){
|
|
$task_id=explode(',',$data['task_id']);
|
|
$task_count=Task::where('id','in',$task_id)->field('director_uid')->with('director_info')->select();
|
|
if(count($task_count)==count($task_id)){
|
|
$name_arr=[];
|
|
foreach ($task_count as $key => $value) {
|
|
$name_arr[$key]=$value['director_info']['nickname'];
|
|
}
|
|
$name=implode(',',$name_arr);
|
|
$arr['money']=$data['template_info']['money'];
|
|
$arr['company_id']=$data['scheduling']['company_id'];
|
|
$arr['msg']='来自任务【'.$data['template_info']['title'].'】,执行人:'.$name.',的任务结算';
|
|
$arr['sn']=$data['sn'];
|
|
$arr['user_id']=$data['user_id'];
|
|
(new ShareProfit())->first($arr);
|
|
}
|
|
}
|
|
halt(2);
|
|
}
|
|
|
|
public function ceshi(){
|
|
// $time=strtotime(date('Y-m-d',strtotime('+1 day')));
|
|
$time=strtotime(date('Y-m-d'));
|
|
$tiem_end=$time+86399;
|
|
$all=TaskSchedulingPlan::where('start_time','between',[$time,$tiem_end])->where('is_execute',0)->with(['template_info','scheduling'])->select()->toArray();
|
|
halt($all);
|
|
foreach($all as $k=>$v){
|
|
TaskLogic::CronAdd($v);
|
|
}
|
|
halt(TaskLogic::getError());
|
|
}
|
|
} |