This commit is contained in:
aozhiwei 2022-03-31 09:19:49 +08:00
parent c7cd736412
commit c0ae79dd0c
4 changed files with 19 additions and 11 deletions

View File

@ -39,6 +39,11 @@ class BaseAuthedController extends BaseController {
return $this->accountId; return $this->accountId;
} }
public function _getOpenId()
{
return phpcommon\extractOpenId($this->_getAccountId());
}
public function _getChannel() public function _getChannel()
{ {
return phpcommon\extractChannel($this->_getAccountId()); return phpcommon\extractChannel($this->_getAccountId());

View File

@ -9,6 +9,7 @@ require_once('services/NftService.php');
use mt; use mt;
use phpcommon\SqlHelper; use phpcommon\SqlHelper;
use services\NftService;
class Bag extends BaseModel { class Bag extends BaseModel {
@ -69,16 +70,16 @@ class Bag extends BaseModel {
public static function getItemList($cb) public static function getItemList($cb)
{ {
SqlHelper::ormSelect( SqlHelper::ormSelect(
$this->_getSelfMysql(), myself()->_getSelfMysql(),
't_bag', 't_bag',
array( array(
'account_id' => $this->_getAccountId() 'account_id' => myself()->_getAccountId()
), ),
function ($row) use($cb) { function ($row) use($cb) {
$cb($row); $cb($row);
} }
); );
foreach (services\NftService::getChips() as $nftDb) { foreach (NftService::getChips() as $nftDb) {
$row = SqlHelper::ormSelectOne( $row = SqlHelper::ormSelectOne(
myself()->_getSelfMysql(), myself()->_getSelfMysql(),
't_bag', 't_bag',

View File

@ -10,6 +10,7 @@ require_once('services/NftService.php');
use mt; use mt;
use phpcommon\SqlHelper; use phpcommon\SqlHelper;
use services\NftService;
class Gun extends BaseModel { class Gun extends BaseModel {
@ -32,7 +33,7 @@ class Gun extends BaseModel {
if ($row) { if ($row) {
$row['gun_uniid'] = $row['idx']; $row['gun_uniid'] = $row['idx'];
if ($row['account_id'] != myself()->_getAccountId()) { if ($row['account_id'] != myself()->_getAccountId()) {
if (!services\NftService::isEquipOwner($row['token_id'])) { if (!NftService::isEquipOwner($row['token_id'])) {
$row = null; $row = null;
} }
} }
@ -54,16 +55,16 @@ class Gun extends BaseModel {
public static function getGunList($cb) public static function getGunList($cb)
{ {
SqlHelper::ormSelect( SqlHelper::ormSelect(
$this->_getSelfMysql(), myself()->_getSelfMysql(),
't_gun', 't_gun',
array( array(
'account_id' => $this->_getAccountId() 'account_id' => myself()->_getAccountId()
), ),
function ($row) use($cb) { function ($row) use($cb) {
$cb($row); $cb($row);
} }
); );
foreach (services\NftService::getEquips() as $nftDb) { foreach (NftService::getEquips() as $nftDb) {
$row = SqlHelper::ormSelectOne( $row = SqlHelper::ormSelectOne(
myself()->_getSelfMysql(), myself()->_getSelfMysql(),
't_gun', 't_gun',

View File

@ -12,6 +12,7 @@ require_once('services/NftService.php');
use mt; use mt;
use phpcommon\SqlHelper; use phpcommon\SqlHelper;
use services\NftService;
class Hero extends BaseModel { class Hero extends BaseModel {
@ -34,7 +35,7 @@ class Hero extends BaseModel {
if ($row) { if ($row) {
$row['hero_uniid'] = $row['idx']; $row['hero_uniid'] = $row['idx'];
if ($row['account_id'] != myself()->_getAccountId()) { if ($row['account_id'] != myself()->_getAccountId()) {
if (!services\NftService::isHeroOwner($row['token_id'])) { if (!NftService::isHeroOwner($row['token_id'])) {
$row = null; $row = null;
} }
} }
@ -56,16 +57,16 @@ class Hero extends BaseModel {
public static function getHeroList($cb) public static function getHeroList($cb)
{ {
SqlHelper::ormSelect( SqlHelper::ormSelect(
$this->_getSelfMysql(), myself()->_getSelfMysql(),
't_hero', 't_hero',
array( array(
'account_id' => $this->_getAccountId() 'account_id' => myself()->_getAccountId()
), ),
function ($row) use($cb) { function ($row) use($cb) {
$cb($row); $cb($row);
} }
); );
foreach (services\NftService::getHeros() as $nftDb) { foreach (NftService::getHeros() as $nftDb) {
$row = SqlHelper::ormSelectOne( $row = SqlHelper::ormSelectOne(
myself()->_getSelfMysql(), myself()->_getSelfMysql(),
't_hero', 't_hero',