diff --git a/app/controller/api/Statistics.php b/app/controller/api/Statistics.php index 484ed87a..3651afe5 100644 --- a/app/controller/api/Statistics.php +++ b/app/controller/api/Statistics.php @@ -425,7 +425,7 @@ class Statistics extends BaseController } /** - * 采购金额和销售金额 + * 镇级供应链采购金额和销售金额 */ public function SupplyChainProductPrice() { @@ -443,7 +443,39 @@ class Statistics extends BaseController $where[] = ['p.source', '=', 0]; } $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(); + } + $mer_id = $merchant['mer_id']; + $where[] = ['p.is_refund', '=', 0]; + $count = Db::name('store_order_product')->alias('p') + ->where($where) + ->join('store_order o', 'o.mer_id=' . $mer_id . ' and o.paid=1 and o.is_del=0') + ->sum('p.total_price'); + $merName = $merchant['mer_name']; + return app('json')->success(compact('merName', 'count')); + } + + /** + * 一般商户采购金额和销售金额 + */ + public function GeneralProductPrice() + { + $parmas = $this->request->param(); + if (isset($parmas['type']) && $parmas['type'] != '') { + switch ($parmas['type']) { + case 200: + $where[] = ['p.source', '=', 200]; + break; + case 300: + $where[] = ['p.source', '=', 0]; + break; + } + } else { + $where[] = ['p.source', '=', 0]; + } + $merchant = Merchant::where('mer_intention_id', $parmas['mer_intention_id'])->find(); + if (empty($merchant) || $merchant['type_id'] != 10) { return app('json')->success(); } $mer_id = $merchant['mer_id']; diff --git a/route/api.php b/route/api.php index 4155f31f..db68d84b 100644 --- a/route/api.php +++ b/route/api.php @@ -745,6 +745,7 @@ Route::group('api/', function () { Route::get('supply_chain_product_stock_count1', '/SupplyChainProductStockCount1'); Route::get('product_stock_count1', '/ProductStockCount1'); Route::get('supply_chain_product_price', '/SupplyChainProductPrice'); + Route::get('general_product_price', '/GeneralProductPrice'); })->prefix('api.Statistics'); //滑块验证码