hero skin
This commit is contained in:
parent
a1482b9c0e
commit
6deeb17c7c
@ -186,6 +186,7 @@ DROP TABLE IF EXISTS `t_hero_skin`;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `t_hero_skin` (
|
||||
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
`token_id` varchar(60) COMMENT 'token_id',
|
||||
`account_id` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT 'account_id',
|
||||
`skin_id` int(11) NOT NULL DEFAULT '0' COMMENT '英雄皮肤id',
|
||||
`hero_id` int(11) NOT NULL DEFAULT '0' COMMENT '英雄id',
|
||||
@ -196,7 +197,8 @@ CREATE TABLE `t_hero_skin` (
|
||||
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||
PRIMARY KEY (`idx`),
|
||||
UNIQUE KEY `account_id_skinid` (`account_id`, `skin_id`)
|
||||
UNIQUE KEY `token_id` (`token_id`),
|
||||
KEY `account_id` (`account_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
|
@ -486,7 +486,11 @@ class BaseAuthedController extends BaseController {
|
||||
break;
|
||||
case mt\Item::HERO_SKIN_TYPE:
|
||||
{
|
||||
HeroSkin::addSkin($itemMeta);
|
||||
if (isset($item['is_payed']) && $item['is_payed']) {
|
||||
HeroSkin::addHeroSkin($itemMeta);
|
||||
} else {
|
||||
HeroSkin::addFreeHeroSkin($itemMeta);
|
||||
}
|
||||
$propertyService->addHeroSkinChg();
|
||||
}
|
||||
break;
|
||||
|
@ -365,7 +365,7 @@ class BattleController extends BaseAuthedController {
|
||||
$info['is_valid_battle'] = 1;
|
||||
$info['hero_dto'] = Hero::toDto($heroDb);
|
||||
{//选用皮肤id
|
||||
$skinDb = HeroSkin::findBx($heroDb['hero_id']);
|
||||
$skinDb = HeroSkin::findByAccountId($member['account_id'],$heroDb['skin_id']);
|
||||
if ($skinDb){
|
||||
$info['hero_dto']['skin_id'] = $skinDb['skin_id'];
|
||||
}
|
||||
|
@ -94,50 +94,50 @@ class HeroController extends BaseAuthedController {
|
||||
));
|
||||
}
|
||||
|
||||
public function skinList()
|
||||
{
|
||||
$heroId = getReqVal('hero_id',0);
|
||||
if (!$heroId){
|
||||
$this->_rspErr(1, "param null");
|
||||
return;
|
||||
}
|
||||
$itemMeta = \mt\Item::get($heroId);
|
||||
if (!$itemMeta || $itemMeta['type']!=\mt\Item::HERO_TYPE){
|
||||
$this->_rspErr(1, "param error");
|
||||
return;
|
||||
}
|
||||
$skinList = array();
|
||||
$skinMeta = \mt\Item::getMetaListByType(\mt\Item::HERO_SKIN_TYPE);
|
||||
if ($skinMeta){
|
||||
foreach ($skinMeta as $value){
|
||||
if ($value['playerid'] == $heroId){
|
||||
array_push($skinList,HeroSkin::toDto($value));
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->_rspData(array(
|
||||
'skin_list' => $skinList
|
||||
));
|
||||
}
|
||||
// public function skinList()
|
||||
// {
|
||||
// $heroId = getReqVal('hero_id',0);
|
||||
// if (!$heroId){
|
||||
// $this->_rspErr(1, "param null");
|
||||
// return;
|
||||
// }
|
||||
// $itemMeta = \mt\Item::get($heroId);
|
||||
// if (!$itemMeta || $itemMeta['type']!=\mt\Item::HERO_TYPE){
|
||||
// $this->_rspErr(1, "param error");
|
||||
// return;
|
||||
// }
|
||||
// $skinList = array();
|
||||
// $skinMeta = \mt\Item::getMetaListByType(\mt\Item::HERO_SKIN_TYPE);
|
||||
// if ($skinMeta){
|
||||
// foreach ($skinMeta as $value){
|
||||
// if ($value['playerid'] == $heroId){
|
||||
// array_push($skinList,HeroSkin::toDto($value));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// $this->_rspData(array(
|
||||
// 'skin_list' => $skinList
|
||||
// ));
|
||||
// }
|
||||
|
||||
public function takeonSkin()
|
||||
{
|
||||
$heroUniId = getReqVal('hero_uniid', 0);
|
||||
$skinId = getReqVal('skin_id', 0);
|
||||
$heroDb = Hero::find($heroUniId);
|
||||
$heroSkinDb = HeroSkin::find($skinId);
|
||||
if (!$heroDb) {
|
||||
$this->_rspErr(1, "You don't have the hero yet");
|
||||
return;
|
||||
}
|
||||
$itemMeta = \mt\Item::get($skinId);
|
||||
if ($itemMeta['isdefaultskin'] != 1 && !$heroSkinDb) {
|
||||
$this->_rspErr(2, "You don't have the skin yet");
|
||||
return;
|
||||
}
|
||||
HeroSkin::takeonSkin( $skinId,$heroDb['hero_id']);
|
||||
$this->_rspOk();
|
||||
}
|
||||
// public function takeonSkin()
|
||||
// {
|
||||
// $heroUniId = getReqVal('hero_uniid', 0);
|
||||
// $skinId = getReqVal('skin_id', 0);
|
||||
// $heroDb = Hero::find($heroUniId);
|
||||
// $heroSkinDb = HeroSkin::find($skinId);
|
||||
// if (!$heroDb) {
|
||||
// $this->_rspErr(1, "You don't have the hero yet");
|
||||
// return;
|
||||
// }
|
||||
// $itemMeta = \mt\Item::get($skinId);
|
||||
// if ($itemMeta['isdefaultskin'] != 1 && !$heroSkinDb) {
|
||||
// $this->_rspErr(2, "You don't have the skin yet");
|
||||
// return;
|
||||
// }
|
||||
// HeroSkin::takeonSkin( $skinId,$heroDb['hero_id']);
|
||||
// $this->_rspOk();
|
||||
// }
|
||||
|
||||
/*
|
||||
升级预览
|
||||
|
54
webapp/controller/HeroSkinController.class.php
Normal file
54
webapp/controller/HeroSkinController.class.php
Normal file
@ -0,0 +1,54 @@
|
||||
<?php
|
||||
require_once('models/Hero.php');
|
||||
require_once('models/HeroSkin.php');
|
||||
|
||||
use models\Hero;
|
||||
use models\HeroSkin;
|
||||
class HeroSkinController extends BaseAuthedController {
|
||||
|
||||
public function skinList()
|
||||
{
|
||||
$skinList = array();
|
||||
HeroSkin::getSkinList(function ($row) use(&$skinList) {
|
||||
array_push($heroList,$row);
|
||||
});
|
||||
$this->_rspData(array(
|
||||
'skin_list' => $skinList
|
||||
));
|
||||
}
|
||||
|
||||
public function takeonSkin()
|
||||
{
|
||||
$heroUniId = getReqVal('hero_uniid', 0);
|
||||
$skinUniId = getReqVal('skin_uniid', 0);
|
||||
$heroDb = Hero::find($heroUniId);
|
||||
$heroSkinDb = HeroSkin::find($skinUniId);
|
||||
if (!$heroDb) {
|
||||
$this->_rspErr(1, "You don't have the hero yet");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$heroSkinDb) {
|
||||
$this->_rspErr(1, "You don't have the skin yet");
|
||||
return;
|
||||
}
|
||||
Hero::update( $heroUniId,array(
|
||||
'skin_id' => $skinUniId
|
||||
));
|
||||
$this->_rspOk();
|
||||
}
|
||||
|
||||
public function unequip(){
|
||||
$heroUniId = getReqVal('hero_uniid', 0);
|
||||
$heroDb = Hero::find($heroUniId);
|
||||
if (!$heroDb) {
|
||||
$this->_rspErr(1, "You don't have the hero yet");
|
||||
return;
|
||||
}
|
||||
Hero::update( $heroUniId,array(
|
||||
'skin_id' => 0
|
||||
));
|
||||
$this->_rspOk();
|
||||
}
|
||||
|
||||
}
|
@ -125,6 +125,7 @@ class PassController extends BaseAuthedController
|
||||
array_push($items, array(
|
||||
'item_id' => $passMeta['platinum_item_id2'],
|
||||
'item_num' => $passMeta['platinum_item_num2'],
|
||||
'is_payed' => 1
|
||||
));
|
||||
if ($passMeta['platinum_item_id1'] == V_ITEM_GOLD){
|
||||
$gold += $passMeta['platinum_item_num1'];
|
||||
@ -206,6 +207,7 @@ class PassController extends BaseAuthedController
|
||||
array(
|
||||
'item_id' => $passMeta['platinum_item_id2'],
|
||||
'item_num' => $passMeta['platinum_item_num2'],
|
||||
'is_payed' => 1
|
||||
)
|
||||
);
|
||||
if ($passMeta['platinum_item_id1'] == V_ITEM_GOLD){
|
||||
|
@ -117,9 +117,8 @@ class RankingController extends BaseAuthedController {
|
||||
$heroDb = Hero::findByAccountId($row['account_id'],$row['hero_id']);
|
||||
|
||||
if ($heroDb){
|
||||
$heroItemId = $heroDb['hero_id'];
|
||||
$skinDb = HeroSkin::findByAccountId($row['account_id'],$heroItemId);
|
||||
$hero_skin = $skinDb['skin_id'];
|
||||
$skinDb = HeroSkin::findByAccountId($row['account_id'],$heroDb['skin_id']);
|
||||
$hero_skin = $skinDb ? $skinDb['skin_id'] : 0;
|
||||
}
|
||||
|
||||
$info = array(
|
||||
|
@ -517,39 +517,39 @@ class TeamController extends BaseAuthedController {
|
||||
$this->_rspOk();
|
||||
}
|
||||
|
||||
public function setHeroSkin(){
|
||||
$teamUuid = getReqVal('team_uuid', '');
|
||||
$heroUniId = getReqVal('hero_uid', 0);
|
||||
$skinId = getReqVal('skin_id', 0);
|
||||
$r = $this->_getRedis($teamUuid);
|
||||
$teamDb = $this->readTeamDb($r, $teamUuid);
|
||||
if (empty($teamDb)) {
|
||||
$this->_rspErr(1, 'The team has been disbanded');
|
||||
return;
|
||||
}
|
||||
$heroDb = Hero::find($heroUniId);
|
||||
$heroSkinDb = HeroSkin::find($skinId);
|
||||
if (!$heroDb) {
|
||||
$this->_rspErr(1, "You don't have the hero yet");
|
||||
return;
|
||||
}
|
||||
if (!$heroSkinDb) {
|
||||
$this->_rspErr(2, "You don't have the skin yet");
|
||||
return;
|
||||
}
|
||||
HeroSkin::takeonSkin( $skinId,$heroDb['hero_id']);
|
||||
$newUserInfo = User::toPreset($this->_getOrmUserInfo());
|
||||
foreach ($teamDb['member_list'] as &$member) {
|
||||
if ($member['account_id'] == $this->_getAccountId()){
|
||||
$newUserInfo['is_leader'] = $member['is_leader'];
|
||||
$newUserInfo['is_ready'] = $member['is_ready'];
|
||||
$member = $newUserInfo;
|
||||
}
|
||||
|
||||
}
|
||||
$this->saveTeamDb($r, $teamUuid, $teamDb);
|
||||
$this->_rspOk();
|
||||
}
|
||||
// public function setHeroSkin(){
|
||||
// $teamUuid = getReqVal('team_uuid', '');
|
||||
// $heroUniId = getReqVal('hero_uid', 0);
|
||||
// $skinId = getReqVal('skin_id', 0);
|
||||
// $r = $this->_getRedis($teamUuid);
|
||||
// $teamDb = $this->readTeamDb($r, $teamUuid);
|
||||
// if (empty($teamDb)) {
|
||||
// $this->_rspErr(1, 'The team has been disbanded');
|
||||
// return;
|
||||
// }
|
||||
// $heroDb = Hero::find($heroUniId);
|
||||
// $heroSkinDb = HeroSkin::find($skinId);
|
||||
// if (!$heroDb) {
|
||||
// $this->_rspErr(1, "You don't have the hero yet");
|
||||
// return;
|
||||
// }
|
||||
// if (!$heroSkinDb) {
|
||||
// $this->_rspErr(2, "You don't have the skin yet");
|
||||
// return;
|
||||
// }
|
||||
// HeroSkin::takeonSkin( $skinId,$heroDb['hero_id']);
|
||||
// $newUserInfo = User::toPreset($this->_getOrmUserInfo());
|
||||
// foreach ($teamDb['member_list'] as &$member) {
|
||||
// if ($member['account_id'] == $this->_getAccountId()){
|
||||
// $newUserInfo['is_leader'] = $member['is_leader'];
|
||||
// $newUserInfo['is_ready'] = $member['is_ready'];
|
||||
// $member = $newUserInfo;
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// $this->saveTeamDb($r, $teamUuid, $teamDb);
|
||||
// $this->_rspOk();
|
||||
// }
|
||||
|
||||
public function getPveFragmentNumOrDay(){
|
||||
$todayPveGetHeroFragmentNum = myself()->_getDailyV(TN_DAILY_PVE_GET_HERO_FRAGMENT_NUM, 0);
|
||||
|
@ -272,7 +272,7 @@ class Hero extends BaseModel {
|
||||
if ($row['idx'] == $userDb['hero_id']){
|
||||
$isSelect = 1;
|
||||
}
|
||||
$skinDb = HeroSkin::findBx($row['hero_id']);
|
||||
$skinDb = HeroSkin::find($row['skin_id']);
|
||||
$dto = array(
|
||||
'idx' => $row['idx'],
|
||||
'token_id' => $row['token_id'],
|
||||
@ -375,14 +375,14 @@ class Hero extends BaseModel {
|
||||
|
||||
public static function internalAddHero($conn, $heroMeta, $accountId, $tokenId,$type)
|
||||
{
|
||||
$skinItemMeta = \mt\Item::getMetaListByType(\mt\Item::HERO_SKIN_TYPE);
|
||||
if ($skinItemMeta){
|
||||
foreach ($skinItemMeta as $value){
|
||||
if ($value['playerid'] == $heroMeta['id'] && $value['isdefaultskin'] ==1){
|
||||
HeroSkin::addSkin($value);
|
||||
}
|
||||
}
|
||||
}
|
||||
// $skinItemMeta = \mt\Item::getMetaListByType(\mt\Item::HERO_SKIN_TYPE);
|
||||
// if ($skinItemMeta){
|
||||
// foreach ($skinItemMeta as $value){
|
||||
// if ($value['playerid'] == $heroMeta['id'] && $value['isdefaultskin'] ==1){
|
||||
// HeroSkin::addSkin($value);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
$state = $type > 0 ? self::GETED_STATE : self::FREE_STATE;
|
||||
$realHeroMeta = mt\Hero::get($heroMeta['id']);
|
||||
$randAttr = self::getRandAttr($heroMeta['id'],$type) ;
|
||||
|
@ -3,89 +3,80 @@
|
||||
namespace models;
|
||||
|
||||
require_once('mt/Hero.php');
|
||||
require_once('services/NftService.php');
|
||||
|
||||
use mt;
|
||||
use services\NftService;
|
||||
use phpcommon\SqlHelper;
|
||||
|
||||
class HeroSkin extends BaseModel {
|
||||
|
||||
const GETED_STATE = 0;
|
||||
const TRY_USING_STATE = 1;
|
||||
const FREE_STATE = 1;
|
||||
|
||||
public static function find($skinId)
|
||||
// public static function find($skinId)
|
||||
// {
|
||||
// $row = SqlHelper::ormSelectOne(
|
||||
// myself()->_getSelfMysql(),
|
||||
// 't_hero_skin',
|
||||
// array(
|
||||
// 'account_id' => myself()->_getAccountId(),
|
||||
// 'skin_id' => $skinId
|
||||
// )
|
||||
// );
|
||||
// return $row;
|
||||
// }
|
||||
public static function find($skinUniId)
|
||||
{
|
||||
$row = SqlHelper::ormSelectOne(
|
||||
myself()->_getSelfMysql(),
|
||||
't_hero_skin',
|
||||
array(
|
||||
'account_id' => myself()->_getAccountId(),
|
||||
'skin_id' => $skinId
|
||||
)
|
||||
);
|
||||
return $row;
|
||||
return self::internalFind(myself()->_getAccountId(), myself()->_getAddress(), $skinUniId);
|
||||
}
|
||||
|
||||
public static function findBx($heroId)
|
||||
// public static function findBx($accountId,$skinUniId)
|
||||
// {
|
||||
// return self::internalFind($accountId, User::findUserAddress($accountId), $skinUniId);
|
||||
// }
|
||||
|
||||
public static function findByAccountId($accountId, $skinUniId)
|
||||
{
|
||||
$row = SqlHelper::ormSelectOne(
|
||||
myself()->_getSelfMysql(),
|
||||
't_hero_skin',
|
||||
array(
|
||||
'account_id' => myself()->_getAccountId(),
|
||||
'hero_id' => $heroId
|
||||
)
|
||||
);
|
||||
return $row;
|
||||
}
|
||||
public static function findByAccountId($accountId, $heroId)
|
||||
{
|
||||
$row = SqlHelper::ormSelectOne(
|
||||
myself()->_getSelfMysql(),
|
||||
't_hero_skin',
|
||||
array(
|
||||
'account_id' => $accountId,
|
||||
'hero_id' => $heroId
|
||||
)
|
||||
);
|
||||
return $row;
|
||||
return self::internalFind($accountId, User::findUserAddress($accountId), $skinUniId);
|
||||
}
|
||||
|
||||
public static function takeonSkin($skinId,$heroId){
|
||||
$row = self::findBx($heroId);
|
||||
SqlHelper::update(
|
||||
myself()->_getSelfMysql(),
|
||||
't_hero_skin',
|
||||
array(
|
||||
'account_id' => myself()->_getAccountId(),
|
||||
'skin_id' => $row['skin_id']
|
||||
),
|
||||
array(
|
||||
'hero_id'=>0
|
||||
)
|
||||
);
|
||||
SqlHelper::upsert(
|
||||
myself()->_getSelfMysql(),
|
||||
't_hero_skin',
|
||||
array(
|
||||
'account_id' => myself()->_getAccountId(),
|
||||
'skin_id' => $skinId
|
||||
),
|
||||
array(
|
||||
'hero_id'=>$heroId
|
||||
),
|
||||
array(
|
||||
'account_id' => myself()->_getAccountId(),
|
||||
'skin_id' => $skinId,
|
||||
'skin_state' => 0,
|
||||
'get_from' => 0,
|
||||
'consume_num' => 0,
|
||||
'try_expire_at' => 0,
|
||||
'hero_id' => $heroId,
|
||||
'createtime' => myself()->_getNowTime(),
|
||||
'modifytime' => myself()->_getNowTime()
|
||||
)
|
||||
);
|
||||
}
|
||||
// public static function takeonSkin($skinId,$heroId){
|
||||
// $row = self::findBx($heroId);
|
||||
// SqlHelper::update(
|
||||
// myself()->_getSelfMysql(),
|
||||
// 't_hero_skin',
|
||||
// array(
|
||||
// 'account_id' => myself()->_getAccountId(),
|
||||
// 'skin_id' => $row['skin_id']
|
||||
// ),
|
||||
// array(
|
||||
// 'hero_id'=>0
|
||||
// )
|
||||
// );
|
||||
// SqlHelper::upsert(
|
||||
// myself()->_getSelfMysql(),
|
||||
// 't_hero_skin',
|
||||
// array(
|
||||
// 'account_id' => myself()->_getAccountId(),
|
||||
// 'skin_id' => $skinId
|
||||
// ),
|
||||
// array(
|
||||
// 'hero_id'=>$heroId
|
||||
// ),
|
||||
// array(
|
||||
// 'account_id' => myself()->_getAccountId(),
|
||||
// 'skin_id' => $skinId,
|
||||
// 'skin_state' => 0,
|
||||
// 'get_from' => 0,
|
||||
// 'consume_num' => 0,
|
||||
// 'try_expire_at' => 0,
|
||||
// 'hero_id' => $heroId,
|
||||
// 'createtime' => myself()->_getNowTime(),
|
||||
// 'modifytime' => myself()->_getNowTime()
|
||||
// )
|
||||
// );
|
||||
// }
|
||||
|
||||
|
||||
public static function getSkinList($cb){
|
||||
@ -99,6 +90,20 @@ class HeroSkin extends BaseModel {
|
||||
$cb($row);
|
||||
}
|
||||
);
|
||||
foreach (NftService::getHeroSkin(myself()->_getAddress()) as $nftDb) {
|
||||
if (! $nftDb['deleted']){
|
||||
$row = SqlHelper::ormSelectOne(
|
||||
myself()->_getSelfMysql(),
|
||||
't_hero_skin',
|
||||
array(
|
||||
'token_id' => $nftDb['token_id'],
|
||||
)
|
||||
);
|
||||
if ($row) {
|
||||
$cb($row);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -120,32 +125,100 @@ class HeroSkin extends BaseModel {
|
||||
);
|
||||
}
|
||||
|
||||
public static function addSkin($itemMeta)
|
||||
// public static function addSkin($itemMeta)
|
||||
// {
|
||||
// $heroId = 0;
|
||||
// if ($itemMeta['isdefaultskin'] == 1){
|
||||
// $heroId = $itemMeta['playerid'];
|
||||
// }
|
||||
// SqlHelper::upsert(
|
||||
// myself()->_getSelfMysql(),
|
||||
// 't_hero_skin',
|
||||
// array(
|
||||
// 'account_id' => myself()->_getAccountId(),
|
||||
// 'skin_id' => $itemMeta['id']
|
||||
// ),
|
||||
// array(),
|
||||
// array(
|
||||
// 'account_id' => myself()->_getAccountId(),
|
||||
// 'skin_id' => $itemMeta['id'],
|
||||
// 'skin_state' => 0,
|
||||
// 'get_from' => 0,
|
||||
// 'consume_num' => 0,
|
||||
// 'try_expire_at' => 0,
|
||||
// 'hero_id' => $heroId,
|
||||
// 'createtime' => myself()->_getNowTime(),
|
||||
// 'modifytime' => myself()->_getNowTime()
|
||||
// )
|
||||
// );
|
||||
// }
|
||||
|
||||
|
||||
private static function internalFind($accountId, $address, $skinUniId)
|
||||
{
|
||||
$heroId = 0;
|
||||
if ($itemMeta['isdefaultskin'] == 1){
|
||||
$heroId = $itemMeta['playerid'];
|
||||
}
|
||||
SqlHelper::upsert(
|
||||
myself()->_getSelfMysql(),
|
||||
$row = SqlHelper::ormSelectOne(
|
||||
myself()->_getMysql($accountId),
|
||||
't_hero_skin',
|
||||
array(
|
||||
'account_id' => myself()->_getAccountId(),
|
||||
'skin_id' => $itemMeta['id']
|
||||
),
|
||||
array(),
|
||||
array(
|
||||
'account_id' => myself()->_getAccountId(),
|
||||
'skin_id' => $itemMeta['id'],
|
||||
'skin_state' => 0,
|
||||
'get_from' => 0,
|
||||
'consume_num' => 0,
|
||||
'try_expire_at' => 0,
|
||||
'hero_id' => $heroId,
|
||||
'createtime' => myself()->_getNowTime(),
|
||||
'modifytime' => myself()->_getNowTime()
|
||||
'idx' => $skinUniId,
|
||||
)
|
||||
);
|
||||
if ($row) {
|
||||
$row['skin_uniid'] = $row['idx'];
|
||||
if ($row['account_id'] != $accountId) {
|
||||
$openId = $address;
|
||||
if (!NftService::isHeroSkinOwner($openId, $row['token_id'])) {
|
||||
$row = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $row;
|
||||
}
|
||||
|
||||
public static function addFreeHeroSkin($heroSkinMeta)
|
||||
{
|
||||
return self::internalAddHeroSkin(
|
||||
myself()->_getSelfMysql(),
|
||||
$heroSkinMeta,
|
||||
myself()->_getAccountId(),
|
||||
null,
|
||||
self::FREE_STATE);
|
||||
}
|
||||
|
||||
public static function addHeroSkin($heroSkinMeta)
|
||||
{
|
||||
return self::internalAddHeroSkin(
|
||||
myself()->_getSelfMysql(),
|
||||
$heroSkinMeta,
|
||||
myself()->_getAccountId(),
|
||||
null,
|
||||
self::GETED_STATE);
|
||||
}
|
||||
|
||||
private static function internalAddHeroSkin($conn, $heroSkinMeta, $accountId, $tokenId,$state)
|
||||
{
|
||||
$fieldsKv = array(
|
||||
|
||||
'skin_id' => $heroSkinMeta['id'],
|
||||
'skin_state' => $state,
|
||||
'get_from' => 0,
|
||||
'consume_num' => 0,
|
||||
'try_expire_at' => 0,
|
||||
'hero_id' => $heroSkinMeta['playerid'],
|
||||
'createtime' => myself()->_getNowTime(),
|
||||
'modifytime' => myself()->_getNowTime()
|
||||
);
|
||||
if ($accountId) {
|
||||
$fieldsKv['account_id'] = $accountId;
|
||||
}
|
||||
if ($tokenId) {
|
||||
$fieldsKv['token_id'] = $tokenId;
|
||||
}
|
||||
SqlHelper::insert(
|
||||
$conn,
|
||||
't_hero_skin',
|
||||
$fieldsKv
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ class Nft extends BaseModel
|
||||
const BLIND_BOX_TYPE = 4;
|
||||
const FRAGMENT_TYPE = 5; //碎片
|
||||
const HONOR1_TYPE = 6; //荣誉
|
||||
const HERO_SKIN_TYPE = 9; //英雄皮肤
|
||||
const RING_TYPE = 19; //戒指
|
||||
|
||||
const GENESIS_TAG = 1;
|
||||
|
@ -283,7 +283,11 @@ class User extends BaseModel {
|
||||
$heroId = $heroDb['hero_id'];
|
||||
}
|
||||
$preset = HeroPreset::getHeroPreset($row['hero_id']);
|
||||
$skinDb = HeroSkin::findBx($heroId);
|
||||
$skinDb = HeroSkin::findByAccountId($row['account_id'],$heroDb['skin_id']);
|
||||
$skin_id = 0;
|
||||
if ($skinDb){
|
||||
$skin_id = $skinDb['skin_id'];
|
||||
}
|
||||
$honorInfo = array();
|
||||
if ($row['address']){
|
||||
$honorInfo = UserHonor::info($row['address']);
|
||||
@ -307,7 +311,7 @@ class User extends BaseModel {
|
||||
'parachute' => $row['parachute'] ? $row['parachute'] : Parachute::$parachute,
|
||||
'hero_uniId' => $row['hero_id'],
|
||||
'hero_id' => $heroId,
|
||||
'hero_skin' =>$skinDb['skin_id'],
|
||||
'hero_skin' =>$skin_id,
|
||||
'presetInfo' => $preset,
|
||||
'is_leader' => 0,
|
||||
'is_ready' => 0,
|
||||
|
@ -21,6 +21,7 @@ class NftService extends BaseService {
|
||||
'equip' => Nft::EQUIP_TYPE,
|
||||
'chip' => Nft::CHIP_TYPE,
|
||||
'ring' => Nft::RING_TYPE,
|
||||
'heroSkin' => Nft::HERO_SKIN_TYPE,
|
||||
);
|
||||
|
||||
public static function getChipBlance($account, $tokenId)
|
||||
@ -43,6 +44,11 @@ class NftService extends BaseService {
|
||||
return self::internalIsOwner($openId, 'chip', $tokenId);
|
||||
}
|
||||
|
||||
public static function isHeroSkinOwner($openId, $tokenId)
|
||||
{
|
||||
return self::internalIsOwner($openId, 'heroSkin', $tokenId);
|
||||
}
|
||||
|
||||
public static function getHeros($openId)
|
||||
{
|
||||
return self::internalGetList($openId, 'hero');
|
||||
@ -58,6 +64,10 @@ class NftService extends BaseService {
|
||||
return self::internalGetList($openId, 'chip');
|
||||
}
|
||||
|
||||
public static function getHeroSkin($openId)
|
||||
{
|
||||
return self::internalGetList($openId, 'heroSkin');
|
||||
}
|
||||
public static function getRing($openId)
|
||||
{
|
||||
return self::internalGetList($openId, 'ring');
|
||||
|
Loading…
x
Reference in New Issue
Block a user