diff --git a/app/controller/api/Statistics.php b/app/controller/api/Statistics.php index 92d7d63b..49b79706 100644 --- a/app/controller/api/Statistics.php +++ b/app/controller/api/Statistics.php @@ -63,8 +63,9 @@ class Statistics extends BaseController if (!isset($parmas['mer_intention_id']) || $parmas['mer_intention_id'] == '') { return app('json')->fail('mer_intention_id:格式错误'); } + $merchant = Merchant::where('mer_intention_id', $parmas['mer_intention_id'])->find(); $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_id', '=', $merchant['mer_id']]; $where[] = ['mer_status', '=', 1]; $where[] = ['status', '=', 1]; $where[] = ['is_used', '=', 1]; @@ -350,15 +351,35 @@ class Statistics extends BaseController return app('json')->success(compact('list')); } + + /** - * 商户商品数量查询 + * 镇级供应链商户商品数量查询 */ public function SupplyChainProduct() { $parmas = $this->request->param(); $merchant = Merchant::where('mer_intention_id', $parmas['mer_intention_id'])->find(); - if (empty($merchant) || $merchant['type_id'] == 17) { + if (empty($merchant) || $merchant['type_id'] != 17) { + return app('json')->success(); + } + $merchantName = $merchant['mer_name']; + $where[] = ['mer_id', '=', $merchant['mer_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(compact('count', 'merchantName')); + } + + public function GeneralMerchantProduct() + { + $parmas = $this->request->param(); + + $merchant = Merchant::where('mer_intention_id', $parmas['mer_intention_id'])->find(); + if (empty($merchant) || $merchant['type_id'] != 10) { return app('json')->success(); } $merchantName = $merchant['mer_name']; @@ -379,7 +400,7 @@ class Statistics extends BaseController $parmas = $this->request->param(); $merchant = Merchant::where('mer_intention_id', $parmas['mer_intention_id'])->find(); - if (empty($merchant) || $merchant['type_id'] == 17) { + if (empty($merchant) || $merchant['type_id'] != 17) { return app('json')->success(); } $where[] = ['mer_id', '=', $merchant['mer_id']]; diff --git a/route/api.php b/route/api.php index 04cf267c..ceacc3f7 100644 --- a/route/api.php +++ b/route/api.php @@ -741,6 +741,7 @@ Route::group('api/', function () { Route::get('supply_chain_merchant', '/SupplyChainMerchant'); Route::get('general_merchant', '/GeneralMerchant'); Route::get('supply_chain_product', '/SupplyChainProduct'); + Route::get('general_merchant_product', '/GeneralMerchantProduct'); Route::get('supply_chain_product_stock_count1', '/SupplyChainProductStockCount1'); Route::get('supply_chain_product_price', '/SupplyChainProductPrice'); })->prefix('api.Statistics');