This commit is contained in:
aozhiwei 2024-10-11 10:40:28 +08:00
parent 418c53bf1b
commit 24bcbe531a
4 changed files with 8 additions and 4 deletions

View File

@ -8,6 +8,7 @@ require_once('mt/HashRateShop.php');
require_once('mt/Item.php'); require_once('mt/Item.php');
require_once('models/HashRate.php'); require_once('models/HashRate.php');
require_once('models/HashRateShopBuyRecord.php');
use phpcommon\SqlHelper; use phpcommon\SqlHelper;
@ -82,14 +83,15 @@ class HashRateShopController extends BaseAuthedController {
return; return;
} }
models\HashRate::decMyCurrentHashRate($price * $goodsNum); models\HashRate::decMyCurrentHashRate($price * $goodsNum);
HashRateShopBuyRecord::add($goodsMeta['goods_id'], $goodsNum, $goodsMeta['type']); models\HashRateShopBuyRecord::add($goodsMeta['id'], $goodsNum, $goodsMeta['type']);
/*
for ($i = 0; $i < $goodsNum; $i++) { for ($i = 0; $i < $goodsNum; $i++) {
$this->internalAddItem($awardService, $this->internalAddItem($awardService,
$propertyChgService, $propertyChgService,
$itemMeta, $itemMeta,
$goodsMeta['item_num'] $goodsMeta['item_num']
); );
} }*/
$propertyChgService->addUserChg(); $propertyChgService->addUserChg();
$this->_rspData( $this->_rspData(
array( array(

View File

@ -139,6 +139,8 @@ class HashRate extends BaseModel
array( array(
'account_id' => myself()->_getAccountId(), 'account_id' => myself()->_getAccountId(),
'period' => $currentPeriod['id'], 'period' => $currentPeriod['id'],
),
array(
'reward' => function () use($val) { 'reward' => function () use($val) {
return "GREATEST(0, reward - ${val})"; return "GREATEST(0, reward - ${val})";
}, },

View File

@ -84,7 +84,7 @@ class HashRateShopBuyRecord extends BaseModel
return "CASE WHEN (${cond}) THEN this_month_buy_times + ${goodsNum} ELSE 0 END"; return "CASE WHEN (${cond}) THEN this_month_buy_times + ${goodsNum} ELSE 0 END";
}, },
'total_buy_times' => function () use($goodsNum) { 'total_buy_times' => function () use($goodsNum) {
return 'total_buy_times + ${goodsNum}'; return "total_buy_times + ${goodsNum}";
}, },
'last_buy_time' => myself()->_getNowTime(), 'last_buy_time' => myself()->_getNowTime(),
'modifytime' => myself()->_getNowTime(), 'modifytime' => myself()->_getNowTime(),

View File

@ -74,7 +74,7 @@ class HashRateShopService {
$errMsg = ''; $errMsg = '';
$buyRecordHash = HashRateShopBuyRecord::allToHash(); $buyRecordHash = HashRateShopBuyRecord::allToHash();
$boughtTimes = 1; $boughtTimes = 1;
$goodsId = $goodsMeta['goods_id']; $goodsId = $goodsMeta['id'];
{ {
switch ($goodsMeta['limit_type']) { switch ($goodsMeta['limit_type']) {
case mt\HashRateShop::DAILY_BUY_LIMIT: { case mt\HashRateShop::DAILY_BUY_LIMIT: {