From 5eb6e64cd2c80b2d6955f3675e891fc8526049b0 Mon Sep 17 00:00:00 2001 From: chenbo <709206448@qq.com> Date: Fri, 12 Jan 2024 11:15:56 +0800 Subject: [PATCH] =?UTF-8?q?add=20=E6=96=B0=E4=BE=9B=E9=94=80=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E9=82=80=E8=AF=B7=E4=BF=A1=E6=81=AF=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/api/Statistics.php | 22 ++++++++++++++++++++++ route/api.php | 1 + 2 files changed, 23 insertions(+) diff --git a/app/controller/api/Statistics.php b/app/controller/api/Statistics.php index 3651afe5..c4b91a7f 100644 --- a/app/controller/api/Statistics.php +++ b/app/controller/api/Statistics.php @@ -487,4 +487,26 @@ class Statistics extends BaseController $merName = $merchant['mer_name']; return app('json')->success(compact('merName', 'count')); } + + /** + * 新供销 查询邀请的 用户注册数 商户数 交易金额 + */ + public function InviteUserStatistics() + { + $parmas = $this->request->param(); + $promotionCode = $parmas['promotion_code']; + $datas = []; + // 用户注册数 + $datas['user_count'] = Db::name('user')->where('promotion_code', $promotionCode)->count(); + + $userIds = Db::name('user')->where('promotion_code', $promotionCode)->value('uid'); + + // 商户数 + $datas['merchant_count'] = Merchant::whereIn('uid', $userIds)->count(); + + // 交易金额 + $datas['trade_amount'] = Db::name('store_order')->whereIn('uid', $userIds)->where('paid', 1)->sum('pay_price'); + + return app('json')->success($datas); + } } diff --git a/route/api.php b/route/api.php index 3d0af1cc..b726a9b3 100644 --- a/route/api.php +++ b/route/api.php @@ -750,6 +750,7 @@ Route::group('api/', function () { Route::get('product_stock_count1', '/ProductStockCount1'); Route::get('supply_chain_product_price', '/SupplyChainProductPrice'); Route::get('general_product_price', '/GeneralProductPrice'); + Route::get('invite_user_statistics', '/InviteUserStatistics'); })->prefix('api.Statistics'); //滑块验证码