正在显示
1 个修改的文件
包含
12 行增加
和
4 行删除
| @@ -25,16 +25,24 @@ class DetailController extends BaseController | @@ -25,16 +25,24 @@ class DetailController extends BaseController | ||
| 25 | * @method :post | 25 | * @method :post |
| 26 | * @time :2024/11/13 9:53 | 26 | * @time :2024/11/13 9:53 |
| 27 | */ | 27 | */ |
| 28 | - public function getDetail(Detail $detail){ | 28 | + public function getDetail(Detail $detail,Column $column){ |
| 29 | $this->request->validate([ | 29 | $this->request->validate([ |
| 30 | 'product_id'=>'required', | 30 | 'product_id'=>'required', |
| 31 | - 'column_id'=>'required' | ||
| 32 | ],[ | 31 | ],[ |
| 33 | 'product_id.required' => '产品id不能为空', | 32 | 'product_id.required' => '产品id不能为空', |
| 34 | - 'column_id.required' => '栏目id不能为空', | ||
| 35 | ]); | 33 | ]); |
| 36 | $data = $detail->list($this->map,'sort',['*'],'asc'); | 34 | $data = $detail->list($this->map,'sort',['*'],'asc'); |
| 37 | - $this->response('success',Code::SUCCESS,$data); | 35 | + $data_column = $column->list([],'id',['*'],'asc'); |
| 36 | + if(!empty($data_column) && !empty($data)){ | ||
| 37 | + foreach ($data_column as $k => $v){ | ||
| 38 | + foreach ($data as $k1 => $v1){ | ||
| 39 | + if($v['id'] == $v1['column_id']){ | ||
| 40 | + $data_column[$k]['data'][] = $v1; | ||
| 41 | + } | ||
| 42 | + } | ||
| 43 | + } | ||
| 44 | + } | ||
| 45 | + $this->response('success',Code::SUCCESS,$data_column); | ||
| 38 | } | 46 | } |
| 39 | 47 | ||
| 40 | /** | 48 | /** |
-
请 注册 或 登录 后发表评论