feat : driver

This commit is contained in:
2024-11-13 14:25:07 +08:00
parent 4145e082b0
commit 1077cdfcd8
7 changed files with 166 additions and 58 deletions

View File

@@ -54,14 +54,6 @@ class SiteService extends BaseService
#[Inject]
protected readonly Kitchen $kitchenModel;
/**
* 注入部门类
* @var AdminSection
*/
#[Inject]
protected readonly AdminSection $adminSectionModel;
/**
* @var int
*/
@@ -341,39 +333,4 @@ class SiteService extends BaseService
return $this->return->success('success',$res);
}
/**
* 司机列表
* @return array
*/
public function driverList(): array
{
$limit = $this->request->input('limit', 10);
$cityId = (int)$this->request->input('query_driver_city_id',0);
$name = $this->request->input('query_driver_name');
// $where[] = [
// ['is_del', '=', UserCode::IS_NO_DEL],
// ['status','=',UserCode::ENABLE],
// ['role_id','=',RoleCode::DRIVER]
// ];
$list = $this
->adminUserModel
->where('is_del',UserCode::IS_NO_DEL)
->where('status',UserCode::ENABLE)
->where('role_id',RoleCode::DRIVER)
->when($name, function ($query) use ($name) {
$query->where('name', 'like', "$name%");
})
->when($cityId > 0, function ($query) use ($cityId) {
$query->whereIn('section_id', $this->adminSectionModel->getIdsByCityId($cityId));
})
->when($id = $this->request->input('query_driver_id'), function ($query) use ($id) {
$query->where('id', $id);
})
->paginate($limit,['chinese_name','id','mobile','status'])->toArray();
return $this->return->success('success',$list);
}
}