From 05f41c725993d6787024b6dbe9ef91dfa1b21735 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 23 Apr 2024 17:52:20 +0800 Subject: [PATCH] 1 --- docker/php7.4/Dockerfile | 2 +- webapp/controller/UserController.class.php | 4 ++-- webapp/models/Hero.php | 21 +++++++++++++++++++++ 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/docker/php7.4/Dockerfile b/docker/php7.4/Dockerfile index 1cec316c..a9b82b5b 100644 --- a/docker/php7.4/Dockerfile +++ b/docker/php7.4/Dockerfile @@ -11,6 +11,6 @@ LABEL description="This is custom Docker Image for \ # 6 70 RUN apt update RUN apt install -y tzdata -RUN apt install -y net-tools iputils-ping vim mariadb-client redis php php-fpm php-pdo php-mysql php-redis php-mbstring +RUN apt install -y net-tools curl iputils-ping vim mariadb-client redis php php-fpm php-pdo php-mysql php-redis php-mbstring #php-pecl-libsodium #RUN sh -c '/bin/echo -e "\n6\n70" | apt install -y net-tools iputils-ping mariadb-client php php-fpm' diff --git a/webapp/controller/UserController.class.php b/webapp/controller/UserController.class.php index 066defa5..c872e02d 100644 --- a/webapp/controller/UserController.class.php +++ b/webapp/controller/UserController.class.php @@ -503,7 +503,7 @@ class UserController extends BaseAuthedController { } $userInfo = User::Info($userDb); { - $userInfo['total_lucky'] = Hero::getAccountLucky($userInfo['address']); + $userInfo['total_lucky'] = Hero::getAccountLuckyTemp(); $userInfo['admission_item_num'] = myself()->_getItemCount(900006, $userInfo); } $heroDb = Hero::findByAccountId(myself()->_getAccountId(), $userInfo['hero_uniid']); @@ -541,7 +541,7 @@ class UserController extends BaseAuthedController { } $userInfo = User::Info($userDb); { - $userInfo['total_lucky'] = Hero::getAccountLucky($userInfo['address']); + $userInfo['total_lucky'] = Hero::getAccountLuckyTemp(); $userInfo['admission_item_num'] = myself()->_getItemCount(900006, $userInfo); } $heroDb = Hero::findByAccountId(myself()->_getAccountId(), $userInfo['hero_uniid']); diff --git a/webapp/models/Hero.php b/webapp/models/Hero.php index 591ed3e0..abe626fd 100644 --- a/webapp/models/Hero.php +++ b/webapp/models/Hero.php @@ -888,6 +888,27 @@ class Hero extends BaseModel { return $lucky; } + public static function getAccountLuckyTemp(){ + $lucky = 0; + $rows = SqlHelper::ormSelect( + myself()->_getSelfMysql(), + 't_hero', + array( + 'account_id' => myself()->_getAccountId(), + ) + ); + + foreach ($rows as $row) { + $heroMeta = \mt\Item::get($row['hero_id']); + $heroAtteMeta = \mt\EconomyAttribute::findByGrade($heroMeta['relationship'],$row['quality']); + $currTime = $row['unseal_time'] ? $row['unseal_time'] : $row['activate_time']; + if ($row['seal_type'] == 0 && $currTime + 86400 * $heroAtteMeta['validTime'] > myself()->_getNowTime()){ + $lucky += self::getHeroLucky($row); + } + } + return $lucky; + } + public static function verifyValid($hero){ // if (empty($hero['token_id'])){ // return false;