|
@@ -60,10 +60,12 @@ class Serve extends Controller
|
|
|
{
|
|
|
$this->clist = Db::name('StoreGoodsCate')->where(['is_deleted' => '0', 'status' => '1'])->select();
|
|
|
$list = Db::name('StoreGoodsList')->where('status', '1')->whereIn('goods_id', array_unique(array_column($data, 'id')))->select();
|
|
|
+ $cate_id_arr = Db::name('store_goods_cate')->column('title','id');
|
|
|
foreach ($data as &$vo) {
|
|
|
list($vo['list'], $vo['cate']) = [[], []];
|
|
|
foreach ($list as $goods) if ($goods['goods_id'] === $vo['id']) array_push($vo['list'], $goods);
|
|
|
foreach ($this->clist as $cate) if ($cate['id'] === $vo['cate_id']) $vo['cate'] = $cate;
|
|
|
+ $vo['cate_name'] = $cate_id_arr[$vo['cate_id']];
|
|
|
}
|
|
|
}
|
|
|
|