From 120b24ca99ea6b212a52a39d70a151deaad2ae9f Mon Sep 17 00:00:00 2001 From: chenbo <709206448@qq.com> Date: Tue, 26 Dec 2023 13:49:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=99=AE=E9=80=9A=E5=95=86=E6=88=B7=E9=87=87?= =?UTF-8?q?=E8=B4=AD/=E9=94=80=E5=94=AE=E9=A2=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/api/Statistics.php | 36 +++++++++++++++++++++++++++++-- route/api.php | 1 + 2 files changed, 35 insertions(+), 2 deletions(-) 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'); //滑块验证码