app/Http/Controller/AdminApi/ 中的接收数据处理
//搜索的字段接收
protected function getSearchField(): array
{
return [
['name', '', 'name_like'],
['types', '', 'type_name'],
['type_id', ''],
['level', ''],
['pid', ''],
['status', ''],
['isCityShow', ''],
];
}
//亲增,修改,保存数据接收
protected function getRequestFields(): array
{
return [
['name', ''],
['value', ''],
['type_id', 0],
['pid', ''],
['sort', 0],
['color', ''],
['status', 1],
['mark', ''],
];
}
使用
$where = $this->request->getMore($this->getSearchField());
或
$where = $this->request->getMore([
['pid', ''],
['title', ''],
['uid', $this->uuid],
]);
还有这种写法
$this->service->resourceUpdate($id, $this->request->postMore($this->getRequestFields()));
也是能传数据传入进去