From c9fbc71f710dc216812336dc35bd37f50a08ba4f Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 6 Aug 2024 16:26:48 +0800 Subject: [PATCH] 1 --- webapp/controller/OtherController.class.php | 59 +++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/webapp/controller/OtherController.class.php b/webapp/controller/OtherController.class.php index 8301d837..b1a353bd 100644 --- a/webapp/controller/OtherController.class.php +++ b/webapp/controller/OtherController.class.php @@ -178,4 +178,63 @@ class OtherController extends BaseAuthedController { } + public function getCecRewardHistory2(){ + $address = getReqVal('address', ''); + $historyList = array(); + $totalCecVal = 0; + SeasonRanking::getSeasonList(function ($row) use (&$historyList,&$totalCecVal) { + if ($row && $row['ranking_point'] > 0){ + $totalCecVal += ($row['ranking_point'] * 0.15); + array_push($historyList,array( + 'type' => 1, + 'cecVal' => $row['ranking_point'] * 0.15, + 'createtime' => $row['createtime'], + )); + } + }); + + \models\RewardsCec::all(function ($row) use (&$historyList,&$totalCecVal) { + if ($row){ + $totalCecVal += $row['reward_cec']; + array_push($historyList,array( + 'type' => 2, + 'cecVal' => $row['reward_cec'], + 'createtime' => $row['createtime'], + )); + } + }); + + $stakingDb = Staking::all($address); + foreach ($stakingDb as $row) { + if ($row['status'] == Staking::REDEEM_STATUS) { + $item = Staking::toDto($row); + $totalCecVal += $item['total_rewards']; + array_push($historyList, array( + "type" => 3, + "cecVal" => $item['total_rewards'], + "createtime" => $item['redeem_time'] + )); + } + } + $rewards = \mt\ActivityRewards::find(myself()->_getAccountId()); + if ($rewards){ + foreach ($rewards as $reward){ + array_push($historyList, array( + "type" => -1, + "event_name" => $reward['event_name'], + "cecVal" => $reward['cec'], + "createtime" => strtotime($reward['time']) + )); + } + } + + + $this->_rspData(array( + 'cec'=>$totalCecVal, + 'list'=>$historyList, + )); + + + } + }