This commit is contained in:
mkm 2023-08-24 16:08:13 +08:00
parent 987db0ca5f
commit d3a0bcfd93
2 changed files with 19 additions and 3 deletions

View File

@ -4,6 +4,7 @@ namespace app\api\controller;
use app\common\logic\task\TaskLogic; use app\common\logic\task\TaskLogic;
use app\common\model\Company; use app\common\model\Company;
use app\common\model\company\CompanyProperty;
use app\common\model\informationg\UserInformationg; use app\common\model\informationg\UserInformationg;
use app\common\model\task\Task; use app\common\model\task\Task;
use app\common\model\user\User; use app\common\model\user\User;
@ -100,10 +101,17 @@ class TaskController extends BaseApiController
{ {
$parmas = $this->request->param(); $parmas = $this->request->param();
$task = Task::where('id', $parmas['id'])->find()->toArray(); $task = Task::where('id', $parmas['id'])->find()->toArray();
$object_id=CompanyProperty::where('company_id',$this->userInfo['company_id'])->value('object_id');
if(!$object_id){
return $this->fail('该公司没有三轮车,请先租赁三轮车');
}
$start_time = date('Y-m-d');
$time=strtotime($start_time)+86399;
$end_time=date('Y-m-d H:i:s',$time);
$datas=[ $datas=[
'car_id'=>3, 'car_id'=>$object_id,
'start_time'=>'2023-08-18', 'start_time'=>$start_time,
'end_time'=>'2023-08-18 23:59:59' 'end_time'=>$end_time
]; ];
$data['status'] = 2; $data['status'] = 2;
if (isset($parmas['terminus'])) { if (isset($parmas['terminus'])) {

View File

@ -17,6 +17,7 @@ namespace app\common\logic\task_template;
use app\common\model\task_template\TaskTemplate; use app\common\model\task_template\TaskTemplate;
use app\common\logic\BaseLogic; use app\common\logic\BaseLogic;
use app\common\model\company\CompanyProperty;
use app\common\model\informationg\UserInformationg; use app\common\model\informationg\UserInformationg;
use app\common\model\task_scheduling\TaskScheduling; use app\common\model\task_scheduling\TaskScheduling;
use think\facade\Db; use think\facade\Db;
@ -90,6 +91,13 @@ class TaskTemplateLogic extends BaseLogic
self::setError('任务模板合计金额不能大于任务调度金额'); self::setError('任务模板合计金额不能大于任务调度金额');
return false; return false;
} }
if($params['type']==32){
$object_id=CompanyProperty::where('company_id',$params['company_id'])->value('object_id');
if(!$object_id){
return self::setError('该公司没有三轮车,请先租赁三轮车');
}
}
TaskTemplate::create([ TaskTemplate::create([
'title' => $params['title'], 'title' => $params['title'],
'admin_id' => $params['admin_id'], 'admin_id' => $params['admin_id'],