diff --git a/doc/Role.py b/doc/Role.py index 0e2f758..042eac0 100644 --- a/doc/Role.py +++ b/doc/Role.py @@ -190,25 +190,29 @@ class Role(object): ] }, { - 'desc': 'changeHIFrameHero', + 'desc': '修改头像框信息changeHIFrameHero', 'group': 'NPlayerInfo', 'url': 'webapp/index.php?c=NPlayerInfo&a=changeHIFrameHero', 'params': [ _common.ReqHead(), + ['type', 0, '类型 2:头像 3:头像框 4:英雄'], + ['itemID', 0, '值'], ], 'response': [ _common.RspHead(), ] }, { - 'desc': 'changeName', + 'desc': '修改昵称changeName', 'group': 'NPlayerInfo', 'url': 'webapp/index.php?c=NPlayerInfo&a=changeName', 'params': [ _common.ReqHead(), + ['nickName', '', '新昵称'], ], 'response': [ _common.RspHead(), + ['data', '', '新昵称'], ] }, ] diff --git a/webapp/controller/RoleController.class.php b/webapp/controller/RoleController.class.php index ebe6ad4..957af72 100644 --- a/webapp/controller/RoleController.class.php +++ b/webapp/controller/RoleController.class.php @@ -692,47 +692,28 @@ class RoleController extends BaseAuthedController { $this->sendDataToClient($code,"getPlayerInfo",$resultArr); } - public function changeHIFrameHero()//修改头像 头像框 英雄 + public function changeHIFrameHero() { - $account_id = $_REQUEST['account_id']; $type = $_REQUEST['type']; $itemID = $_REQUEST["itemID"]; - $conn = $this->getMysql($account_id); - $code = 100; - $updateInfo = null; - $heroSkinID = 0; - if($type == 2)//修改头像 - { - $updateInfo = array("hi_id" => $itemID); + $fieldsKv = array(); + if($type == 2) { + $fieldsKv = array("hi_id" => $itemID); + } else if($type == 3) { + $fieldsKv = array("head_kuang_id" => $itemID); + } else if($type == 4) { + $fieldsKv = array('hero_id' => $itemID); } - else if($type == 3)//修改头像框 - { - $updateInfo = array("head_kuang_id" => $itemID); + if(count($fieldsKv) > 0) { + $this->updateUserInfo($fieldsKv); } - else if($type == 4)//修改英雄 - { - $updateInfo = array('hero_id' => $itemID); - } - if($code == 100) - { - phpcommon\SqlHelper::update - ($this->getSelfMysql(), - 'user', - array( - 'accountid' => $this->getAccountId() - ), - $updateInfo - ); - } - $resultArr = array("type"=>$type,"itemID"=>$itemID,"heroSkinID"=>$heroSkinID); - $this->sendDataToClient($code,"changeHIFrameHero",$resultArr); + $resultArr = array("type"=>$type,"itemID"=>$itemID,"heroSkinID"=> 0); + $this->sendDataToClient(100, "changeHIFrameHero", $resultArr); } - public function changeName()//修改昵称 + public function changeName() { - $account_id = $_REQUEST['account_id']; $nickName = $_REQUEST['nickName']; - $conn = $this->getMysql($account_id); $code = 100; $itemID = 10106; $itemNum = 1; @@ -744,22 +725,11 @@ class RoleController extends BaseAuthedController { if($code == 100) { $this->decItem($itemArr); - //error_log("改名测试======".$code); - phpcommon\SqlHelper::update - ($this->getSelfMysql(), - 'user', - array( - 'accountid' => $this->getAccountId() - ), - array( - 'user_name' => $nickName - ) - ); + $this->updateUserInfo(array( + 'user_name' => $nickName + )); } $this->sendDataToClient($code,"changeNickName",$nickName); - - // $sqlStr = "SELECT * FROM user WHERE accountid=:accountid; "; - // $row = $conn->execQuery($sqlStr,array(':accountid' => $account_id)); } }