logistics/app/api/controller/VehicleController.php
2023-08-21 12:00:22 +08:00

63 lines
2.2 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\api\controller;
use app\api\logic\VehicleLogic;
/**
* 车辆管理
* Class VehicleController
* @package app\api\controller
*/
class VehicleController extends BaseApiController
{
public array $notNeedLogin = ['tricycle','multipleRent'];
/*
* 获取去未出租的三轮车列表
*/
public function tricycle() {
//获取参数
$params = $this->request->get(['page_no','page_size']);
//获取数据
$data = VehicleLogic::lists($params);
//返回数据
return $this->success('请求成功',$data);
}
/*
* 三轮车批量出租
*/
public function multipleRent() {
//获取参数
$params = $this->request->post(['company_id','tricycle_ids','start_time','end_time']);
//验证参数
if(empty($params['company_id']) || empty($params['tricycle_ids']) || empty($params['start_time']) || empty($params['end_time'])) {
return $this->fail('缺少必要参数');
}
if(!checkDateIsValid($params['start_time']) || !checkDateIsValid($params['end_time'])){
return $this->fail('时间格式错误');
}
//写入数据
$result = VehicleLogic::oneLevelRent($params);
//返回结果
if($result['code'] == 1){
return $this->success('操作成功');
}else{
return $this->fail($result['msg']);
}
}
}