fix: 修改作品接口
This commit is contained in:
parent
a2bd1d16ee
commit
9a6fd702a1
@ -27,13 +27,25 @@ class Works extends BaseController
|
|||||||
* @author xjh
|
* @author xjh
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public function getWorksList(Request $request): array
|
public function getWorksList(Request $request)
|
||||||
{
|
{
|
||||||
$params = $request->param();
|
$params = $request->param();
|
||||||
$this->validate($params, [
|
$this->validate($params, [
|
||||||
'works_type_id|作品类型id' => 'require',
|
'idx|索引值' => 'require',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
$work_type = ModelWorksType::field(['works_type_name' => 'name', 'works_type_id'])
|
||||||
|
->where('works_type_parent_guid', "0")
|
||||||
|
->order('works_type_order')
|
||||||
|
->select();
|
||||||
|
|
||||||
|
$params['works_type_id'] = null;
|
||||||
|
foreach ($work_type as $key => $value) {
|
||||||
|
if ($key == $params['idx']) {
|
||||||
|
$params['works_type_id'] = $value['works_type_id'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$works_type = ModelWorksType::where('works_type_id', $params['works_type_id'])->find();
|
$works_type = ModelWorksType::where('works_type_id', $params['works_type_id'])->find();
|
||||||
if (!$works_type) throwErrorMsg('该作品类型不存在!');
|
if (!$works_type) throwErrorMsg('该作品类型不存在!');
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user