完成Role改造

This commit is contained in:
aozhiwei 2021-11-23 15:59:18 +08:00
parent 87b36dd855
commit d38657fb83
2 changed files with 22 additions and 48 deletions

View File

@ -190,25 +190,29 @@ class Role(object):
] ]
}, },
{ {
'desc': 'changeHIFrameHero', 'desc': '修改头像框信息changeHIFrameHero',
'group': 'NPlayerInfo', 'group': 'NPlayerInfo',
'url': 'webapp/index.php?c=NPlayerInfo&a=changeHIFrameHero', 'url': 'webapp/index.php?c=NPlayerInfo&a=changeHIFrameHero',
'params': [ 'params': [
_common.ReqHead(), _common.ReqHead(),
['type', 0, '类型 2:头像 3头像框 4:英雄'],
['itemID', 0, ''],
], ],
'response': [ 'response': [
_common.RspHead(), _common.RspHead(),
] ]
}, },
{ {
'desc': 'changeName', 'desc': '修改昵称changeName',
'group': 'NPlayerInfo', 'group': 'NPlayerInfo',
'url': 'webapp/index.php?c=NPlayerInfo&a=changeName', 'url': 'webapp/index.php?c=NPlayerInfo&a=changeName',
'params': [ 'params': [
_common.ReqHead(), _common.ReqHead(),
['nickName', '', '新昵称'],
], ],
'response': [ 'response': [
_common.RspHead(), _common.RspHead(),
['data', '', '新昵称'],
] ]
}, },
] ]

View File

@ -692,47 +692,28 @@ class RoleController extends BaseAuthedController {
$this->sendDataToClient($code,"getPlayerInfo",$resultArr); $this->sendDataToClient($code,"getPlayerInfo",$resultArr);
} }
public function changeHIFrameHero()//修改头像 头像框 英雄 public function changeHIFrameHero()
{ {
$account_id = $_REQUEST['account_id'];
$type = $_REQUEST['type']; $type = $_REQUEST['type'];
$itemID = $_REQUEST["itemID"]; $itemID = $_REQUEST["itemID"];
$conn = $this->getMysql($account_id); $fieldsKv = array();
$code = 100; if($type == 2) {
$updateInfo = null; $fieldsKv = array("hi_id" => $itemID);
$heroSkinID = 0; } else if($type == 3) {
if($type == 2)//修改头像 $fieldsKv = array("head_kuang_id" => $itemID);
{ } else if($type == 4) {
$updateInfo = array("hi_id" => $itemID); $fieldsKv = array('hero_id' => $itemID);
} }
else if($type == 3)//修改头像框 if(count($fieldsKv) > 0) {
{ $this->updateUserInfo($fieldsKv);
$updateInfo = array("head_kuang_id" => $itemID);
} }
else if($type == 4)//修改英雄 $resultArr = array("type"=>$type,"itemID"=>$itemID,"heroSkinID"=> 0);
{ $this->sendDataToClient(100, "changeHIFrameHero", $resultArr);
$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);
} }
public function changeName()//修改昵称 public function changeName()
{ {
$account_id = $_REQUEST['account_id'];
$nickName = $_REQUEST['nickName']; $nickName = $_REQUEST['nickName'];
$conn = $this->getMysql($account_id);
$code = 100; $code = 100;
$itemID = 10106; $itemID = 10106;
$itemNum = 1; $itemNum = 1;
@ -744,22 +725,11 @@ class RoleController extends BaseAuthedController {
if($code == 100) if($code == 100)
{ {
$this->decItem($itemArr); $this->decItem($itemArr);
//error_log("改名测试======".$code); $this->updateUserInfo(array(
phpcommon\SqlHelper::update
($this->getSelfMysql(),
'user',
array(
'accountid' => $this->getAccountId()
),
array(
'user_name' => $nickName 'user_name' => $nickName
) ));
);
} }
$this->sendDataToClient($code,"changeNickName",$nickName); $this->sendDataToClient($code,"changeNickName",$nickName);
// $sqlStr = "SELECT * FROM user WHERE accountid=:accountid; ";
// $row = $conn->execQuery($sqlStr,array(':accountid' => $account_id));
} }
} }