logistics/app/api/logic/VehicleLogic.php

54 lines
2.0 KiB
PHP
Raw Normal View History

2023-08-19 13:30:28 +08:00
<?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\logic;
use app\common\logic\BaseLogic;
2023-08-21 12:00:22 +08:00
use app\common\model\vehicle\Company;
2023-08-19 13:30:28 +08:00
use app\common\model\vehicle\Vehicle;
2023-08-21 12:00:22 +08:00
2023-08-19 13:30:28 +08:00
/**
* 车辆逻辑
* Class VehicleLogic
* @package app\api\logic
*/
class VehicleLogic extends BaseLogic
{
2023-08-21 12:00:22 +08:00
/**
* 获取未出租的车辆列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public static function lists($params):array {
$offset = !empty($params['page_no']) ? $params['page_no'] : 1;
$length = !empty($params['page_size']) ? $params['page_size'] : 15;
return Vehicle::field('id,license,gps_imei')->where('status',0)->where('is_del',0)->order('create_time desc')->page($offset, $length)->select()->toArray();
}
2023-08-19 13:30:28 +08:00
2023-08-21 12:00:22 +08:00
public static function oneLevelRent($params):array {
//获取承租公司信息
$company = Company::where('id',$params['company_id'])->find();
//验证公司信息
if(!$company){
return ['code'=>0,'msg'=>'未找到承租公司'];
}
$ids = explode(',',$params['tricycle_ids']);
dump($company['company_name'],$ids);
}
2023-08-19 13:30:28 +08:00
}