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('models/HashRate.php');
require_once('models/HashRateShopBuyRecord.php');
use phpcommon\SqlHelper;
@ -82,14 +83,15 @@ class HashRateShopController extends BaseAuthedController {
return;
}
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++) {
$this->internalAddItem($awardService,
$propertyChgService,
$itemMeta,
$goodsMeta['item_num']
);
}
}*/
$propertyChgService->addUserChg();
$this->_rspData(
array(

View File

@ -139,6 +139,8 @@ class HashRate extends BaseModel
array(
'account_id' => myself()->_getAccountId(),
'period' => $currentPeriod['id'],
),
array(
'reward' => function () use($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";
},
'total_buy_times' => function () use($goodsNum) {
return 'total_buy_times + ${goodsNum}';
return "total_buy_times + ${goodsNum}";
},
'last_buy_time' => myself()->_getNowTime(),
'modifytime' => myself()->_getNowTime(),

View File

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