1
This commit is contained in:
parent
7290d5e3eb
commit
4b1e33d91a
@ -2,7 +2,7 @@
|
||||
|
||||
$g_conf_mysql_cluster = require('../config/game2005api.mysql.cluster.php');
|
||||
$g_conf_redis_cluster = require('../config/game2005api.redis.cluster.php');
|
||||
|
||||
$g_metatables = array();
|
||||
|
||||
function checkMysqlConfig()
|
||||
{
|
||||
@ -232,5 +232,14 @@ function getEquipUpgradeConfig($equipUp_table, $equipUp_id)
|
||||
return array_key_exists($equipUp_id, $equipUp_table) ? $equipUp_table[$equipUp_id] : null;
|
||||
}
|
||||
|
||||
function getMetaTable($tblName)
|
||||
{
|
||||
global $g_metatables;
|
||||
if (!array_key_exists($tblName, $g_metatables)) {
|
||||
$g_metatables[$tblName] = require(getResBaseDir() . $tblName);
|
||||
}
|
||||
return $g_metatables[$tblName];
|
||||
}
|
||||
|
||||
checkMysqlConfig();
|
||||
checkRedisConfig();
|
||||
|
@ -52,6 +52,26 @@ class PayActivityController extends BaseAuthedController {
|
||||
}
|
||||
}
|
||||
|
||||
private function saveData()
|
||||
{
|
||||
phpcommon\SqlHelper::insertOrUpdate
|
||||
($this->getSelfMysql(),
|
||||
'recharge_activity',
|
||||
array(
|
||||
'accountid' => $this->getAccountId()
|
||||
),
|
||||
array(
|
||||
'accountid' => $this->getAccountId(),
|
||||
'blobdata' => json_encode($this->data),
|
||||
'create_time' => $this->getNowTime(),
|
||||
'modify_time' => $this->getNowTime()
|
||||
),
|
||||
array(
|
||||
'blobdata' => json_encode($this->data),
|
||||
'modify_time' => $this->getNowTime()
|
||||
));
|
||||
}
|
||||
|
||||
function getExplode($string)
|
||||
{
|
||||
$delim = "|";
|
||||
@ -65,48 +85,15 @@ class PayActivityController extends BaseAuthedController {
|
||||
return $arr;
|
||||
}
|
||||
|
||||
protected function saveRecActDB($account_id, $rec_db) {
|
||||
$conn = $this->getMysql($account_id);
|
||||
$row = $conn->execQueryOne('SELECT accountid FROM recharge_activity WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id
|
||||
));
|
||||
$rec_db_str = "";
|
||||
if (!empty($rec_db)) {
|
||||
$rec_db_str = json_encode($rec_db);
|
||||
}
|
||||
if (!empty($row)) {
|
||||
//update
|
||||
$row = $conn->execScript('UPDATE recharge_activity SET blobdata=:blobdata, modify_time=:modify_time WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':blobdata' => $rec_db_str,
|
||||
':modify_time' => phpcommon\getNowTime()
|
||||
));
|
||||
} else {
|
||||
//insert
|
||||
$row = $conn->execScript('INSERT INTO recharge_activity(accountid, blobdata, create_time, modify_time) ' .
|
||||
' VALUES(:account_id, :blobdata, :create_time, :modify_time) ' .
|
||||
' ON DUPLICATE KEY UPDATE accountid=:account_id, blobdata=:blobdata, modify_time=:modify_time;',
|
||||
array(
|
||||
':account_id' => $account_id,
|
||||
':blobdata' => $rec_db_str,
|
||||
':create_time' => phpcommon\getNowTime(),
|
||||
':modify_time' => phpcommon\getNowTime(),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
protected function recSingleRmb($num, $account_id)
|
||||
{
|
||||
$conn = $this->getMysql($account_id);
|
||||
$user_db = $this->readRecActDB($account_id);
|
||||
$row = $conn->execQueryOne('SELECT accountid, daily_max_single FROM user WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id
|
||||
));
|
||||
if ($row['daily_max_single'] == 0) {
|
||||
foreach ($user_db['single_list'] as &$us) {
|
||||
foreach ($this->data['single_list'] as &$us) {
|
||||
if ($us['status'] != 1) {
|
||||
continue;
|
||||
}
|
||||
@ -120,7 +107,7 @@ class PayActivityController extends BaseAuthedController {
|
||||
$us['time'] = phpcommon\getNowTime();
|
||||
break;
|
||||
}
|
||||
$this->saveRecActDB($account_id, $user_db);
|
||||
$this->saveData();
|
||||
}
|
||||
}
|
||||
|
||||
@ -345,10 +332,10 @@ class PayActivityController extends BaseAuthedController {
|
||||
return $act_db;
|
||||
}
|
||||
|
||||
protected function getDailyExtraReward($user_db, $account_id, $type, $id, $idx)
|
||||
protected function getDailyExtraReward($type, $id, $idx)
|
||||
{
|
||||
$item_list = array();
|
||||
foreach ($user_db['daily_list'] as &$us) {
|
||||
foreach ($this->data['daily_list'] as &$us) {
|
||||
if ($us['id'] != $id) {
|
||||
continue;
|
||||
}
|
||||
@ -361,7 +348,7 @@ class PayActivityController extends BaseAuthedController {
|
||||
$key['extra_status'] = 2;
|
||||
}
|
||||
}
|
||||
$this->saveRecActDB($account_id, $user_db);
|
||||
$this->saveData($this->getAccountId(), $this->data);
|
||||
return $item_list;
|
||||
}
|
||||
|
||||
@ -422,88 +409,119 @@ class PayActivityController extends BaseAuthedController {
|
||||
if ($type == 1) {
|
||||
$item_list = $this->getSingleReward($type, $id, $idx);
|
||||
} else if ($type == 2) {
|
||||
$item_list = $this->getSumReward($account_id, $user_db['sum_list'], $id, $draw_type);
|
||||
$item_list = $this->getSumReward($id, $draw_type);
|
||||
} else if ($type == 3) {
|
||||
$item_list = $this->getQuestReward($type, $id, $idx, $draw_type);
|
||||
} else if ($type == 4) {
|
||||
$item_list = $this->getShopReward($type, $id, $idx);
|
||||
} else if ($type == 5) {
|
||||
$item_list = $this->getDressReward($account_id, $user_db['dress_list'], $type, $id, $idx);
|
||||
$item_list = $this->getDressReward($type, $id, $idx);
|
||||
} else if ($type == 6) {
|
||||
$item_list = $this->getDiscountReward($type, $id, $idx);
|
||||
} else if ($type == 7) {
|
||||
$item_list = $this->getDrawReward($account_id, $user_db['draw_list'], $type, $id, $idx, $user_db);
|
||||
$item_list = $this->getDrawReward($type, $id, $idx, $user_db);
|
||||
} else if ($type == 8) {
|
||||
$item_list = $this->getTableReward($account_id, $user_db['table_list'], $type, $id, $idx, $draw_type);
|
||||
$item_list = $this->getTableReward($type, $id, $idx, $draw_type);
|
||||
} else if ($type == 9) {
|
||||
if ($draw_type == 0) {
|
||||
$item_list = $this->getDailyReward($type, $id, $idx);
|
||||
} else {
|
||||
$item_list = $this->getDailyExtraReward($user_db, $account_id, $type, $id, $idx);
|
||||
$item_list = $this->getDailyExtraReward($type, $id, $idx);
|
||||
}
|
||||
}
|
||||
return $item_list;
|
||||
}
|
||||
|
||||
protected function getDailyReward($account_id, $user_db, $type, $id, $idx)
|
||||
private function getDailyActCond($actdb, $cond)
|
||||
{
|
||||
return isset($actdb[$cond]) ? $actdb[$cond] : null;
|
||||
}
|
||||
|
||||
private function getDailyActCondIdx($actdb, $cond)
|
||||
{
|
||||
return isset($actdb[$cond]) ? $actdb[$cond] : null;
|
||||
}
|
||||
|
||||
private function calcDailyActRemainDay($actdb)
|
||||
{
|
||||
$pass_day = phpcommon\between_days($this->getNowTime(), $actdb['last_buytime']);
|
||||
$real_remain_day = max($actdb['remain_day'] - $pass_day, 0);
|
||||
return $real_remain_day;
|
||||
}
|
||||
|
||||
/*
|
||||
id: 活动id
|
||||
cond: 活动目标条件
|
||||
*/
|
||||
protected function getDailyReward($type, $id, $cond)
|
||||
{
|
||||
$actMeta = metatable\getActPlusById($id);
|
||||
|
||||
$item_list = array();
|
||||
$cost = 0;
|
||||
$addreward = new classes\AddReward();
|
||||
foreach ($user_db['daily_list'] as &$us) {
|
||||
if ($us['id'] != $id) {
|
||||
continue;
|
||||
$actdb = isset($this->data['daily_list'][$id]) ? $this->data['daily_list'][$id] : null;
|
||||
if ($actdb == null) {
|
||||
$actdb = array();
|
||||
$cond_conf = explode('|', $act['condition']);
|
||||
foreach ($cond_conf as $c) {
|
||||
$actdb[$c] = array(
|
||||
'act_cond' => $c, //活动目标条件
|
||||
'buytimes' => 0, //购买次数
|
||||
'last_buytime' => 0, //最后一次购买时间,0就表示未购买过
|
||||
'last_receive_time' => 0, //最后领取时间如果等于当天表示今天已1领取
|
||||
);
|
||||
}
|
||||
$key = 0;
|
||||
$day = 0;
|
||||
foreach ($us['daily_list'] as &$d) {
|
||||
if ($idx != $d['condition']) {
|
||||
if ($d['condition'] > $cost) {
|
||||
$d['dprice'] = $cost + $d['dprice'];
|
||||
}
|
||||
if ($d['status'] == 1) {
|
||||
$day = $day + $d['time_long'];
|
||||
}
|
||||
} else {
|
||||
$item_conf = metatable\getItemById($d['reward_id']);
|
||||
if (!$item_conf) {
|
||||
return null;
|
||||
}
|
||||
$item_list = metatable\getDropListById($item_conf['fuctionindex']);
|
||||
foreach ($d['extra'] as $ex) {
|
||||
array_push($item_list, $ex);
|
||||
}
|
||||
$d['status'] = 1;
|
||||
$d['time'] = phpcommon\getNowTime();
|
||||
$d['buytime'] = phpcommon\getNowTime();
|
||||
$d['day'] = $day + $d['time_long'];
|
||||
$d['extra_status'] = 2;
|
||||
$cost = $d['condition'];
|
||||
$us['forever'] = $key + 1;
|
||||
for ($i = 1; $i < $us['forever']; $i++) {
|
||||
$addreward->addReward($i + 19000, 1, $account_id, 0, 0);
|
||||
}
|
||||
$addreward->updaterechargelv($account_id, $key + 1, 1);
|
||||
}
|
||||
$key++;
|
||||
}
|
||||
break;
|
||||
$actdb['remain_day'] = 0;
|
||||
$actdb['last_buytime'] = 0;
|
||||
$this->data['daily_list'][$id] = $actdb;
|
||||
}
|
||||
$this->saveRecActDB($account_id, $user_db);
|
||||
// // $this->recSingleRmb($cost, $account_id);
|
||||
// // $this->addRmb($cost, $account_id);
|
||||
// $item_info = array();
|
||||
// array_push($item_info, array(
|
||||
// 'item_list' => $item_list,
|
||||
// 'cost' => $cost,
|
||||
// ));
|
||||
$cond_idx = metatable\ActivityPlus::getCondIdx($actMeta, $cond);
|
||||
if (!$this->getDailyActCond($actdb, $cond) ||
|
||||
$cond_idx < 0) {
|
||||
phpcommon\sendError(500, '配置表错误');
|
||||
error_log('不存在的daily act cond');
|
||||
die();
|
||||
}
|
||||
$cond_actdb = $actdb[$cond];
|
||||
{
|
||||
//计算价格
|
||||
$decPrice = 0;
|
||||
foreach ($actdb as $c) {
|
||||
if ($this->calcDailyActCondRemainDay($actdb) > 0 && $c['act_cond'] < $cond) {
|
||||
$decPrice += $c['act_cond'];
|
||||
}
|
||||
}
|
||||
$finallyPrice = max($cond - $decPrice, 0);
|
||||
}
|
||||
{
|
||||
//计算剩余天数
|
||||
$new_remain_day = $this->getDailyActCondRemainDay($actdb) + $cond;
|
||||
$actdb['remain_day'] = $new_remain_day;
|
||||
$actdb['last_buytime'] = $this->getNowTime();
|
||||
$cond_actdb['last_buytime'] = $this->getNowTime();
|
||||
}
|
||||
{
|
||||
//给奖励
|
||||
$item_conf = metatable\getItemById(metatable\ActivityPlus::getReward($actMeta, $cond_idx));
|
||||
if (!$item_conf) {
|
||||
return null;
|
||||
}
|
||||
$item_list = metatable\getDropListById($item_conf['fuctionindex']);
|
||||
for ($i = 1; $i < $cond_idx + 1; $i++) {
|
||||
$addreward->addReward($i + 19000, 1, $this->getAccountId(), 0, 0);
|
||||
}
|
||||
$addreward->updaterechargelv($this->getAccountId(), $cond_idx + 1, 1);
|
||||
}
|
||||
$cond_actdb['buytimes']++;
|
||||
|
||||
$this->saveData();
|
||||
return $item_list;
|
||||
}
|
||||
|
||||
protected function getSingleReward($account_id, $user_db, $type, $id, $idx)
|
||||
protected function getSingleReward($type, $id, $idx)
|
||||
{
|
||||
$item_list = array();
|
||||
foreach ($user_db['single_list'] as &$us) {
|
||||
foreach ($this->data['single_list'] as &$us) {
|
||||
if ($us['id'] != $id) {
|
||||
continue;
|
||||
}
|
||||
@ -523,16 +541,15 @@ class PayActivityController extends BaseAuthedController {
|
||||
$us['time'] = phpcommon\getNowTime();
|
||||
break;
|
||||
}
|
||||
foreach ($user_db['single_list'] as &$us) {
|
||||
foreach ($this->data['single_list'] as &$us) {
|
||||
$us['time'] = phpcommon\getNowTime();
|
||||
}
|
||||
$this->saveRecActDB($account_id, $user_db);
|
||||
$this->saveData($this->getAccountId(), $this->data);
|
||||
return $item_list;
|
||||
}
|
||||
|
||||
protected function getSumReward($id, $draw_type)
|
||||
{
|
||||
$account_id = $this->getAccountId();
|
||||
$act = metatable\getActPlusById($id);
|
||||
$item_conf = metatable\getItemById($act['reward']);
|
||||
$item_list = array();
|
||||
@ -543,7 +560,7 @@ class PayActivityController extends BaseAuthedController {
|
||||
if ($draw_type == 1) {
|
||||
$num = 10;
|
||||
}
|
||||
$re = $this->subCoin($account_id, 99999, $num);
|
||||
$re = $this->subCoin($this->getAccountId(), 99999, $num);
|
||||
if (!$re) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 4, '货币不足');
|
||||
die();
|
||||
@ -600,9 +617,10 @@ class PayActivityController extends BaseAuthedController {
|
||||
}
|
||||
break;
|
||||
}
|
||||
$this->saveRecActDB($account_id, $user_db);
|
||||
$this->saveData();
|
||||
return $item_list;
|
||||
}
|
||||
|
||||
protected function getShopReward($account_id, $user_db, $type, $id, $idx)
|
||||
{
|
||||
$item_list = array();
|
||||
@ -633,11 +651,15 @@ class PayActivityController extends BaseAuthedController {
|
||||
break;
|
||||
}
|
||||
}
|
||||
$this->saveRecActDB($account_id, $user_db);
|
||||
$this->saveData();
|
||||
return $item_list;
|
||||
}
|
||||
protected function getDressReward($account_id, $info_list, $type, $id, $idx)
|
||||
{}
|
||||
|
||||
protected function getDressReward($type, $id, $idx)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected function getDiscountReward($account_id, $user_db, $type, $id, $idx)
|
||||
{
|
||||
$item_list = array();
|
||||
@ -665,17 +687,17 @@ class PayActivityController extends BaseAuthedController {
|
||||
if (!$rec) {
|
||||
return null;
|
||||
}
|
||||
//$this->saveRecActDB($account_id, $user_db);
|
||||
//$this->saveData();
|
||||
return $item_list;
|
||||
}
|
||||
|
||||
protected function getDrawReward($account_id, $info_list, $type, $id, $idx, $user_db)
|
||||
protected function getDrawReward($type, $id, $idx, $user_db)
|
||||
{
|
||||
$item_list = array();
|
||||
$keys = 0;
|
||||
for ($i = 0; $i < count($info_list); $i++) {
|
||||
if ($info_list[$i]['id'] == $id) {
|
||||
$reward = $info_list[$i]['reward'];
|
||||
for ($i = 0; $i < count($this->data['draw_list']); $i++) {
|
||||
if ($this->data['draw_list'][$i]['id'] == $id) {
|
||||
$reward = $this->data['draw_list'][$i]['reward'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -705,18 +727,18 @@ class PayActivityController extends BaseAuthedController {
|
||||
'time' => $time,
|
||||
));
|
||||
if ($item_list) {
|
||||
$re = $this->subCoin($account_id, $info_list[$idx]['conditionid'], $info_list[$idx]['condition']);
|
||||
$re = $this->subCoin($this->getAccountId(), $this->data['draw_list'][$idx]['conditionid'], $this->data['draw_list'][$idx]['condition']);
|
||||
if (!$re) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
unset($reward[$keys]);
|
||||
$user_db['draw_list'][$idx]['reward'] = array_values($reward);
|
||||
$this->saveRecActDB($account_id, $user_db);
|
||||
$this->saveData($this->getAccountId(), $user_db);
|
||||
return $item_list;
|
||||
}
|
||||
|
||||
protected function getTableReward($account_id, $info_list, $type, $id, $idx, $draw_type)
|
||||
protected function getTableReward($type, $id, $idx, $draw_type)
|
||||
{
|
||||
$act = metatable\getActPlusById($id);
|
||||
$item_conf = metatable\getItemById($act['reward']);
|
||||
@ -742,17 +764,17 @@ class PayActivityController extends BaseAuthedController {
|
||||
}
|
||||
}
|
||||
if ($draw_type != 2) {
|
||||
$re = $this->subCoin($account_id, $info_list[$idx]['conditionid'], $info_list[$idx]['condition'] * $num);
|
||||
$re = $this->subCoin($this->getAccountId(), $this->data['table_list'][$idx]['conditionid'], $this->data['table_list'][$idx]['condition'] * $num);
|
||||
if (!$re) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 4, '货币不足');
|
||||
die();
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
$conn = $this->getMysql($account_id);
|
||||
$conn = $this->getMysql($this->getAccountId());
|
||||
$row = $conn->execQueryOne('SELECT free_box FROM user WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':accountid' => $this->getAccountId(),
|
||||
));
|
||||
if (!$row || $row['free_box'] >= metatable\getParameterByName('activit_draw_times')) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 5, '今日次数已达上限');
|
||||
@ -762,7 +784,7 @@ class PayActivityController extends BaseAuthedController {
|
||||
$ret = $conn->execScript('UPDATE user SET free_box=:free_box, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':accountid' => $this->getAccountId(),
|
||||
':free_box' => $row['free_box'] + 1,
|
||||
':modify_time' => phpcommon\getNowTime()
|
||||
));
|
||||
@ -852,20 +874,12 @@ class PayActivityController extends BaseAuthedController {
|
||||
//好友砍价
|
||||
public function shareDiscount()
|
||||
{
|
||||
$account_id = $_REQUEST['account_id'];
|
||||
//登录校验
|
||||
$login = loginVerify($account_id, $_REQUEST['session_id']);
|
||||
if (!$login) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, 'session无效');
|
||||
return;
|
||||
}
|
||||
$conn = $this->getMysql($account_id);
|
||||
if (!$conn) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 2, '没有这个玩家');
|
||||
return;
|
||||
}
|
||||
$user_db = $this->readRecActDB($account_id);
|
||||
if (!$user_db || empty($user_db) || empty($user_db['discount_list'])) {
|
||||
if (!$this->data || empty($this->data) || empty($this->data['discount_list'])) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 2, '没有这个玩家');
|
||||
return;
|
||||
}
|
||||
@ -873,7 +887,7 @@ class PayActivityController extends BaseAuthedController {
|
||||
$item_id = $_REQUEST['item_id'];
|
||||
$price = 0;
|
||||
$flag = false;
|
||||
foreach ($user_db['discount_list'] as &$us) {
|
||||
foreach ($this->data['discount_list'] as &$us) {
|
||||
if ($id != $us['id']) {
|
||||
continue;
|
||||
}
|
||||
@ -894,7 +908,7 @@ class PayActivityController extends BaseAuthedController {
|
||||
phpcommon\sendError(ERR_USER_BASE + 3, '没有这个道具');
|
||||
return;
|
||||
}
|
||||
$this->saveRecActDB($account_id, $user_db);
|
||||
$this->saveData();
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg' => '',
|
||||
@ -905,27 +919,14 @@ class PayActivityController extends BaseAuthedController {
|
||||
//好友砍价刷新
|
||||
public function flushDiscountShop()
|
||||
{
|
||||
$account_id = $_REQUEST['account_id'];
|
||||
//登录校验
|
||||
$login = loginVerify($account_id, $_REQUEST['session_id']);
|
||||
if (!$login) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, 'session无效');
|
||||
return;
|
||||
}
|
||||
$conn = $this->getMysql($account_id);
|
||||
if (!$conn) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 2, '没有这个玩家');
|
||||
return;
|
||||
}
|
||||
$user_db = $this->readRecActDB($account_id);
|
||||
if (!$user_db || empty($user_db) || empty($user_db['discount_list'])) {
|
||||
if (!$this->data || empty($this->data) || empty($this->data['discount_list'])) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 2, '没有这个玩家');
|
||||
return;
|
||||
}
|
||||
$id = $_REQUEST['id'];
|
||||
$flag = false;
|
||||
$item_id = $_REQUEST['item_id'];
|
||||
$rec = $this->flushItem($account_id, $user_db, $id, $item_id, 0);
|
||||
$rec = $this->flushItem($this->getAccountId(), $this->data, $id, $item_id, 0);
|
||||
if (!$rec) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 3, '没有这个道具');
|
||||
return;
|
||||
@ -964,19 +965,13 @@ class PayActivityController extends BaseAuthedController {
|
||||
$us['reward'] = $reward;
|
||||
break;
|
||||
}
|
||||
$this->saveRecActDB($account_id, $user_db);
|
||||
$this->saveData();
|
||||
return true;
|
||||
}
|
||||
|
||||
public function changeHeadKuang()
|
||||
{
|
||||
$account_id = $_REQUEST['account_id'];
|
||||
//登录校验
|
||||
$login = loginVerify($account_id, $_REQUEST['session_id']);
|
||||
if (!$login) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, 'session无效');
|
||||
return;
|
||||
}
|
||||
$conn = $this->getMysql($account_id);
|
||||
if (!$conn) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 2, '没有这个玩家');
|
||||
@ -1004,12 +999,6 @@ class PayActivityController extends BaseAuthedController {
|
||||
public function addmailReward()
|
||||
{
|
||||
$account_id = $_REQUEST['account_id'];
|
||||
//登录校验
|
||||
$login = loginVerify($account_id, $_REQUEST['session_id']);
|
||||
if (!$login) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, 'session无效');
|
||||
return;
|
||||
}
|
||||
$attachment = $_REQUEST['attachment'];
|
||||
$item_list = array();
|
||||
$all_item_list = array();
|
||||
|
@ -52,3 +52,42 @@ function getActPlusInfo($type)
|
||||
}
|
||||
return $info_list;
|
||||
}
|
||||
|
||||
|
||||
class ActivityPlus
|
||||
{
|
||||
|
||||
public static function get($id)
|
||||
{
|
||||
return self::getMeta()[$id];
|
||||
}
|
||||
|
||||
public static function getCondIdx($actMeta, $cond)
|
||||
{
|
||||
$condConf = explode('|', $actMeta['condition']);
|
||||
$idx = 0;
|
||||
foreach ($condConf as $c) {
|
||||
if ($c == $cond) {
|
||||
return $idx;
|
||||
}
|
||||
++$idx;;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static function getReward($actMeta, $condIdx)
|
||||
{
|
||||
$rewardConf = explode('|', $actMeta['reward']);
|
||||
return $rewardConf[$condIdx];
|
||||
}
|
||||
|
||||
protected static function getMeta()
|
||||
{
|
||||
if (!self::$meta) {
|
||||
self::$meta = getMetaTable('activityplus@activityplus.php');
|
||||
}
|
||||
return self::$meta;
|
||||
}
|
||||
|
||||
private static $meta = null;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user