diff --git a/webapp/controller/FirstTopupController.class.php b/webapp/controller/FirstTopupController.class.php index b1dacdf6..6f4ff4af 100644 --- a/webapp/controller/FirstTopupController.class.php +++ b/webapp/controller/FirstTopupController.class.php @@ -39,7 +39,7 @@ class FirstTopupController extends BaseAuthedController ); } - public function begin() + private function begin() { $conn = myself()->_getMysql(''); diff --git a/webapp/controller/ShopController.class.php b/webapp/controller/ShopController.class.php index 39002d06..151f655d 100644 --- a/webapp/controller/ShopController.class.php +++ b/webapp/controller/ShopController.class.php @@ -680,16 +680,20 @@ class ShopController extends BaseAuthedController $this->_getNowTime() >= $priceInfo['discount_begin_time'] && $this->_getNowTime() <= $priceInfo['discount_end_time'] ) { - array_push($costItems, array( - 'item_id' => $val['item_id'], - 'item_num' => (int) ($val['item_num'] * ($priceInfo['discount'] / 100)), - ) + array_push( + $costItems, + array( + 'item_id' => $val['item_id'], + 'item_num' => (int) ($val['item_num'] * ($priceInfo['discount'] / 100)), + ) ); } else { - array_push($costItems, array( - 'item_id' => $val['item_id'], - 'item_num' => $val['item_num'], - ) + array_push( + $costItems, + array( + 'item_id' => $val['item_id'], + 'item_num' => $val['item_num'], + ) ); } }); @@ -728,6 +732,10 @@ class ShopController extends BaseAuthedController default: { Bag::addItem($itemMeta['id'], $count); $propertyChgService->addBagChg(); + // 充值就尝试开启首充活动 + if ($itemMeta['id'] == 10001) { + $this->beginFirstTupop(); + } } break; } @@ -773,4 +781,34 @@ class ShopController extends BaseAuthedController return true; } -} \ No newline at end of file + private function beginFirstTupop() + { + $conn = myself()->_getMysql(''); + + $exist = SqlHelper::selectOne( + $conn, + 't_first_topup', + array('account_id'), + array('account_id' => myself()->_getAccountId()) + ); + if ($exist) { + return; + } + + // 开始首充奖励活动进程 + $chk = SqlHelper::insert( + $conn, + 't_first_topup', + array( + 'account_id' => myself()->_getAccountId(), + 'createtime' => myself()->_getNowTime(), + 'status1' => 0, + 'status2' => 0, + 'status3' => 0, + ) + ); + if (!$chk) { + return; + } + } +}