Merge branch 'star' of git.kingsome.cn:server/game2006api into star
This commit is contained in:
commit
8ba7d42e8f
@ -168,10 +168,10 @@ class BaseAuthedController extends BaseController {
|
||||
|
||||
public function _getAddress()
|
||||
{
|
||||
if ($addressActived) {
|
||||
if (!$this->addressActived) {
|
||||
$userDb = $this->_getOrmUserInfo();
|
||||
$this->address = $userDb['address'];
|
||||
$addressActived = true;
|
||||
$this->addressActived = true;
|
||||
}
|
||||
return $this->address;
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ use services\NftService;
|
||||
use services\FormulaService;
|
||||
use services\ContractConfig;
|
||||
use models\ChipPlugin;
|
||||
|
||||
use models\User;
|
||||
|
||||
class Hero extends BaseModel {
|
||||
|
||||
@ -43,7 +43,7 @@ class Hero extends BaseModel {
|
||||
|
||||
public static function find($heroUniId)
|
||||
{
|
||||
return self::internalFind(myself()->_getAccountId(), $heroUniId);
|
||||
return self::internalFind(myself()->_getAccountId(), myself()->_getAddress(), $heroUniId);
|
||||
}
|
||||
|
||||
public static function findEx($heroUniId){
|
||||
@ -64,7 +64,7 @@ class Hero extends BaseModel {
|
||||
|
||||
public static function findByAccountId($accountId, $heroUniId)
|
||||
{
|
||||
return self::internalFind($accountId, $heroUniId);
|
||||
return self::internalFind($accountId, User::findUserAddress($accountId), $heroUniId);
|
||||
}
|
||||
|
||||
public static function findByTokenId($tokenId)
|
||||
@ -97,7 +97,7 @@ class Hero extends BaseModel {
|
||||
return $row;
|
||||
}
|
||||
|
||||
private static function internalFind($accountId, $heroUniId)
|
||||
private static function internalFind($accountId, $address, $heroUniId)
|
||||
{
|
||||
$row = SqlHelper::ormSelectOne(
|
||||
myself()->_getMysql($accountId),
|
||||
@ -109,7 +109,7 @@ class Hero extends BaseModel {
|
||||
if ($row) {
|
||||
$row['hero_uniid'] = $row['idx'];
|
||||
if ($row['account_id'] != $accountId) {
|
||||
$openId = phpcommon\extractOpenId($accountId);
|
||||
$openId = $address;
|
||||
if (!NftService::isHeroOwner($openId, $row['token_id'])) {
|
||||
$row = null;
|
||||
}
|
||||
|
@ -32,6 +32,18 @@ class User extends BaseModel {
|
||||
return $row ? $row : null;
|
||||
}
|
||||
|
||||
public static function findUserAddress($accountId)
|
||||
{
|
||||
$row = SqlHelper::ormSelectOne
|
||||
(myself()->_getMysql($targetId),
|
||||
't_user',
|
||||
array(
|
||||
'account_id' => $targetId
|
||||
)
|
||||
);
|
||||
return $row ? $row['address'] : null;
|
||||
}
|
||||
|
||||
public static function getListByGuildId($guildId)
|
||||
{
|
||||
$rows = SqlHelper::ormSelect
|
||||
|
Loading…
x
Reference in New Issue
Block a user