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'); //滑块验证码