add 新供销用户邀请信息统计

This commit is contained in:
chenbo 2024-01-12 11:15:56 +08:00
parent 657a990003
commit 5eb6e64cd2
2 changed files with 23 additions and 0 deletions

View File

@ -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);
}
}

View File

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