diff --git a/webapp/controller/BaseAuthedController.class.php b/webapp/controller/BaseAuthedController.class.php index 1a2d5aab..4fe226ec 100644 --- a/webapp/controller/BaseAuthedController.class.php +++ b/webapp/controller/BaseAuthedController.class.php @@ -39,6 +39,11 @@ class BaseAuthedController extends BaseController { return $this->accountId; } + public function _getOpenId() + { + return phpcommon\extractOpenId($this->_getAccountId()); + } + public function _getChannel() { return phpcommon\extractChannel($this->_getAccountId()); diff --git a/webapp/models/Bag.php b/webapp/models/Bag.php index 9b209990..831ff024 100644 --- a/webapp/models/Bag.php +++ b/webapp/models/Bag.php @@ -9,6 +9,7 @@ require_once('services/NftService.php'); use mt; use phpcommon\SqlHelper; +use services\NftService; class Bag extends BaseModel { @@ -69,16 +70,16 @@ class Bag extends BaseModel { public static function getItemList($cb) { SqlHelper::ormSelect( - $this->_getSelfMysql(), + myself()->_getSelfMysql(), 't_bag', array( - 'account_id' => $this->_getAccountId() + 'account_id' => myself()->_getAccountId() ), function ($row) use($cb) { $cb($row); } ); - foreach (services\NftService::getChips() as $nftDb) { + foreach (NftService::getChips() as $nftDb) { $row = SqlHelper::ormSelectOne( myself()->_getSelfMysql(), 't_bag', diff --git a/webapp/models/Gun.php b/webapp/models/Gun.php index 2902359e..0f527440 100644 --- a/webapp/models/Gun.php +++ b/webapp/models/Gun.php @@ -10,6 +10,7 @@ require_once('services/NftService.php'); use mt; use phpcommon\SqlHelper; +use services\NftService; class Gun extends BaseModel { @@ -32,7 +33,7 @@ class Gun extends BaseModel { if ($row) { $row['gun_uniid'] = $row['idx']; if ($row['account_id'] != myself()->_getAccountId()) { - if (!services\NftService::isEquipOwner($row['token_id'])) { + if (!NftService::isEquipOwner($row['token_id'])) { $row = null; } } @@ -54,16 +55,16 @@ class Gun extends BaseModel { public static function getGunList($cb) { SqlHelper::ormSelect( - $this->_getSelfMysql(), + myself()->_getSelfMysql(), 't_gun', array( - 'account_id' => $this->_getAccountId() + 'account_id' => myself()->_getAccountId() ), function ($row) use($cb) { $cb($row); } ); - foreach (services\NftService::getEquips() as $nftDb) { + foreach (NftService::getEquips() as $nftDb) { $row = SqlHelper::ormSelectOne( myself()->_getSelfMysql(), 't_gun', diff --git a/webapp/models/Hero.php b/webapp/models/Hero.php index 8a3df965..3f081ffa 100644 --- a/webapp/models/Hero.php +++ b/webapp/models/Hero.php @@ -12,6 +12,7 @@ require_once('services/NftService.php'); use mt; use phpcommon\SqlHelper; +use services\NftService; class Hero extends BaseModel { @@ -34,7 +35,7 @@ class Hero extends BaseModel { if ($row) { $row['hero_uniid'] = $row['idx']; if ($row['account_id'] != myself()->_getAccountId()) { - if (!services\NftService::isHeroOwner($row['token_id'])) { + if (!NftService::isHeroOwner($row['token_id'])) { $row = null; } } @@ -56,16 +57,16 @@ class Hero extends BaseModel { public static function getHeroList($cb) { SqlHelper::ormSelect( - $this->_getSelfMysql(), + myself()->_getSelfMysql(), 't_hero', array( - 'account_id' => $this->_getAccountId() + 'account_id' => myself()->_getAccountId() ), function ($row) use($cb) { $cb($row); } ); - foreach (services\NftService::getHeros() as $nftDb) { + foreach (NftService::getHeros() as $nftDb) { $row = SqlHelper::ormSelectOne( myself()->_getSelfMysql(), 't_hero',