getSelfMysql(), 'gun_intensify', array( 'gun_type_id', 'skill_id', 'skill_lv' ), array( 'accountid' => $this->getAccountId() ), function ($row) use(&$data) { array_push($data, array( 'gun_type_id' => $row['gun_type_id'], 'skill_id' => $row['skill_id'], 'skill_lv' => $row['skill_lv'], )); } ); $this->rspDataOld($data); } public function skillLvUp() { $talentId = $_REQUEST['skill_id']; $gunTypeId = $_REQUEST['skill_type_id']; $talentLvMeta = mt\GunTalentLv::get($talentId); if (!$talentLvMeta) { $this->rspErr(99, "技能不存在"); return; } $gunTalentMeta = mt\GunTalentLv::get($gunTypeId); if (!$gunTalentMeta) { $this->rspErr(1, "参数错误"); return; } if (!mt\GunTalentLv::isValidTalent($gunTypeId, $talentId)) { $this->rspErr(1, "参数错误"); return; } $talentLv = $this->getTalentLv($talentId, $gunTypeId); if (mt\GunTalentLv::isFullLv($talentLvMeta, $talentLv)) { $this->rspErr(98, "已满级"); return; } $nextLvMeta = mt\GunTalentLv::getByLv($meta, $talentLv + 1); if (!$nextLvMeta) { $this->rspErr(2, "配置表错误"); return; } $costList = mt\GunTalentLv::getCostList($nextLvMeta); $lackItem = array(); if (!$this->hasEnoughItemsEx($costItem, $lackItem)) { switch ($lackItem['item_id']) { case V_ITEM_GOLD: { $this->rspErr(97, "金币不足"); } break; case V_ITEM_DIAMOND: { $this->rspErr(96, "钻石不足"); } break; default: { $this->rspErr(95, "道具不足"); } break; } return; } ++$talentLv; phpcommon\SqlHelper::upsert ($this->getSelfMysql(), 'gun_intensify', array( 'accountid' => $this->getAccountId(), 'gun_type_id' => $gunTypeId, 'skill_id' => $talentId ), array( 'skill_lv' => $talentLv, 'modifytime' => $this->getNowTime() ), array( 'accountid' => $this->getAccountId(), 'gun_type_id' => $gunTypeId, 'skill_id' => $talentId, 'skill_lv' => $talentLv, 'createtime' => $this->getNowTime(), 'modifytime' => $this->getNowTime() ) ); $this->rspRawData(array( 'errcode' => 100, 'errmsg' => '', 'data' => array( 'gun_type_id' => $gunTypeId, 'skill_id' => $talentId, 'skill_lv' => $talentLv, ) )); } public function getGunAndSkinInfo() { $data = array(); phpcommon\SqlHelper::select ($this->getSelfMysql(), 'gun', array( 'gun_id', 'skin_id' ), array( 'accountid' => $this->getAccountId() ), function ($row) use(&$data) { array_push($data, array( 'gun_id' => $row['gun_id'], 'skin_lv' => $row['skin_id'], )); } ); phpcommon\SqlHelper::select ($this->getSelfMysql(), 'gun_skin', array( 'gun_id', 'skin_id' ), array( 'accountid' => $this->getAccountId() ), function ($row) use(&$data) { array_push($data, array( 'gun_id' => $row['gun_id'], 'skin_lv' => $row['skin_id'], )); } ); $this->rspRawData(array( 'errcode' => 100, 'errmsg' => '', 'data' => $data )); } public function equipGunSkin() { $gunId = $_REQUEST['gun_id']; $skinId = $_REQUEST['skin_id']; phpcommon\SqlHelper::upsert ($this->getSelfMysql(), 'gun', array( 'accountid' => $this->getAccountId(), 'gun_id' => $gunId ), array( ), array( 'accountid' => $this->getAccountId(), 'gun_id' => $gunId, 'skin_id' => $skinId, 'trytime' => 0, 'createtime' => $this->getNowTime(), 'modifytime' => $this->getNowTime() ) ); $this->rspRawData(array( 'errcode' => 100, 'errmsg' => '', 'data' => array( 'gun_id' => $gunId, 'skin_id' => $skinId ) )); } public function buyGunSkin() { $account_id = $_REQUEST['account_id']; $gunId = $_REQUEST['gun_id']; $skinId = $_REQUEST['skin_id']; $goodsId = $_REQUEST['goodsID']; $shopMeta = mt\NewShop::getShopItemById(3); if (!$shopMeta) { $this->rspErr(1, "参数错误"); return; } $goodsInfo = mt\NewShop::getGoodsInfo($shopMeta, $goodsId); if (!$goodsInfo) { $this->rspErr(1, "参数错误"); return; } $costList = array( array( 'item_id' => $goodsInfo['costItemId'], 'item_num' => $goodsInfo['costItemNum'], ) ); $lackItem = array(); if (!$this->hasEnoughItemsEx($costItem, $lackItem)) { switch ($lackItem['item_id']) { case V_ITEM_GOLD: { $this->rspErr(88, "金币不足"); } break; case V_ITEM_DIAMOND: { $this->rspErr(87, "钻石不足"); } break; default: { $this->rspErr(86, "道具不足"); } break; } return; } { phpcommon\SqlHelper::upsert ($this->getSelfMysql(), 'gun_skin', array( 'accountid' => $this->getAccountId(), 'gun_id' => $gunId, 'skin_id' => $skinId ), array( 'trytime' => 0, 'modifytime' => $this->getNowTime() ), array( 'accountid' => $this->getAccountId(), 'gun_id' => $gunId, 'skin_id' => $skinId, 'trytime' => 0, 'createtime' => $this->getNowTime(), 'modifytime' => $this->getNowTime() ) ); phpcommon\SqlHelper::upsert ($this->getSelfMysql(), 'gun', array( 'accountid' => $this->getAccountId(), 'gun_id' => $gunId ), array( 'skin_id' => $skinId, 'modifytime' => $this->getNowTime() ), array( 'accountid' => $this->getAccountId(), 'gun_id' => $gunId, 'skin_id' => $skinId, 'trytime' => 0, 'createtime' => $this->getNowTime(), 'modifytime' => $this->getNowTime() ) ); } $this->rspRawData(array( 'errcode' => 100, 'errmsg' => '', 'data' => array( 'gun_id' => $gunId, 'skin_id' => $skinid ) )); } }