|
@@ -12,7 +12,6 @@ namespace Modules\Statistic\Services;
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
use Illuminate\Support\Facades\Redis;
|
|
|
use Modules\Common\Services\BaseService;
|
|
|
-use Modules\User\Http\Controllers\UserTrait;
|
|
|
|
|
|
class UserStatisticsService extends BaseService
|
|
|
{
|
|
@@ -34,7 +33,6 @@ class UserStatisticsService extends BaseService
|
|
|
public static function getTodayData($accountId, $miniProgramId, $type = 1)
|
|
|
{
|
|
|
$date = date("Y-m-d");
|
|
|
- // $date = '2023-05-31';
|
|
|
$key = sprintf(self::PROMOTION_STATISTIC_RECORD_REDIS_KEY, $date, $miniProgramId);
|
|
|
$new_user_recharge_total = self::getValue($key, sprintf(self::NEW_USER_RECHARGE_TOTAL, $accountId)); // 当日新增用户充值总额
|
|
|
$new_user_recharge_num = self::getValue($key, sprintf(self::NEW_USER_RECHARGE_NUM, $accountId)); // 当日新增用户充值人数
|
|
@@ -50,7 +48,7 @@ class UserStatisticsService extends BaseService
|
|
|
'recharge_coin_num' => $recharge_coin_num ?: 0,
|
|
|
'recharge_vip_num' => $recharge_vip_num ?: 0,
|
|
|
];
|
|
|
-
|
|
|
+
|
|
|
if ($new_user_num > 0 && $new_user_recharge_num > 0) {
|
|
|
$data['recharge_rate'] = sprintf('%.2f%', ($new_user_recharge_num / $new_user_num) * 100);
|
|
|
} else {
|
|
@@ -90,8 +88,6 @@ class UserStatisticsService extends BaseService
|
|
|
{
|
|
|
$start = date("Y-m-d") . " 00:00:00";
|
|
|
$end = date("Y-m-d") . " 23:59:59";
|
|
|
- // $start = "2023-05-31 00:00:00";
|
|
|
- // $end = "2023-05-31 23:59:59";
|
|
|
if ($type == 2) {
|
|
|
// 投放公司
|
|
|
$recharge_coin_num = DB::table('orders')->where('status', "<>", 'UNPAID')
|