This commit is contained in:
hujiabin 2023-09-04 17:57:02 +08:00
parent 33f87fff65
commit 4cf3f502e3
3 changed files with 26 additions and 0 deletions

View File

@ -1348,6 +1348,7 @@ class ComputingPowerLast(object):
['period_begin', 0, '上期开始时间(0 不显示)'],
['period_end', 0, '上期结束时间(0 不显示)'],
['reward', 0, '上期的cec奖励'],
['last_hash_rate', 0, '上期的科技值'],
]
class ComputingPower(object):
@ -1359,6 +1360,7 @@ class ComputingPower(object):
['last_period', ComputingPowerLast(), '上期相关信息'],
['listing_state', 0, 'listing状态 0:之前 1:之后'],
['owned_cec', 0, '拥有的cec数量'],
['owned_total_hash_rate', 0, '用户总科技值'],
]
class CrystalUI(object):

View File

@ -78,6 +78,7 @@ class ComputingPowerController extends BaseAuthedController
$last_period['period_end'] = strtotime($lastMeta['end_time']);
$cecDb = RewardsCec::findByAccount(myself()->_getAccountId(),$lastMeta['id']);
$last_period['reward'] = $cecDb ? $cecDb['reward_cec'] : 0;
$last_period['last_hash_rate'] = ComputingPower::getOwnedBH($lastMeta['id']);
}
@ -87,6 +88,7 @@ class ComputingPowerController extends BaseAuthedController
'last_period' => $last_period,
'listing_state' => LISTING_SWITCH,
'owned_cec' => RewardsCec::getTotalCecNum(),
'owned_total_hash_rate' =>ComputingPower::getMyTotalBH(),
);
$this->_rspData(array(
'info' => $info

View File

@ -56,6 +56,28 @@ class ComputingPower extends BaseModel
return $total_num;
}
//获取我的总算力
public static function getMyTotalBH(){
$rows = SqlHelper::select(
myself()->_getSelfMysql(),
't_power_exchange_record',
array(
"period",
"total_num"
),
array(
'account_id'=>myself()->_getAccountId(),
)
);
$total_num = 0;
if ($rows){
foreach ($rows as $row){
$total_num += $row['total_num'];
}
}
return $total_num;
}
public static function findByPeriod($period){
$rows = SqlHelper::ormSelect(
myself()->_getSelfMysql(),