This commit is contained in:
aozhiwei 2024-10-10 16:33:30 +08:00
parent 8db0c59e82
commit 14d1be9105
2 changed files with 22 additions and 14 deletions

View File

@ -54,23 +54,11 @@ class HashRateShop extends BaseAuthedController {
}
$propertyChgService = new services\PropertyChgService();
$awardService = new services\AwardService();
$tokenType = $goodsMeta['token_type'];
$price = $goodsMeta['price'];
if (!in_array(
$tokenType,
array(
mt\Shop::TOKEN_TYPE_GOLD,
mt\Shop::TOKEN_TYPE_DIAMOND
)
)) {
myself()->_rspErr(1, "token_type is unsupport, {$tokenType}");
return;
}
$price = $goodsMeta['pile_price'];
if ($price < 1) {
myself()->_rspErr(1, "config error");
return;
}
$costItemId = myself()->getCostItemIdByTokenType($tokenType);
$costItems = array(
array(
'item_id' => $costItemId,

View File

@ -109,6 +109,26 @@ class HashRate extends BaseModel
return $myHashRate;
}
public static function getMyCurrentHashRate(){
$currentPeriod = myself()->_callMtStatic('AchievementsCycle', 'getCurrentPeriod');
if (empty($currentPeriod)) {
return 0;
}
$row = SqlHelper::ormSelectOne(
myself()->_getSelfMysql(),
't_hash_rate_reward',
array(
'account_id' => myself()->_getAccountId(),
'period' => $currentPeriod['id'],
)
);
$myHashRate = 0;
if ($row){
$myHashRate = $row['reward'];
}
return $myHashRate;
}
public static function getTotalByAccount($accountId,$period){
$row = SqlHelper::ormSelectOne(
myself()->_getSelfMysql(),
@ -126,4 +146,4 @@ class HashRate extends BaseModel
}
}
}