完成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',
'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', '', '新昵称'],
]
},
]

View File

@ -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));
}
}