TaskSystem/app/api/controller/CeshiController.php

83 lines
2.8 KiB
PHP
Raw Normal View History

2023-08-10 17:10:12 +08:00
<?php
namespace app\api\controller;
use app\common\logic\finance\ShareProfit;
use app\common\logic\task\TaskLogic;
2023-08-14 17:44:55 +08:00
use app\common\model\Company;
2023-08-10 17:10:12 +08:00
use app\common\model\task\Task;
use app\common\model\task_scheduling_plan\TaskSchedulingPlan;
2023-08-18 16:32:41 +08:00
use app\common\model\task_template\TaskTemplate;
2023-08-14 17:44:55 +08:00
use think\facade\Log;
2023-08-15 14:38:20 +08:00
use app\job\TaskInformationJob;
2023-08-21 15:14:39 +08:00
use Symfony\Component\HttpClient\HttpClient;
2023-08-10 17:10:12 +08:00
class CeshiController extends BaseApiController
{
2023-08-22 14:32:57 +08:00
public array $notNeedLogin = ['index','ceshi','ceshi1','ceshi2'];
2023-08-10 17:10:12 +08:00
2023-08-24 13:42:45 +08:00
/**
* 任务结算
*/
2023-08-10 17:10:12 +08:00
public function index()
{
2023-08-18 17:29:51 +08:00
// $all=TaskSchedulingPlan::whereDay('end_time','yesterday')->where('is_pay',0)->with(['template_info','scheduling'])->select()->toArray();
// halt($all);
2023-08-18 18:11:32 +08:00
$all=TaskSchedulingPlan::whereDay('end_time')->where('is_pay',0)->with(['template_info','scheduling'])->select()->toArray();
2023-08-15 14:38:20 +08:00
foreach($all as $k=>$v){
queue(TaskInformationJob::class,$v);
}
halt(1);
2023-08-10 17:10:12 +08:00
}
2023-08-24 13:42:45 +08:00
/**
* 任务刷新
*/
2023-08-10 17:10:12 +08:00
public function ceshi(){
2023-08-18 16:32:41 +08:00
2023-08-10 17:10:12 +08:00
$time=strtotime(date('Y-m-d'));
2023-08-21 15:14:39 +08:00
// $time=strtotime(date('Y-m-d'));
2023-08-24 13:42:45 +08:00
// $tiem_end=$time+86399;where('cron_time','<',$time)->
$all=TaskTemplate::where('status',1)->with('company')->select()->toArray();
2023-08-22 10:36:56 +08:00
// $all=TaskTemplate::where('id',73)->with('company')->select()->toArray();
2023-08-21 15:14:39 +08:00
// $all=TaskSchedulingPlan::where('start_time','between',[$time,$tiem_end])->where('is_execute',0)->with(['template_info','scheduling'])->select()->toArray();
2023-08-24 14:29:54 +08:00
$company_id=[];
2023-08-10 17:10:12 +08:00
foreach($all as $k=>$v){
2023-08-25 16:45:04 +08:00
TaskLogic::CronAdd($v);
2023-08-24 14:29:54 +08:00
$company_id[]=$v['company_id'];
2023-08-14 17:44:55 +08:00
}
2023-08-24 14:29:54 +08:00
$arr=array_unique($company_id);
if(count($arr)){
Company::where('id','in',$arr)->inc('day_count')->update();
2023-08-24 14:14:28 +08:00
}
2023-08-10 17:10:12 +08:00
}
2023-08-18 10:12:56 +08:00
2023-08-22 14:54:34 +08:00
//三轮车判断
2023-08-22 09:58:04 +08:00
public function ceshi1(){
$params=[
'car_id'=>3,
'start_time'=>'2023-08-18',
'end_time'=>'2023-08-18 23:59:59'
];
2023-08-22 10:36:56 +08:00
$task=Task::where('id',487)->select()->toArray();
2023-08-22 09:58:04 +08:00
foreach($task as $k=>$v){
2023-08-22 10:21:13 +08:00
if(isset($v['extend']['terminus']['lnglat'])&& isset($v['extend']['transfer']['lnglat'])){
2023-08-22 09:58:04 +08:00
$arr=$v['extend']['terminus']['lnglat'];
2023-08-22 10:36:56 +08:00
$a=app(RemoteController::class)->coordinate($params,$arr[0],$arr[1]);
2023-08-22 10:21:13 +08:00
$arr_two=$v['extend']['transfer']['lnglat'];
2023-08-22 10:36:56 +08:00
$b=app(RemoteController::class)->coordinate($params,$arr_two[0],$arr_two[1]);
if($a<500 && $b<500){
Task::where('id',$v['id'])->update(['status'=>3]);
}
2023-08-22 09:58:04 +08:00
}
2023-08-22 10:21:13 +08:00
2023-08-18 10:12:56 +08:00
}
}
2023-08-21 15:14:39 +08:00
// public function ceshi2(){
// $
// $b=app(RemoteController::class)->shang_date_list('');
2023-08-22 14:54:34 +08:00
// }
2023-08-22 14:32:57 +08:00
2023-08-10 17:10:12 +08:00
}