This commit is contained in:
aozhiwei 2021-11-23 15:44:16 +08:00
parent 5fe36c8bc7
commit dcef9da0bc
2 changed files with 48 additions and 47 deletions

View File

@ -150,7 +150,36 @@ class Role(object):
] ]
}, },
{ {
'desc': 'addGiveMeFive', 'desc': '获取金币数updateMoney',
'group': 'Role',
'url': 'webapp/index.php?c=Role&a=updateMoney',
'params': [
_common.ReqHead(),
],
'response': [
_common.RspHead(),
['data', [
['coin_num', 0, '金币数']
], '数据']
]
},
{
'desc': '获取金币和点券数updateMoneyAndLottery',
'group': 'Role',
'url': 'webapp/index.php?c=Role&a=updateMoneyAndLottery',
'params': [
_common.ReqHead(),
],
'response': [
_common.RspHead(),
['data', [
['coin_num', 0, '金币数'],
['rmb', 0, '点券数']
], '数据']
]
},
{
'desc': '点赞该接口貌似没用addGiveMeFive',
'group': 'NPlayerInfo', 'group': 'NPlayerInfo',
'url': 'webapp/index.php?c=NPlayerInfo&a=addGiveMeFive', 'url': 'webapp/index.php?c=NPlayerInfo&a=addGiveMeFive',
'params': [ 'params': [

View File

@ -564,74 +564,46 @@ class RoleController extends BaseAuthedController {
public function updateMoney() public function updateMoney()
{ {
$account_id = $_REQUEST['account_id']; $userInfo = $this->getUserInfo(array(
$conn = $this->getMysql($account_id); 'coin_num'
$sqlStr = "SELECT coin_num FROM user WHERE accountid=:accountid; "; ));
$row = $conn->execQuery($sqlStr,array(':accountid' => $account_id)); $this->sendDataToClient(1, "ok", $userInfo);
if($row) {
error_log("UpdateMoney======".json_encode($row));
}
else{
error_log("Test06=======");
}
$this->sendDataToClient(1,"ok",$row[0]);
} }
public function updateMoneyAndLottery() public function updateMoneyAndLottery()
{ {
$account_id = $_REQUEST['account_id']; $userInfo = $this->getUserInfo(array(
$conn = $this->getMysql($account_id); 'coin_num',
$sqlStr = "SELECT coin_num,rmb_num FROM user WHERE accountid=:accountid; "; 'rmb_num'
$row = $conn->execQuery($sqlStr,array(':accountid' => $account_id)); ));
if($row) { $this->sendDataToClient(3, "ok", $userInfo);
error_log("UpdateMoneyAndLottery======".json_encode($row));
}
else{
}
$this->sendDataToClient(3,"ok",$row[0]);
} }
private function getGiveMeFive()//获得玩家被点赞的次数 public function addGiveMeFive()
{ {
$account_id = $_REQUEST['account_id']; phpcommon\SqlHelper::upsert
$conn = $this->getMysql($account_id);
$giveMeFiveCnt = 0;
$sqlStr = "SELECT give_me_five FROM player_info WHERE accountid=:accountid; ";
$row = $conn->execQuery($sqlStr,array(':accountid' => $account_id));
if($row) {
$giveMeFiveCnt = $row["give_me_five"];
}
//error_log("当前GiveMeFiveCnt===".$giveMeFiveCnt);
return $giveMeFiveCnt;
}
public function addGiveMeFive()//玩家被点赞一次
{
//error_log("玩家被点赞===".$this->getAccountId());
$tmpCnt = $this->getGiveMeFive();
$tmpCnt ++;
phpcommon\SqlHelper::insertOrUpdate
($this->getSelfMysql(), ($this->getSelfMysql(),
'player_info', 'player_info',
array( array(
'accountid' => $this->getAccountId() 'accountid' => $this->getAccountId()
), ),
array( array(
'accountid' => $this->getAccountId(), 'give_me_five' => function () {
'give_me_five' => $tmpCnt, return 'give_me_five + 1';
'createtime' => $this->getNowTime(), },
'modifytime' => $this->getNowTime() 'modifytime' => $this->getNowTime()
), ),
array( array(
'give_me_five' => $tmpCnt, 'accountid' => $this->getAccountId(),
'give_me_five' => 1,
'createtime' => $this->getNowTime(),
'modifytime' => $this->getNowTime() 'modifytime' => $this->getNowTime()
) )
); );
$this->sendDataToClient(100,"getGiveMeFiveTest",null); $this->sendDataToClient(100,"getGiveMeFiveTest",null);
} }
public function getPlayerInfo()//获得玩家个人信息 public function getPlayerInfo()
{ {
$account_id = $_REQUEST['acctID']; $account_id = $_REQUEST['acctID'];