充值天数活动
This commit is contained in:
parent
40d4bfb057
commit
53ea4022c7
@ -105,6 +105,7 @@ define('DIAMONDLOTTERY_TIME', 188); //每日消耗钻石抽奖次数
|
|||||||
define('MEDAL_LIMIT', 189); //体力自然增长上限
|
define('MEDAL_LIMIT', 189); //体力自然增长上限
|
||||||
define('MEDAL_SECONDS', 190); //自然增长一点体力耗时,单位秒
|
define('MEDAL_SECONDS', 190); //自然增长一点体力耗时,单位秒
|
||||||
define('OFFLINE_LIMIT', 191); //离线时长上限,单位小时
|
define('OFFLINE_LIMIT', 191); //离线时长上限,单位小时
|
||||||
|
define('RECHARGE_TARGET', 198); //连续充值天数的每日达标金额(元)
|
||||||
|
|
||||||
require 'config_loader.php';
|
require 'config_loader.php';
|
||||||
|
|
||||||
|
@ -76,6 +76,8 @@ class RechargeActivity
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$nowTime = time();
|
$nowTime = time();
|
||||||
|
$todaysecs = phpcommon\getdayseconds($nowTime);
|
||||||
|
$daysumtarget = metatable\getParameterById(RECHARGE_TARGET) * 10;
|
||||||
foreach ($activityconf as $itemconf) {
|
foreach ($activityconf as $itemconf) {
|
||||||
if ($nowTime < strtotime($itemconf['time1']) || $nowTime > strtotime($itemconf['time2'])) {
|
if ($nowTime < strtotime($itemconf['time1']) || $nowTime > strtotime($itemconf['time2'])) {
|
||||||
continue;
|
continue;
|
||||||
@ -93,7 +95,7 @@ class RechargeActivity
|
|||||||
|
|
||||||
$found = true;
|
$found = true;
|
||||||
if ($itemconf['type'] == 3) {
|
if ($itemconf['type'] == 3) {
|
||||||
if ($item['time'] < phpcommon\getdayseconds($nowTime)) {
|
if ($item['time'] < $todaysecs) {
|
||||||
$activity[$key]['cur'] = $num;
|
$activity[$key]['cur'] = $num;
|
||||||
$activity[$key]['award'] = 0;
|
$activity[$key]['award'] = 0;
|
||||||
} else {
|
} else {
|
||||||
@ -104,6 +106,23 @@ class RechargeActivity
|
|||||||
$activity[$key]['cur'] += $num;
|
$activity[$key]['cur'] += $num;
|
||||||
}
|
}
|
||||||
$activity[$key]['time'] = $nowTime;
|
$activity[$key]['time'] = $nowTime;
|
||||||
|
}
|
||||||
|
if ($itemconf['type'] == 4) {
|
||||||
|
if ($item['time'] > 0 || $item['cur'] >= $item['target'] || $item['update_cur_time'] >= $todaysecs) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($item['recharge_time'] < $todaysecs) {
|
||||||
|
$activity[$key]['recharge_sum'] = $num;
|
||||||
|
} else {
|
||||||
|
$activity[$key]['recharge_sum'] += $num;
|
||||||
|
}
|
||||||
|
$activity[$key]['recharge_time'] = $nowTime;
|
||||||
|
|
||||||
|
if ($daysumtarget <= $activity[$key]['recharge_sum']) {
|
||||||
|
$activity[$key]['cur']++;
|
||||||
|
$activity[$key]['update_cur_time'] = $nowTime;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if ($item['cur'] >= $item['target']) {
|
if ($item['cur'] >= $item['target']) {
|
||||||
break;
|
break;
|
||||||
@ -119,6 +138,18 @@ class RechargeActivity
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!$found) {
|
if (!$found) {
|
||||||
|
$item = array();
|
||||||
|
if ($itemconf['type'] == 4) {
|
||||||
|
$item = array(
|
||||||
|
'id' => $itemconf['shop_id'],
|
||||||
|
'cur' => $num < $daysumtarget ? 0 : 1,
|
||||||
|
'target' => $itemconf['target'],
|
||||||
|
'time' => 0,
|
||||||
|
"recharge_sum" => $num, //当天充值总额
|
||||||
|
"recharge_time" => $nowTime, //最近充值时间戳
|
||||||
|
"update_cur_time" => $num < $daysumtarget ? 0 : $nowTime, //最近更新cur时间戳
|
||||||
|
);
|
||||||
|
} else {
|
||||||
$item = array(
|
$item = array(
|
||||||
'id' => $itemconf['shop_id'],
|
'id' => $itemconf['shop_id'],
|
||||||
'cur' => $num,
|
'cur' => $num,
|
||||||
@ -134,6 +165,7 @@ class RechargeActivity
|
|||||||
$item['time'] = $nowTime;
|
$item['time'] = $nowTime;
|
||||||
$item['award'] = 0;
|
$item['award'] = 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
array_push($activity, $item);
|
array_push($activity, $item);
|
||||||
}
|
}
|
||||||
|
@ -126,6 +126,7 @@ trait RechargeActivity
|
|||||||
switch ($itemconf['type']) {
|
switch ($itemconf['type']) {
|
||||||
case 1: //累积充值
|
case 1: //累积充值
|
||||||
case 2: //累计消耗
|
case 2: //累计消耗
|
||||||
|
case 4: //充值达标天数
|
||||||
$itemarray = array(
|
$itemarray = array(
|
||||||
'id' => $item['id'],
|
'id' => $item['id'],
|
||||||
'cur' => $item['cur'],
|
'cur' => $item['cur'],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user