no message
This commit is contained in:
parent
fa0f028bae
commit
691211dc8d
@ -107,47 +107,47 @@ final class Cron
|
||||
$aRegMix[$sFrom]['count'] = $row['count'];
|
||||
}
|
||||
|
||||
//// 付款 start
|
||||
$aOrder = Order::whereBetween("update_time", [$sPrevTimeStart, $sPrevTimeEnd])->where("status", "activated")->get()->toArray();
|
||||
|
||||
$aOrder = Order::whereBetween("update_time", [$sPrevTimeStart, $sPrevTimeEnd])
|
||||
->where("status", "activated")
|
||||
->get()
|
||||
->toArray();
|
||||
|
||||
// 标记是否是新用户
|
||||
$oUserModel = new User();
|
||||
$iPayCount = 0;
|
||||
$iMoneyCount = 0;
|
||||
$iPayCountNew = 0;
|
||||
$iPayCountOld = 0;
|
||||
$iMoneyCountNew = 0;
|
||||
$iMoneyCountOld = 0;
|
||||
$sFrom = '';
|
||||
$aUserMix = [];
|
||||
|
||||
foreach ($aOrder as $row) {
|
||||
|
||||
$iPayCount ++;
|
||||
$iMoneyCount += $row["price"];
|
||||
|
||||
$oUser = $oUserModel->where("id", $row["id"])->first();
|
||||
$oUser = $oUserModel->where("id", $row["user_id"])->first();
|
||||
|
||||
if (isset($oUser->from)) {
|
||||
$sFrom = $oUser->from;
|
||||
} else {
|
||||
$sFrom = "无";
|
||||
}
|
||||
|
||||
if ( ($row['update_time'] - strtotime($oUser->reg_date)) < (86400 * 30) ) {
|
||||
$iPayCountNew ++;
|
||||
$iMoneyCountNew += $row["price"];
|
||||
} else {
|
||||
$iPayCountOld ++;
|
||||
$iMoneyCountOld += $row["price"];
|
||||
|
||||
// 初始化用户数据
|
||||
if (!isset($aUserMix[$sFrom])) {
|
||||
$aUserMix[$sFrom] = [
|
||||
'pay_count_new' => 0,
|
||||
'money_count_new' => 0,
|
||||
'pay_count_old' => 0,
|
||||
'money_count_old' => 0,
|
||||
'pay_count' => 0,
|
||||
'money_count' => 0,
|
||||
];
|
||||
}
|
||||
|
||||
$aUserMix[$sFrom]['pay_count'] = $iPayCount;
|
||||
$aUserMix[$sFrom]['money_count'] = $iMoneyCount;
|
||||
$aUserMix[$sFrom]['pay_count_new'] = $iPayCountNew;
|
||||
$aUserMix[$sFrom]['pay_count_old'] = $iPayCountOld;
|
||||
$aUserMix[$sFrom]['money_count_new'] = $iMoneyCountNew;
|
||||
$aUserMix[$sFrom]['money_count_old'] = $iMoneyCountOld;
|
||||
|
||||
|
||||
// 确保时间比较的正确性
|
||||
if (isset($oUser->reg_date) && ($row['update_time'] - strtotime($oUser->reg_date)) < (86400 * 30)) {
|
||||
$aUserMix[$sFrom]['pay_count_new']++;
|
||||
$aUserMix[$sFrom]['money_count_new'] += $row["price"];
|
||||
} else {
|
||||
$aUserMix[$sFrom]['pay_count_old']++;
|
||||
$aUserMix[$sFrom]['money_count_old'] += $row["price"];
|
||||
}
|
||||
|
||||
$aUserMix[$sFrom]['pay_count']++;
|
||||
$aUserMix[$sFrom]['money_count'] += $row["price"];
|
||||
}
|
||||
|
||||
$aAllMix = array_merge($aVisitorMix, $aRegMix, $aUserMix);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user