From 50a40fd6ec818f45d128e63c287ec8b32ad6c634 Mon Sep 17 00:00:00 2001 From: hujiabin <519660157@qq.com> Date: Sun, 21 Apr 2024 15:01:21 +0800 Subject: [PATCH] 1 --- webapp/models/Hero.php | 22 ++++++------ webapp/models/User.php | 76 +----------------------------------------- 2 files changed, 13 insertions(+), 85 deletions(-) diff --git a/webapp/models/Hero.php b/webapp/models/Hero.php index 25aa885f..591ed3e0 100644 --- a/webapp/models/Hero.php +++ b/webapp/models/Hero.php @@ -367,16 +367,18 @@ class Hero extends BaseModel { $lucky += $heroResult['lucky']; $lucky_rate += $heroResult['lucky_rate']; $chipPageDb = ChipPage::find($row['idx']); - $data = emptyReplace(json_decode($chipPageDb['data'], true), array()); - foreach ($data as $value){ - $chipDb = Chip::find($value['chip_id']); - if ( $chipDb ) { - $chipAttrs = emptyReplace(json_decode($chipDb['wealth_attr'], true), array()); - $chipResult = \mt\EconomyAttribute::getAttrValue($chipAttrs); - $wealth += $chipResult['wealth']; - $wealth_rate += $chipResult['wealth_rate']; - $lucky += $chipResult['lucky']; - $lucky_rate += $chipResult['lucky_rate']; + if ($chipPageDb){ + $data = emptyReplace(json_decode($chipPageDb['data'], true), array()); + foreach ($data as $value){ + $chipDb = Chip::find($value['chip_id']); + if ( $chipDb ) { + $chipAttrs = emptyReplace(json_decode($chipDb['wealth_attr'], true), array()); + $chipResult = \mt\EconomyAttribute::getAttrValue($chipAttrs); + $wealth += $chipResult['wealth']; + $wealth_rate += $chipResult['wealth_rate']; + $lucky += $chipResult['lucky']; + $lucky_rate += $chipResult['lucky_rate']; + } } } return array( diff --git a/webapp/models/User.php b/webapp/models/User.php index fc8dfe1d..cc6f3b3e 100644 --- a/webapp/models/User.php +++ b/webapp/models/User.php @@ -71,34 +71,8 @@ class User extends BaseModel { public static function show($row) { -// mt\LevelUp::getExpByLv($row['level'],$row['exp']); - { - $current_star_num = $row['star_num']; - $currSeasonMeta = \mt\StarLevel::getCurrentSeason(); - $next_star_num = mt\StarLevel::getNextNeedStarNum($current_star_num,$currSeasonMeta['id']); - } $heroDb = Hero::find($row['hero_id']); $heroId = $heroDb['hero_id']; -// if ($heroDb){ -// $heroId = $heroDb['hero_id']; -// }else{ -// $heroUniId = 0; -// $heroId = 0; -// Hero::randHero($heroUniId,$heroId); -// $heroMeta = mt\Item::get($heroId); -// $headList = emptyReplace(json_decode($row['head_list'], true), array()); -// if ($heroMeta['hero_head'] && !in_array($heroMeta['hero_head'],$headList)){ -// array_push($headList,$heroMeta['hero_head']); -// } -// self::update(array( -// 'hero_id' => $heroUniId, -// 'head_id' => $heroMeta['hero_head'], -// 'head_frame' => 60000, -// 'head_list' => json_encode($headList), -// 'head_frame_list' => json_encode(array(60000)), -// )); -// $row = myself()->_getOrmUserInfo(); -// } $honorInfo = array(); if ($row['address']){ $honorInfo = UserHonor::info($row['address']); @@ -139,43 +113,15 @@ class User extends BaseModel { 'parachute_list' => Parachute::getMyParachute(), 'ring_id' => $row['ring_id'], 'ring_list' => UserSeasonRing::ringList($row['account_id']), - 'current_star_num' => $current_star_num, - 'next_star_num' => $next_star_num, -// 'status_bar' => self::_getState(), 'honor_info' => $honorInfo ); } public static function info($row) { -// mt\LevelUp::getExpByLv($row['level'],$row['exp']); - { - $current_star_num = $row['star_num']; - $currSeasonMeta = \mt\StarLevel::getCurrentSeason(); - $next_star_num = mt\StarLevel::getNextNeedStarNum($current_star_num,$currSeasonMeta['id']); - } + $heroDb = Hero::findByAccountId($row['account_id'],$row['hero_id']); $heroId = $heroDb['hero_id']; -// if ($heroDb){ -// $heroId = $heroDb['hero_id']; -// }else{ -// $heroUniId = 0; -// $heroId = 0; -// Hero::randHero($heroUniId,$heroId); -// $heroMeta = mt\Item::get($heroId); -// $headList = emptyReplace(json_decode($row['head_list'], true), array()); -// if ($heroMeta['hero_head'] && !in_array($heroMeta['hero_head'],$headList)){ -// array_push($headList,$heroMeta['hero_head']); -// } -// self::update(array( -// 'hero_id' => $heroUniId, -// 'head_id' => $heroMeta['hero_head'], -// 'head_frame' => 60000, -// 'head_list' => json_encode($headList), -// 'head_frame_list' => json_encode(array(60000)), -// )); -// $row = myself()->_getOrmUserInfo(); -// } $honorInfo = array(); if ($row['address']){ $honorInfo = UserHonor::info($row['address']); @@ -217,33 +163,13 @@ class User extends BaseModel { 'ring_list' => UserSeasonRing::ringList($row['account_id']), 'parachute' => $row['parachute'] ? $row['parachute'] : Parachute::$parachute, 'parachute_list' => Parachute::getMyParachute(), - 'current_star_num' => $current_star_num, - 'next_star_num' => $next_star_num, -// 'status_bar' => self::_getState(), 'honor_info' => $honorInfo, 'last_login_time' => $row['last_login_time'], ); } -// private static function _getState(){ -// $sign_state = 0; -// $signDb = SignLog::find(); -//// $paramMeta = \mt\Parameter::getByName('sign_daily_duration'); -//// $end_time = myself()->_getDaySeconds($signDb['createtime'])+$paramMeta['param_value']*24*60*60; -// if($signDb['days'] == 7 && $signDb['is_receive'] == 1){ -//// if ( myself()->_getNowTime() - $end_time > 0){ -// $sign_state = 1; -// } -// -// return array( -// "first_top_up" => myself()->_getV(TN_FIRST_TUPOP_STATUS,0), -// "sign_day" => $sign_state -// ); -// } - public static function toSimple($row) { -// mt\LevelUp::getExpByLv($row['level'],$row['exp']); $heroDb = Hero::find($row['hero_id']); if ($heroDb){ $heroId = $heroDb['hero_id'];