adjust
This commit is contained in:
parent
527571146c
commit
8d795e1b6a
@ -511,41 +511,62 @@ class RechargeController
|
|||||||
|
|
||||||
$activityconf = metatable\getRechargeActivityConf();
|
$activityconf = metatable\getRechargeActivityConf();
|
||||||
$recharge_activity = array();
|
$recharge_activity = array();
|
||||||
|
$activity = array();
|
||||||
if ($rechargerow['activity'] != null && $rechargerow['activity'] != '') {
|
if ($rechargerow['activity'] != null && $rechargerow['activity'] != '') {
|
||||||
$activity = json_decode($rechargerow['activity']);
|
$activity = json_decode($rechargerow['activity']);
|
||||||
|
}
|
||||||
$needupdate = false;
|
$needupdate = false;
|
||||||
foreach ($activity as $key => $item) {
|
foreach ($activityconf as $key => $itemconf) {
|
||||||
$itemconf = $activityconf[$item['id']];
|
|
||||||
if (time() < strtotime($itemconf['time1']) || time() > strtotime($itemconf['time2'])) {
|
if (time() < strtotime($itemconf['time1']) || time() > strtotime($itemconf['time2'])) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$itemarray = array(
|
|
||||||
'id' => $item['id'],
|
$found = false;
|
||||||
'cur' => $item['cur'],
|
$itemarray = array();
|
||||||
'target' => $item['target'],
|
foreach ($activity as $itemkey => $item) {
|
||||||
'award' => ($item['time'] > 0 ? 1 : 0),
|
if ($itemconf['shop_id'] == $item['id']) {
|
||||||
);
|
$found = true;
|
||||||
|
|
||||||
switch ($itemconf['type']) {
|
switch ($itemconf['type']) {
|
||||||
case 1: //累积充值
|
case 1: //累积充值
|
||||||
case 2: //累计消耗
|
case 2: //累计消耗
|
||||||
array_push($recharge_activity, $itemarray);
|
$itemarray = array(
|
||||||
|
'id' => $item['id'],
|
||||||
|
'cur' => $item['cur'],
|
||||||
|
'target' => $item['target'],
|
||||||
|
'award' => $item['time'] > 0 ? 1 : 0,
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
case 3: //每日累积充值
|
case 3: //每日累积充值
|
||||||
$daysecs = phpcommon\getdayseconds(time());
|
$daysecs = phpcommon\getdayseconds(time());
|
||||||
|
$itemarray['id'] = $item['id'];
|
||||||
|
$itemarray['target'] = $item['target'];
|
||||||
if ($item['time'] < $daysecs) {
|
if ($item['time'] < $daysecs) {
|
||||||
$itemarray['cur'] = 0;
|
$itemarray['cur'] = 0;
|
||||||
$itemarray['award'] = 0;
|
$itemarray['award'] = 0;
|
||||||
$needupdate = true;
|
$needupdate = true;
|
||||||
$activity[$key]['cur'] = 0;
|
$activity[$itemkey]['cur'] = 0;
|
||||||
$activity[$key]['award'] = 0;
|
$activity[$itemkey]['award'] = 0;
|
||||||
} else {
|
} else {
|
||||||
|
$itemarray['cur'] = $item['cur'];
|
||||||
$itemarray['award'] = $item['award'];
|
$itemarray['award'] = $item['award'];
|
||||||
}
|
}
|
||||||
array_push($recharge_activity, $itemarray);
|
array_push($recharge_activity, $itemarray);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$found) {
|
||||||
|
$itemarray = array(
|
||||||
|
'id' => $itemconf['shop_id'],
|
||||||
|
'cur' => 0,
|
||||||
|
'target' => $itemconf['target'],
|
||||||
|
'award' => 0,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
array_push($recharge_activity, $itemarray);
|
||||||
|
}
|
||||||
|
|
||||||
if ($needupdate) {
|
if ($needupdate) {
|
||||||
$conn->execScript(
|
$conn->execScript(
|
||||||
@ -558,7 +579,6 @@ class RechargeController
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
echo json_encode(array(
|
echo json_encode(array(
|
||||||
'errcode' => 0,
|
'errcode' => 0,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user