This commit is contained in:
aozhiwei 2021-11-26 13:50:14 +08:00
parent eeb3b753f2
commit a0a3e437a5

View File

@ -24,28 +24,28 @@ class BaseAuthedController extends BaseController {
} }
} }
public function getAccountId() public function _getAccountId()
{ {
return $this->accountId; return $this->accountId;
} }
public function getChannel() public function _getChannel()
{ {
return phpcommon\extractChannel($this->getAccountId()); return phpcommon\extractChannel($this->getAccountId());
} }
public function getSessionId() public function _getSessionId()
{ {
return $this->sessionId; return $this->sessionId;
} }
public function getRegisterTime() public function _getRegisterTime()
{ {
$registertime = phpcommon\extractRegisterTimeFromSessionId($this->sessionId); $registertime = phpcommon\extractRegisterTimeFromSessionId($this->sessionId);
return $registertime; return $registertime;
} }
public function getMysql($data) public function _getMysql($data)
{ {
$mysql_conf = getMysqlConfig(crc32($data)); $mysql_conf = getMysqlConfig(crc32($data));
$conn = new phpcommon\Mysql(array( $conn = new phpcommon\Mysql(array(
@ -58,7 +58,7 @@ class BaseAuthedController extends BaseController {
return $conn; return $conn;
} }
public function getSelfMysql() public function _getSelfMysql()
{ {
if (!$this->mysqlConn) { if (!$this->mysqlConn) {
$this->mysqlConn = $this->getMysql($this->getAccountId()); $this->mysqlConn = $this->getMysql($this->getAccountId());
@ -66,7 +66,7 @@ class BaseAuthedController extends BaseController {
return $this->mysqlConn; return $this->mysqlConn;
} }
public function getRedis($data) public function _getRedis($data)
{ {
$redis_conf = getRedisConfig(crc32($data)); $redis_conf = getRedisConfig(crc32($data));
$r = new phpcommon\Redis(array( $r = new phpcommon\Redis(array(
@ -78,12 +78,12 @@ class BaseAuthedController extends BaseController {
return $r; return $r;
} }
public function isValidSex($sex) public function _isValidSex($sex)
{ {
return in_array($sex, array(0, 1, 2)); return in_array($sex, array(0, 1, 2));
} }
public function getUserInfo($fields) public function _getUserInfo($fields)
{ {
$row = SqlHelper::selectOne $row = SqlHelper::selectOne
($this->getSelfMysql(), ($this->getSelfMysql(),
@ -101,7 +101,7 @@ class BaseAuthedController extends BaseController {
return $row; return $row;
} }
public function getOrmUserInfo() public function _getOrmUserInfo()
{ {
$row = SqlHelper::ormSelectOne $row = SqlHelper::ormSelectOne
($this->getSelfMysql(), ($this->getSelfMysql(),
@ -118,7 +118,7 @@ class BaseAuthedController extends BaseController {
return $row; return $row;
} }
public function safeGetOrmUserInfo() public function _safeGetOrmUserInfo()
{ {
$row = SqlHelper::ormSelectOne $row = SqlHelper::ormSelectOne
($this->getSelfMysql(), ($this->getSelfMysql(),
@ -130,7 +130,7 @@ class BaseAuthedController extends BaseController {
return $row ? $row : null; return $row ? $row : null;
} }
public function updateUserInfo($fieldsKv) public function _updateUserInfo($fieldsKv)
{ {
SqlHelper::update SqlHelper::update
($this->getSelfMysql(), ($this->getSelfMysql(),
@ -142,7 +142,7 @@ class BaseAuthedController extends BaseController {
); );
} }
public function sendDataToClient($_code,$_msg,$_data) public function _sendDataToClient($_code,$_msg,$_data)
{ {
echo json_encode(array( echo json_encode(array(
'errcode' => $_code, 'errcode' => $_code,
@ -151,7 +151,7 @@ class BaseAuthedController extends BaseController {
)); ));
} }
public function getItem($itemId) public function _getItem($itemId)
{ {
$row = SqlHelper::selectOne $row = SqlHelper::selectOne
($this->getSelfMysql(), ($this->getSelfMysql(),
@ -173,7 +173,7 @@ class BaseAuthedController extends BaseController {
); );
} }
public function getItemCount($itemId, $userInfo) public function _getItemCount($itemId, $userInfo)
{ {
switch ($itemId) { switch ($itemId) {
case V_ITEM_GOLD: case V_ITEM_GOLD:
@ -210,7 +210,7 @@ class BaseAuthedController extends BaseController {
} }
} }
public function isVirtualItem($itemId) public function _isVirtualItem($itemId)
{ {
$isVirtualItem = false; $isVirtualItem = false;
if($itemId == $this->goldID) if($itemId == $this->goldID)
@ -224,7 +224,7 @@ class BaseAuthedController extends BaseController {
return $isVirtualItem; return $isVirtualItem;
} }
public function addItem($items) public function _addItem($items)
{ {
foreach ($items as $item) { foreach ($items as $item) {
if ($this->isVirtualItem($item['item_id'])) { if ($this->isVirtualItem($item['item_id'])) {
@ -261,12 +261,12 @@ class BaseAuthedController extends BaseController {
} }
} }
public function decItems($items) public function _decItems($items)
{ {
$this->decItem($items); $this->decItem($items);
} }
public function decItem($items) public function _decItem($items)
{ {
foreach ($items as $item) { foreach ($items as $item) {
if ($this->isVirtualItem($item['item_id'])) { if ($this->isVirtualItem($item['item_id'])) {
@ -292,7 +292,7 @@ class BaseAuthedController extends BaseController {
} }
} }
public function deleteItem($item) public function _deleteItem($item)
{ {
$tmpItemID = $item["item_id"]; $tmpItemID = $item["item_id"];
$beDeleteNum = $item['item_num']; $beDeleteNum = $item['item_num'];
@ -317,7 +317,7 @@ class BaseAuthedController extends BaseController {
return $code; return $code;
} }
public function decGold($decGold) public function _decGold($decGold)
{ {
SqlHelper::update SqlHelper::update
( (
@ -334,7 +334,7 @@ class BaseAuthedController extends BaseController {
// $this->incV(TN_CONSUME_GOLD, $this->getNowDaySeconds(), $decGold); // $this->incV(TN_CONSUME_GOLD, $this->getNowDaySeconds(), $decGold);
} }
public function addGold($addGold) public function _addGold($addGold)
{ {
SqlHelper::update SqlHelper::update
( (
@ -349,7 +349,7 @@ class BaseAuthedController extends BaseController {
); );
} }
public function getTalentLv($skillId, $skillTypeId) public function _getTalentLv($skillId, $skillTypeId)
{ {
$row = SqlHelper::selectOne $row = SqlHelper::selectOne
( (
@ -369,7 +369,7 @@ class BaseAuthedController extends BaseController {
return $row ? $row['skill_iv'] : 0; return $row ? $row['skill_iv'] : 0;
} }
public function hasEnoughItemsEx($items, &$lackItem) public function _hasEnoughItemsEx($items, &$lackItem)
{ {
$userInfo = $this->getUserInfo(array( $userInfo = $this->getUserInfo(array(
'coin_num', 'coin_num',
@ -390,7 +390,7 @@ class BaseAuthedController extends BaseController {
return true; return true;
} }
public function getUsingEquipId() public function _getUsingEquipId()
{ {
$row = SqlHelper::selectOne $row = SqlHelper::selectOne
($this->getSelfMysql(), ($this->getSelfMysql(),
@ -405,14 +405,14 @@ class BaseAuthedController extends BaseController {
return $row ? $row['using_id'] : 0; return $row ? $row['using_id'] : 0;
} }
public function redisSetAndExpire($pk, $key, $val, $time) public function _redisSetAndExpire($pk, $key, $val, $time)
{ {
$r = $this->getRedis($pk); $r = $this->getRedis($pk);
$r->set($key, $val); $r->set($key, $val);
$r->pexpire($key, $time); $r->pexpire($key, $time);
} }
public function redisGetJson($pk, $key) public function _redisGetJson($pk, $key)
{ {
$r = $this->getRedis($pk); $r = $this->getRedis($pk);
$dataStr = $r->get($key); $dataStr = $r->get($key);