From 932faec26dff4c7b33f0c16c7ca42429e72ece13 Mon Sep 17 00:00:00 2001 From: chenbo <709206448@qq.com> Date: Mon, 25 Dec 2023 17:38:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9F=A5=E9=95=87=E7=BA=A7=E4=BE=9B=E5=BA=94?= =?UTF-8?q?=E9=93=BE=20=E9=87=87=E8=B4=AD=E9=87=91=E9=A2=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/api/Statistics.php | 29 +++++++++++++++++++++++++++++ route/api.php | 1 + 2 files changed, 30 insertions(+) diff --git a/app/controller/api/Statistics.php b/app/controller/api/Statistics.php index c1c89d67..0024509b 100644 --- a/app/controller/api/Statistics.php +++ b/app/controller/api/Statistics.php @@ -372,4 +372,33 @@ class Statistics extends BaseController $count = Db::name('store_product_stock')->where($where)->count(); return app('json')->success(['count' => $count]); } + + /** + * 采购金额和销售金额 + */ + public function SupplyChainProductPrice() + { + $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]; + } + + $mer_id = Db::name('merchant_intention')->where('mer_intention_id', $parmas['mer_intention_id'])->value('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::where('mer_id', $mer_id)->value('mer_name'); + return app('json')->success(compact('merName', 'count')); + } } diff --git a/route/api.php b/route/api.php index 42a8c8f6..6c5c5b31 100644 --- a/route/api.php +++ b/route/api.php @@ -740,6 +740,7 @@ Route::group('api/', function () { Route::get('supply_chain_merchant', '/SupplyChainMerchant'); Route::get('supply_chain_product', '/SupplyChainProduct'); Route::get('supply_chain_product_stock_count1', '/SupplyChainProductStockCount1'); + Route::get('supply_chain_product_price', '/SupplyChainProductPrice'); })->prefix('api.Statistics'); //滑块验证码