fix:作品类型列表接口修改
This commit is contained in:
parent
6dab590f4c
commit
bf4f98acd8
@ -29,12 +29,17 @@ class WorksType extends BaseController
|
||||
*/
|
||||
public function getWorksTypeList(Request $request):array
|
||||
{
|
||||
$con = Tool::getOptionalQuery(
|
||||
['b.works_type_delete_time', 'NULL'],
|
||||
['a.works_type_name', 'LIKE']
|
||||
);
|
||||
$con = Tool::getOptionalQuery(['works_type_name', 'LIKE']);
|
||||
$con[] = ['works_type_parent_guid', '=', "0"];
|
||||
$works_type_guids = self::pageWrapper(ModelWorksType::where($con))
|
||||
->order('works_type_order')
|
||||
->column('works_type_guid');
|
||||
|
||||
$works_type = ModelWorksType::where($con)
|
||||
$works_type = ModelWorksType::whereOr([
|
||||
[["a.works_type_guid", 'in', $works_type_guids]],
|
||||
[["a.works_type_ancestors_guid", 'REGEXP', implode('|', $works_type_guids)]],
|
||||
])
|
||||
->where([['b.works_type_delete_time', 'NULL', null]])
|
||||
->field([
|
||||
'a.works_type_id',
|
||||
'a.works_type_guid',
|
||||
@ -43,8 +48,7 @@ class WorksType extends BaseController
|
||||
'a.works_type_parent_guid',
|
||||
'a.works_type_ancestors_guid',
|
||||
'b.works_type_name' => "works_type_parent_name",
|
||||
])
|
||||
->alias('a')
|
||||
])->alias('a')
|
||||
->leftjoin('works_type b', 'a.works_type_parent_guid = b.works_type_guid')
|
||||
->order('works_type_order')
|
||||
->select()
|
||||
@ -62,7 +66,10 @@ class WorksType extends BaseController
|
||||
];
|
||||
});
|
||||
|
||||
return msg("获取作品类型列表成功!", $works_type_tree);
|
||||
return msg(0, "获取作品类型列表成功!", [
|
||||
'data' => $works_type_tree,
|
||||
'count' => ModelWorksType::where('works_type_parent_guid', '0')->count()
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user