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',
'url': 'webapp/index.php?c=NPlayerInfo&a=addGiveMeFive',
'params': [

View File

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