1
This commit is contained in:
parent
6fdbebd2fd
commit
b73889cacf
@ -111,22 +111,25 @@ class Role(object):
|
||||
]
|
||||
},
|
||||
{
|
||||
'desc': 'exchangeCoin',
|
||||
'desc': '兑换货币(该接口存在争议)exchangeCoin',
|
||||
'group': 'Role',
|
||||
'url': 'webapp/index.php?c=Role&a=exchangeCoin',
|
||||
'params': [
|
||||
_common.ReqHead(),
|
||||
['id', 0, '装备?货币id'],
|
||||
['num', 0, '兑换数量'],
|
||||
],
|
||||
'response': [
|
||||
_common.RspHead(),
|
||||
]
|
||||
},
|
||||
{
|
||||
'desc': 'saveNewbie',
|
||||
'desc': '保存新手引导saveNewbie',
|
||||
'group': 'Role',
|
||||
'url': 'webapp/index.php?c=Role&a=saveNewbie',
|
||||
'params': [
|
||||
_common.ReqHead(),
|
||||
['id', 0, 'id'],
|
||||
],
|
||||
'response': [
|
||||
_common.RspHead(),
|
||||
|
@ -107,6 +107,11 @@ function getResBaseDir()
|
||||
return '../res/';
|
||||
}
|
||||
|
||||
function emptyReplace($val, $defVal)
|
||||
{
|
||||
return !empty($val) ? $val :$defVal;
|
||||
}
|
||||
|
||||
require 'config_loader.php';
|
||||
|
||||
function new_sendError($errcode, $errmsg_tid, $errmsg)
|
||||
|
@ -18,7 +18,6 @@ class RoleController extends BaseAuthedController {
|
||||
|
||||
public function roleInfo()
|
||||
{
|
||||
$account_id = $_REQUEST['account_id'];
|
||||
//$user_name = $_REQUEST['name'];
|
||||
//$avatar_url = $_REQUEST['avatar_url'];
|
||||
$user_name = '极乐玩家';
|
||||
@ -140,7 +139,7 @@ class RoleController extends BaseAuthedController {
|
||||
($this->getSelfMysql(),
|
||||
'passinfo',
|
||||
array(
|
||||
'accountid' => $account_id,
|
||||
'accountid' => $userInfo['accountid'],
|
||||
),
|
||||
array(
|
||||
'active_status' => 0,
|
||||
@ -187,7 +186,6 @@ class RoleController extends BaseAuthedController {
|
||||
|
||||
private function oldBattleReport($userInfo)
|
||||
{
|
||||
$account_id = $_REQUEST['account_id']; //账号
|
||||
$map_id = isset($_REQUEST['map_id']) ? $_REQUEST['map_id'] : 0;
|
||||
$map_tpl_name = isset($_REQUEST['map_tpl_name']) ? $_REQUEST['map_tpl_name'] : '';
|
||||
$room_uuid = $_REQUEST['room_uuid']; //战斗id
|
||||
@ -217,11 +215,11 @@ class RoleController extends BaseAuthedController {
|
||||
if ($_REQUEST['items'] != '') {
|
||||
$item_list = splitStr1($_REQUEST['items']);
|
||||
$addreward = new classes\AddReward();
|
||||
$addreward->addReward((int)$item_list[0][0], (int)$item_list[0][1], $account_id, 0, 0);
|
||||
$addreward->addReward((int)$item_list[0][0], (int)$item_list[0][1], $this->getAccountId(), 0, 0);
|
||||
}
|
||||
{
|
||||
$addreward = new classes\AddReward();
|
||||
$val = $addreward->getVipVal($account_id, 1);
|
||||
$val = $addreward->getVipVal($this->getAccountId(), 1);
|
||||
$coin_num = floor($coin_num + $coin_num * $val / 100);
|
||||
}
|
||||
//更新击杀信息时间
|
||||
@ -332,7 +330,7 @@ class RoleController extends BaseAuthedController {
|
||||
));
|
||||
|
||||
$addreward = new classes\Addreward();
|
||||
$vip_level = $addreward->getVipLevel($account_id);
|
||||
$vip_level = $addreward->getVipLevel($this->getAccountId());
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg' => '',
|
||||
@ -448,46 +446,38 @@ class RoleController extends BaseAuthedController {
|
||||
|
||||
public function exchangeCoin()
|
||||
{
|
||||
$account_id = $_REQUEST['account_id'];
|
||||
$conn = $this->getMysql($account_id);
|
||||
$rowUser = $conn->execQueryOne('SELECT coin_times, coin_num FROM user WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
));
|
||||
|
||||
if (!$rowUser) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
$userInfo = $this->getUserInfo(array(
|
||||
'coin_times',
|
||||
'coin_num'
|
||||
));
|
||||
if ($userInfo['coin_times'] >= mt\Parameter::getVal('dailycoin_times', 0)) {
|
||||
$this->rspErr(ERR_USER_BASE + 2, '今日次数达到上限');
|
||||
return;
|
||||
}
|
||||
|
||||
$id = 12141;
|
||||
if (isset($_REQUEST['id'])) {
|
||||
$id = $_REQUEST['id'];
|
||||
}
|
||||
|
||||
$rowEquip = $conn->execQueryOne('SELECT id, lv FROM equip WHERE accountid=:accountid AND id=:id;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':id' => $id,
|
||||
));
|
||||
$id = isset($_REQUEST['id']) ? $_REQUEST['id'] : 12141;
|
||||
$rowEquip = phpcommon\SqlHelper::selectOne(
|
||||
$this->getSelfMysql(),
|
||||
'equip',
|
||||
array(
|
||||
'id',
|
||||
'lv'
|
||||
),
|
||||
array(
|
||||
'accountid' => $this->getAccountId(),
|
||||
'id' => $id,
|
||||
)
|
||||
);
|
||||
if (!$rowEquip) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 3, '没有这个装备');
|
||||
$this->rspErr(ERR_USER_BASE + 3, '没有这个装备');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$coin_times = $rowUser['coin_times'];
|
||||
$p1 = mt\Parameter::getOldParam(DAILYCOIN_TIMES);
|
||||
$max_times = $p1['param_value'];
|
||||
$p2 = mt\Parameter::getOldParam(DAILYCOIN_DECAY);
|
||||
$val = $p2['param_value'];
|
||||
$p3 = mt\Parameter::getOldParam(DAILYCOIN_NUM);
|
||||
$num = $p3['param_value'];
|
||||
|
||||
$val = mt\Parameter::getVal('dailycoin_decay', 0);
|
||||
$num = mt\Parameter::getVal('dailycoin_num', 0);
|
||||
$e = mt\EquipUpgrade::getOldEquipUp($rowEquip['id']);
|
||||
$eg = mt\Equip::getOldEquip($rowEquip['id']);
|
||||
if (!$e || !$eg) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 3, '没有这个装备');
|
||||
$this->rspErr(ERR_USER_BASE + 3, '没有这个装备');
|
||||
return;
|
||||
}
|
||||
if (isset($_REQUEST['num'])) {
|
||||
@ -497,68 +487,35 @@ class RoleController extends BaseAuthedController {
|
||||
$coin_arr = $this->getExplode($eg['promote_gold']);
|
||||
$coin_num = $coin_list[$rowEquip['lv']][0] * $coin_arr[$rowEquip['lv']][0];
|
||||
}
|
||||
if ($coin_times >= $max_times) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 2, '今日次数达到上限');
|
||||
return;
|
||||
}
|
||||
//$coin_num = $_REQUEST['num'];
|
||||
//$coin_num = round($num * pow($val, $coin_times));
|
||||
$ret = $conn->execScript('UPDATE user SET coin_times=:coin_times, coin_num=:coin_num, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':coin_times' => $coin_times + 1,
|
||||
':coin_num' => $coin_num + $rowUser['coin_num'],
|
||||
':modify_time' => phpcommon\getNowTime()
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
}
|
||||
$coin = $coin_num + $rowUser['coin_num'];
|
||||
$this->updateUserInfo(array(
|
||||
'coin_times' => $userInfo['coin_times'] + 1,
|
||||
'coin_num' => $coin_num + $userInfo['coin_num'],
|
||||
'modify_time' => $this->getNowTime()
|
||||
));
|
||||
$coin = $coin_num + $userInfo['coin_num'];
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg' => '',
|
||||
'coin_nums' => $coin,
|
||||
'coin_times' => $coin_times + 1
|
||||
'coin_times' => $userInfo['coin_times'] + 1
|
||||
));
|
||||
}
|
||||
|
||||
public function saveNewbie()
|
||||
{
|
||||
$account_id = $_REQUEST['account_id'];
|
||||
$conn = $this->getMysql($account_id);
|
||||
//$info = array();
|
||||
$id = $_REQUEST['id'];
|
||||
$rowUser = $conn->execQueryOne('SELECT newInfo FROM user WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
));
|
||||
|
||||
if (!$rowUser) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
return;
|
||||
}
|
||||
$info = json_decode($rowUser['newInfo']);
|
||||
if (empty($info)) {
|
||||
$info = array();
|
||||
}
|
||||
array_push($info, (int)$id);
|
||||
$ret = $conn->execScript('UPDATE user SET newInfo=:newInfo,modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':newInfo' => json_encode($info),
|
||||
':modify_time' => phpcommon\getNowTime()
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
}
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg' => '',
|
||||
$userInfo = $this->getUserInfo(array(
|
||||
'newInfo'
|
||||
));
|
||||
$info = emptyReplace(json_decode($userInfo['newInfo']), array());
|
||||
array_push($info, (int)$id);
|
||||
$this->updateUserInf(array(
|
||||
'newInfo' => json_encode($info),
|
||||
'modify_time' => $this->getNowTime()
|
||||
));
|
||||
$this->rspOk();
|
||||
}
|
||||
|
||||
public function getFightEquip()
|
||||
|
Loading…
x
Reference in New Issue
Block a user