TaskSystem/app/api/controller/CeshiController.php
2023-08-22 09:58:04 +08:00

63 lines
2.3 KiB
PHP

<?php
namespace app\api\controller;
use app\common\logic\finance\ShareProfit;
use app\common\logic\task\TaskLogic;
use app\common\model\Company;
use app\common\model\task\Task;
use app\common\model\task_scheduling_plan\TaskSchedulingPlan;
use app\common\model\task_template\TaskTemplate;
use think\facade\Log;
use app\job\TaskInformationJob;
use Symfony\Component\HttpClient\HttpClient;
class CeshiController extends BaseApiController
{
public array $notNeedLogin = ['index','ceshi','ceshi1'];
public function index()
{
// $all=TaskSchedulingPlan::whereDay('end_time','yesterday')->where('is_pay',0)->with(['template_info','scheduling'])->select()->toArray();
// halt($all);
$all=TaskSchedulingPlan::whereDay('end_time')->where('is_pay',0)->with(['template_info','scheduling'])->select()->toArray();
foreach($all as $k=>$v){
queue(TaskInformationJob::class,$v);
}
halt(1);
}
public function ceshi(){
$time=strtotime(date('Y-m-d'));
// $time=strtotime(date('Y-m-d'));
// $tiem_end=$time+86399;
// $all=TaskTemplate::where('cron_time','<',$time)->where('status',1)->with('company')->select()->toArray();
$all=TaskTemplate::where('id',73)->with('company')->select()->toArray();
// $all=TaskSchedulingPlan::where('start_time','between',[$time,$tiem_end])->where('is_execute',0)->with(['template_info','scheduling'])->select()->toArray();
$company_id=0;
foreach($all as $k=>$v){
TaskLogic::CronAdd($v);
$company_id=$v['company_id'];
}
}
public function ceshi1(){
$params=[
'car_id'=>3,
'start_time'=>'2023-08-18',
'end_time'=>'2023-08-18 23:59:59'
];
$task=Task::where('id',485)->select()->toArray();
foreach($task as $k=>$v){
if(isset($v['extend']['terminus']['lnglat'])){
$arr=$v['extend']['terminus']['lnglat'];
app(RemoteController::class)->coordinate($params,$arr[0],$arr[1]);
}
if(isset($v['extend']['transfer']['lnglat'])){
$arr=$v['extend']['transfer']['lnglat'];
app(RemoteController::class)->coordinate($params,$arr[0],$arr[1]);
}
}
}
}