where('user_id', $this->userinfo['id']) ->field('type,count(id) as count') ->group('type') ->select(); $this->success('ok', $data); } //库存统计 public function statistics(StockConfig $stockConfig) { $list = $stockConfig->alias('a')->where('a.status', $stockConfig::StatusNormal) ->leftjoin('stock_detail b', 'a.id = b.key') ->field('a.id, a.type_id,a.title,b.num') ->select(); dump($list->toArray());die;// StockConfig::Status::NORMAL $this->success('ok', $list); } /** * @return void 全部平台 */ public function getPlatform() { $list = site_config('addonsd.platform_list'); $this->success('提交成功', $list); } //获取店铺 public function getShop(ShopList $shopList){ $platform_id = $this->request->post('platform_id/d'); if(empty($platform_id)){ $this->error('参数有误'); } return $this->success('ok', $shopList->where('platform', $platform_id)->column('name', 'id')); } //获取规格 public function getSpec(ShopList $shopList){ $shop_id = $this->request->post('shop_id/d'); if( empty($shop_id)){ $this->error('参数有误'); } $spec = $shopList->where('id', $shop_id)->value('type_spec'); $shopList = $spec?json_decode($spec, true): []; return $this->success('ok', $shopList); } }