wang hou sheng 11 months ago
parent 56dd086816
commit 04edca09b5
  1. 4
      app/api/controller/Goods.php
  2. 7
      app/api/service/Goods.php

@ -341,9 +341,7 @@ class Goods extends Controller
public function chartsGoodsJing(): Json public function chartsGoodsJing(): Json
{ {
$service = new GoodsService; $service = new GoodsService;
$storeid = request()->header()['storeid']; $goodsList = $service->chartsGoodsJing();
$goodsList = $service->chartsGoodsJing($storeid);
return $this->renderSuccess($goodsList); return $this->renderSuccess($goodsList);
} }

@ -224,15 +224,13 @@ class Goods extends GoodsService
} }
public function chartsGoodsJing($storeid): array public function chartsGoodsJing(): array
{ {
$model = new CategoryModel; $model = new CategoryModel;
$list = $model->where([ $list = $model->where([
'parent_id' => 0, 'parent_id' => 0,
'status' => 1, 'status' => 1,
'is_paihang' => 1, 'is_paihang' => 1,
'store_id' => $storeid
])->order('category_id desc')->select()->toArray(); ])->order('category_id desc')->select()->toArray();
$model = new GoodsModel; $model = new GoodsModel;
foreach ($list as &$v) { foreach ($list as &$v) {
@ -240,14 +238,11 @@ class Goods extends GoodsService
'status' => 10, 'status' => 10,
'is_delete' => 0, 'is_delete' => 0,
'paihang' => 1, 'paihang' => 1,
'store_id' => $storeid,
'categoryId' => $v['category_id'], 'categoryId' => $v['category_id'],
], 3); ], 3);
$list2 = $goodsList->toArray()['data']; $list2 = $goodsList->toArray()['data'];
$v['goods_list'] = $this->newFormatGoodsList($list2); $v['goods_list'] = $this->newFormatGoodsList($list2);
} }
return $list; return $list;
} }

Loading…
Cancel
Save