This commit is contained in:
aozhiwei 2021-01-04 15:02:19 +08:00
parent f57e284bdb
commit 7290d5e3eb
2 changed files with 43 additions and 68 deletions

View File

@ -77,4 +77,22 @@ class BaseAuthedController extends BaseController {
return in_array($sex, array(0, 1, 2));
}
protected function getUserInfo($fields)
{
$row = phpcommon\SqlHelper::selectOne
($this->getSelfMysql(),
'user',
array($fields),
array(
'accountid' => $this->getAccountId()
)
);
if (empty($row)) {
phpcommon\sendError(500, '服务器内部错误');
error_log('getUserInfo error '. $this->getAccountId());
die();
}
return $row;
}
}

View File

@ -297,23 +297,13 @@ class PayActivityController extends BaseAuthedController {
//充值活动
public function recAcitivityInfo()
{
$row = phpcommon\SqlHelper::SelectOne
($this->getSelfMysql(),
'user',
array(
'rmb_num',
'score'
),
array(
'accountid' => $this->getAccountId()
));
if (!$row) {
phpcommon\sendError(ERR_USER_BASE + 2, '没有这个玩家');
return;
}
$userInfo = $this->getUserInfo(
array(
'rmb_num',
'score'
));
//充值活动信息
$this->getRecActInfo($row['rmb_num']);
$user_db = $this->readRecActDB($account_id);
$user_db = $this->getRecActInfo($userInfo['rmb_num']);
echo json_encode(array(
'errcode' => 0,
'errmsg'=> '',
@ -332,18 +322,15 @@ class PayActivityController extends BaseAuthedController {
protected function getRecActInfo($rmb_num)
{
$recharge = new classes\RechargeActInfo();
$single_list = $recharge->getActSingleInfo(1, $user_db['single_list'], $rmb_num, $account_id);
$sum_list = $recharge->getActSumInfo(2, $user_db['sum_list'], $rmb_num, $account_id);
$quest_list = $recharge->getActQuestInfo(3, $user_db['quest_list'], $rmb_num, $account_id);
$shop_list = $recharge->getActShopInfo(4, $user_db['shop_list'], $rmb_num, $account_id);
$dress_list = $recharge->getActDressInfo(5, $user_db['dress_list'], $rmb_num, $account_id);
$discount_list = $recharge->getActDiscountInfo(6, $user_db['discount_list'], $rmb_num, $account_id);
$draw_list = $recharge->getActDrawInfo(7, $user_db['draw_list'], $rmb_num,$account_id);
$table_list = $recharge->getActTableInfo(8, $user_db['table_list'], $rmb_num, $account_id);
// if ($user_db['daily_list']) {
// $item_list = $this->getDailyExtraReward($user_db, $account_id);
// }
$daily_list = $recharge->getActDailyInfo(9, $user_db['daily_list'], $rmb_num, $account_id);
$single_list = $recharge->getActSingleInfo(1, $this->data['single_list'], $rmb_num, $this->getAccountId());
$sum_list = $recharge->getActSumInfo(2, $this->data['sum_list'], $rmb_num, $this->getAccountId());
$quest_list = $recharge->getActQuestInfo(3, $this->data['quest_list'], $rmb_num, $this->getAccountId());
$shop_list = $recharge->getActShopInfo(4, $this->data['shop_list'], $rmb_num, $this->getAccountId());
$dress_list = $recharge->getActDressInfo(5, $this->data['dress_list'], $rmb_num, $this->getAccountId());
$discount_list = $recharge->getActDiscountInfo(6, $this->data['discount_list'], $rmb_num, $this->getAccountId());
$draw_list = $recharge->getActDrawInfo(7, $this->data['draw_list'], $rmb_num,$this->getAccountId());
$table_list = $recharge->getActTableInfo(8, $this->data['table_list'], $rmb_num, $this->getAccountId());
$daily_list = $recharge->getActDailyInfo(9, $this->data['daily_list'], $rmb_num, $this->getAccountId());
$act_db = array(
'single_list' => $single_list,
'sum_list' => $sum_list,
@ -355,7 +342,7 @@ class PayActivityController extends BaseAuthedController {
'table_list' => $table_list,
'daily_list' => $daily_list,
);
$this->saveRecActDB($account_id, $act_db);
return $act_db;
}
protected function getDailyExtraReward($user_db, $account_id, $type, $id, $idx)
@ -381,23 +368,6 @@ class PayActivityController extends BaseAuthedController {
//充值活动奖励
public function recAcitivityReward()
{
$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)) {
phpcommon\sendError(ERR_USER_BASE + 2, '没有这个玩家');
return;
}
$type = $_REQUEST['type'];
$id = $_REQUEST['id'];
$idx = $_REQUEST['idx'];
@ -409,21 +379,7 @@ class PayActivityController extends BaseAuthedController {
$isUp = false;
$addreward = new classes\AddReward();
$new_lv = $addreward->getVipLevel($account_id);
$item_list = $this->getActRewardList($account_id, $user_db, $type, $id, $idx, $draw_type);
// if ($type == 9 && $draw_type == 0) {
// $cost = $item_list[0]['cost'];
// $item_list = $item_list[0]['item_list'];
// $now_lv = $addreward->getVipLevel($account_id);
// $this->recSingleRmb($cost, $account_id);
// $this->addRmb($cost, $account_id);
// $new_lv = $addreward->getVipLevel($account_id);
// $isUp = false;
// if ($new_lv > $now_lv) {
// $isUp = true;
// $addreward->insertMailEvent($account_id, $now_lv, $new_lv);
// $addreward->updaterechargelv($account_id, $new_lv, 0);
// }
// }
$item_list = $this->getActRewardList($type, $id, $idx, $draw_type);
if (!$item_list || empty($item_list)) {
phpcommon\sendError(ERR_USER_BASE + 3, '没有这个奖励');
return;
@ -460,28 +416,28 @@ class PayActivityController extends BaseAuthedController {
));
}
protected function getActRewardList($account_id, $user_db, $type, $id, $idx, $draw_type)
protected function getActRewardList($type, $id, $idx, $draw_type)
{
$item_list = array();
if ($type == 1) {
$item_list = $this->getSingleReward($account_id, $user_db, $type, $id, $idx);
$item_list = $this->getSingleReward($type, $id, $idx);
} else if ($type == 2) {
$item_list = $this->getSumReward($account_id, $user_db['sum_list'], $id, $draw_type);
} else if ($type == 3) {
$item_list = $this->getQuestReward($account_id, $user_db, $type, $id, $idx, $draw_type);
$item_list = $this->getQuestReward($type, $id, $idx, $draw_type);
} else if ($type == 4) {
$item_list = $this->getShopReward($account_id, $user_db, $type, $id, $idx);
$item_list = $this->getShopReward($type, $id, $idx);
} else if ($type == 5) {
$item_list = $this->getDressReward($account_id, $user_db['dress_list'], $type, $id, $idx);
} else if ($type == 6) {
$item_list = $this->getDiscountReward($account_id, $user_db, $type, $id, $idx);
$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);
} else if ($type == 8) {
$item_list = $this->getTableReward($account_id, $user_db['table_list'], $type, $id, $idx, $draw_type);
} else if ($type == 9) {
if ($draw_type == 0) {
$item_list = $this->getDailyReward($account_id, $user_db, $type, $id, $idx);
$item_list = $this->getDailyReward($type, $id, $idx);
} else {
$item_list = $this->getDailyExtraReward($user_db, $account_id, $type, $id, $idx);
}
@ -574,8 +530,9 @@ class PayActivityController extends BaseAuthedController {
return $item_list;
}
protected function getSumReward($account_id, $info_list, $id, $draw_type)
protected function getSumReward($id, $draw_type)
{
$account_id = $this->getAccountId();
$act = metatable\getActPlusById($id);
$item_conf = metatable\getItemById($act['reward']);
$item_list = array();