diff --git a/doc/Role.py b/doc/Role.py index cfdaa75..76769b0 100644 --- a/doc/Role.py +++ b/doc/Role.py @@ -136,25 +136,17 @@ class Role(object): ] }, { - 'desc': 'updateDailyAD', - 'group': 'Role', - 'url': 'webapp/index.php?c=Role&a=updateDailyAD', - 'params': [ - _common.ReqHead(), - ], - 'response': [ - _common.RspHead(), - ] - }, - { - 'desc': 'getFightEquip', + 'desc': '获取战斗装备(该函数存在刷道具风险)getFightEquip', 'group': 'Role', 'url': 'webapp/index.php?c=Role&a=getFightEquip', 'params': [ _common.ReqHead(), + ['id', 0, 'id'], ], 'response': [ _common.RspHead(), + ['!item_list', _common.DropItemInfo, '掉落道具列表'], + ['!all_item_list', _common.RewardItemInfo, '实际奖励的道具列表'], ] }, { diff --git a/webapp/controller/RoleController.class.php b/webapp/controller/RoleController.class.php index 56ef905..0fd326d 100644 --- a/webapp/controller/RoleController.class.php +++ b/webapp/controller/RoleController.class.php @@ -520,9 +520,10 @@ class RoleController extends BaseAuthedController { public function getFightEquip() { - $account_id = $_REQUEST['account_id']; + $equip1 = mt\Parameter::getVal('opening_spear', 0); + $equip2 = mt\Parameter::getVal('opening_spear2', 0); + $id = $_REQUEST['id']; - $conn = $this->getMysql($account_id); $addreward = new classes\AddReward(); $item_list = array(); array_push($item_list, array( @@ -530,44 +531,28 @@ class RoleController extends BaseAuthedController { 'item_num' => 1, 'time' => 0 )); - $all_item_list = $addreward->addReward($id, 1, $account_id, 0, 0); - $p1 = mt\Parameter::getOldParam(OPENING_SPEAR); - $equip1 = $p1['param_value']; - $p2 = mt\Parameter::getOldParam(OPENING_SPEAR2); - $equip2 = $p2['param_value']; + $all_item_list = $addreward->addReward($id, 1, $this->getAccountId(), 0, 0); if ($equip1 == $id) { - $ret = $conn->execScript('UPDATE user SET new_first_equip=1, modify_time=:modify_time ' . - ' WHERE accountid=:accountid;', - array( - ':accountid' => $account_id, - ':modify_time' => phpcommon\getNowTime(), - )); - if (!$ret) { - die(); - return; - } - $ret = $conn->execScript('UPDATE equip SET using_id=:using_id, modify_time=:modify_time ' . - ' WHERE accountid=:accountid;', - array( - ':accountid' => $account_id, - ':using_id' => $id, - ':modify_time' => phpcommon\getNowTime(), - )); - if (!$ret) { - die(); - return; - } + $this->updateUserInfo(array( + 'new_first_equip' => 1, + 'modify_time' => $this->getNowTime(), + )); + phpcommon\SqlHelper::update + ($this->getSelfMysql(), + 'equip', + array( + 'accountid' => $this->getAccountId(), + ), + array( + 'using_id' => $id, + 'modify_time' => $this->getNowTime(), + ) + ); } else if ($equip2 == $id) { - $ret = $conn->execScript('UPDATE user SET new_second_equip=1, modify_time=:modify_time ' . - ' WHERE accountid=:accountid;', - array( - ':accountid' => $account_id, - ':modify_time' => phpcommon\getNowTime(), - )); - if (!$ret) { - die(); - return; - } + $this->updateUserInfo(array( + 'new_second_equip' => 1, + 'modify_time' => $this->getNowTime(), + )); } echo json_encode(array( 'errcode' => 0,