1
This commit is contained in:
parent
e08b4d4647
commit
da08012e00
@ -37,14 +37,8 @@ class HeroController extends BaseAuthedController {
|
|||||||
public function heroList()
|
public function heroList()
|
||||||
{
|
{
|
||||||
$heroList = array();
|
$heroList = array();
|
||||||
$userDb = myself()->_getOrmUserInfo();
|
Hero::getHeroList(function ($row) use(&$heroList) {
|
||||||
Hero::getHeroList(function ($row) use(&$heroList,$userDb) {
|
array_push($heroList, Hero::listDto($row));
|
||||||
$row['hero_uniid'] = $row['idx'];
|
|
||||||
$row['is_select'] = 0;
|
|
||||||
if ($row['idx'] == $userDb['hero_id']){
|
|
||||||
$row['is_select'] = 1;
|
|
||||||
}
|
|
||||||
array_push($heroList, $row);
|
|
||||||
});
|
});
|
||||||
$this->_rspData(array(
|
$this->_rspData(array(
|
||||||
'hero_list' => $heroList
|
'hero_list' => $heroList
|
||||||
|
@ -210,6 +210,42 @@ class Hero extends BaseModel {
|
|||||||
self::updateByTokenId($row['token_id'],$fieldsKv);
|
self::updateByTokenId($row['token_id'],$fieldsKv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function listDto($row){
|
||||||
|
$attr = emptyReplace(json_decode($row['rand_attr'], true), array());
|
||||||
|
$userDb = myself()->_getOrmUserInfo();
|
||||||
|
$isSelect = 0;
|
||||||
|
if ($row['idx'] == $userDb['hero_id']){
|
||||||
|
$isSelect = 1;
|
||||||
|
}
|
||||||
|
$heroMeta = \mt\Item::get($row['hero_id']);
|
||||||
|
$heroAtteMeta = \mt\EconomyAttribute::findByGrade($heroMeta['relationship'],$row['quality']);
|
||||||
|
$unsealTime = $row['unseal_time'] ? $row['unseal_time'] : $row['activate_time'];
|
||||||
|
$validTime = $unsealTime + 86400 * $heroAtteMeta['validTime'] ;
|
||||||
|
return array(
|
||||||
|
'idx' => $row['idx'],
|
||||||
|
'token_id' => $row['token_id'],
|
||||||
|
'hero_uniid' => $row['idx'],
|
||||||
|
'hero_id' => $row['hero_id'],
|
||||||
|
'hero_lv' => $row['hero_lv'],
|
||||||
|
'hero_tili' => $row['hero_tili'],
|
||||||
|
'state' => $row['state'],
|
||||||
|
'quality' => $row['quality'],
|
||||||
|
'skill_lv1' => $row['skill_lv1'],
|
||||||
|
'skill_lv2' => $row['skill_lv2'],
|
||||||
|
'rand_attr' => $attr,
|
||||||
|
'is_select' => $isSelect,
|
||||||
|
'lucky' => self::getHeroLucky($row),
|
||||||
|
'wealth' => self::getHeroWealth($row),
|
||||||
|
'seal_type' => $row['seal_type'],
|
||||||
|
'unseal_time' => $row['unseal_time'],
|
||||||
|
'valid_lefttime' => max(0,
|
||||||
|
$validTime - myself()->_getNowTime()),
|
||||||
|
'valid_time' => max(0,
|
||||||
|
86400 * $heroAtteMeta['validTime']),
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public static function toDto($row)
|
public static function toDto($row)
|
||||||
{
|
{
|
||||||
$attr = emptyReplace(json_decode($row['rand_attr'], true), array());
|
$attr = emptyReplace(json_decode($row['rand_attr'], true), array());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user