This commit is contained in:
aozhiwei 2021-12-07 16:01:32 +08:00
parent c32c4a2793
commit cd885b85d6

View File

@ -52,6 +52,7 @@ class UserController extends BaseAuthedController {
$gold = 0;
$diamond = 0;
$heroList = array();
$haveHeadHeroList = array();
$headList = array();
$headFrameList = array();
$addItems = array();
@ -60,7 +61,10 @@ class UserController extends BaseAuthedController {
$heroMeta = mt\Hero::get($heroId);
if ($heroMeta) {
Hero::addHero($heroMeta);
array_push($heroList, $heroId);
array_push($heroList, $heroMeta);
if ($heroMeta['hero_head']) {
array_push($haveHeadHeroList, $heroMeta);
}
}
}
}
@ -111,7 +115,11 @@ class UserController extends BaseAuthedController {
}
$headId = !empty($headList) ? $headList[rand() % count($headList)] : 0;
$headFrame = !empty($headFrameList) ? $headFrameList[rand() % count($headFrameList)] : 0;
$heroId = !empty($heroList) ? $heroList[rand() % count($heroList)] : 0;
$heroId = !empty($heroList) ? $heroList[rand() % count($heroList)]['id'] : 0;
if ($headId == 0) {
$headId = !empty($haveHeadHeroList) ?
$haveHeadHeroList[rand() % count($haveHeadHeroList)]['hero_head'] : 0;
}
SqlHelper::upsert
($this->_getSelfMysql(),
't_user',