This commit is contained in:
aozhiwei 2024-08-06 16:26:48 +08:00
parent 101bab3142
commit c9fbc71f71

View File

@ -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,
));
}
}