request->param(); if (isset($parmas['type']) && $parmas['type'] != '') { switch ($parmas['type']) { case 'area': $type = 'area_id'; break; case 'street': $type = 'street_id'; break; default: return app('json')->fail('type:格式错误'); break; } } else { $type = 'street_id'; } if (!isset($parmas['start_time']) || $parmas['start_time'] == '') { return app('json')->fail('start_time:格式错误'); } if (!isset($parmas['end_time']) || $parmas['end_time'] == '') { return app('json')->fail('end_time:格式错误'); } $where[]=['create_time','between time',[date("Y-m-d H:i:s",$parmas['start_time']),date("Y-m-d H:i:s",$parmas['end_time'])]]; if (isset($parmas['responsible_area']) && $parmas['responsible_area'] != '') { $where[] = [$type,'in',explode(',', $parmas['responsible_area'])]; } $where[]=['is_del','=',0]; $where[]=['status','=',1]; $count=Db::name('merchant')->where($where)->count(); return app('json')->success(['count'=>$count]); } /** * 商户商品数量查询 */ public function SupplyChainProductCount() { $parmas = $this->request->param(); if (!isset($parmas['start_time']) || $parmas['start_time'] == '') { return app('json')->fail('start_time:格式错误'); } if (!isset($parmas['end_time']) || $parmas['end_time'] == '') { return app('json')->fail('end_time:格式错误'); } if (!isset($parmas['mer_intention_id']) || $parmas['mer_intention_id'] == '') { return app('json')->fail('mer_intention_id:格式错误'); } $where[]=['create_time','between time',[date("Y-m-d H:i:s",$parmas['start_time']),date("Y-m-d H:i:s",$parmas['end_time'])]]; $where[] = ['mer_id','=',$parmas['mer_intention_id']]; $where[]=['mer_status','=',1]; $where[]=['status','=',1]; $where[]=['is_used','=',1]; $where[]=['is_show','=',1]; $count=Db::name('store_product')->where($where)->count(); return app('json')->success(['count'=>$count]); } /** * 商户商品库存更新查询 */ public function SupplyChainProductStockCount() { $parmas = $this->request->param(); if (!isset($parmas['start_time']) || $parmas['start_time'] == '') { return app('json')->fail('start_time:格式错误'); } if (!isset($parmas['end_time']) || $parmas['end_time'] == '') { return app('json')->fail('end_time:格式错误'); } if (!isset($parmas['mer_intention_id']) || $parmas['mer_intention_id'] == '') { return app('json')->fail('mer_intention_id:格式错误'); } $where[]=['create_time','between time',[date("Y-m-d H:i:s",$parmas['start_time']),date("Y-m-d H:i:s",$parmas['end_time'])]]; $where[] = ['mer_id','=',$parmas['mer_intention_id']]; $count=Db::name('store_product_stock')->where($where)->count(); return app('json')->success(['count'=>$count]); } /** * 商品列表 */ public function ProductList(){ $parmas = $this->request->param(); if (!isset($parmas['page']) || $parmas['page'] == '') { return app('json')->fail('page:格式错误'); } $where[]=['mer_status','=',1]; $where[]=['status','=',1]; $where[]=['is_used','=',1]; $where[]=['is_show','=',1]; if (isset($parmas['keyword']) &&$parmas['keyword'] != '') { $where[] = ['store_name','like','%'.$parmas['keyword'].'%']; } $list=Db::name('store_product')->where($where)->page($parmas['page']) ->field('product_id,store_name,image,price') ->limit(10)->select(); return app('json')->success(['page'=>$parmas['page'],'data'=>$list]); } }