feat:material_category
This commit is contained in:
@@ -111,8 +111,22 @@ class MaterialCategoryService extends BaseService{
|
||||
->when($cityId > 0,function($query) use($cityId){
|
||||
$query->where('city_id',$cityId);
|
||||
})
|
||||
->where('is_del',MaterialCode::IS_NO_DEL)->get();
|
||||
->where('is_del',MaterialCode::IS_NO_DEL)->get()->toArray();
|
||||
|
||||
return $this->return->success('success',['list' => $list->toArray()]);
|
||||
$tree = [];
|
||||
$map = [];
|
||||
|
||||
foreach ($list as &$category) {
|
||||
$category['children'] = [];
|
||||
$map[$category['id']] = &$category;
|
||||
|
||||
if ($category['parent_id'] && isset($map[$category['parent_id']])) {
|
||||
$map[$category['parent_id']]['children'][] = &$category;
|
||||
} else {
|
||||
$tree[] = &$category;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->return->success('success',$tree);
|
||||
}
|
||||
}
|
||||
@@ -324,6 +324,11 @@ GET {{host}}/admin/material_category/findById?query_id=1
|
||||
Content-Type: application/x-www-form-urlencoded
|
||||
Authorization: Bearer {{admin_token}}
|
||||
|
||||
### 材料种类列表
|
||||
GET {{host}}/admin/material_category/list?query_city_id=1
|
||||
content-type: application/json
|
||||
Authorization: Bearer {{admin_token}}
|
||||
|
||||
### 材料列表
|
||||
GET {{host}}/admin/material/list?limit=10
|
||||
content-type: application/json
|
||||
|
||||
Reference in New Issue
Block a user