1
This commit is contained in:
parent
ae68226ef6
commit
dad8021aa9
@ -78,11 +78,12 @@ class HashRateShopController extends BaseAuthedController {
|
||||
myself()->_rspErr(1, "config error");
|
||||
return;
|
||||
}
|
||||
if ($price * $goodsNum < models\HashRate::getMyCurrentHashRate()) {
|
||||
if ($price * $goodsNum > models\HashRate::getMyCurrentHashRate()) {
|
||||
myself()->_rspErr(2, "hashrate not enough");
|
||||
return;
|
||||
}
|
||||
models\HashRate::decMyCurrentHashRate($price * $goodsNum);
|
||||
error_log(models\HashRate::getMyCurrentHashRate());
|
||||
models\HashRateShopBuyRecord::add($goodsMeta['id'], $goodsNum, $goodsMeta['type']);
|
||||
for ($i = 0; $i < $goodsNum; $i++) {
|
||||
$this->internalAddItem($awardService,
|
||||
|
@ -49,7 +49,6 @@ class HashRateShopService {
|
||||
case mt\HashRateShop::WEEKLY_BUY_LIMIT: {
|
||||
$buyRecord = getXVal($buyRecordHash, $goodsMeta['id']);
|
||||
$goodsDto['purchased_num'] = $buyRecord ? $buyRecord['this_week_buy_times'] : 0;
|
||||
error_log(json_encode($goodsDto));
|
||||
if ($buyRecord && $goodsDto['purchased_num'] > 0 &&
|
||||
$goodsDto['purchased_num'] >= $goodsDto['max_num']) {
|
||||
$goodsDto['count_down'] = myself()->_getMondaySeconds() + 3600 * 24 * 7 - myself()->_getNowTime();
|
||||
@ -97,9 +96,6 @@ class HashRateShopService {
|
||||
case mt\HashRateShop::DAILY_BUY_LIMIT: {
|
||||
$buyRecord = getXVal($buyRecordHash, $goodsId);
|
||||
$boughtTimes = $buyRecord ? $buyRecord['this_day_buy_times'] + $goodsNum : 1;
|
||||
error_log(json_encode(array(
|
||||
'boughtTimes' => $boughtTimes
|
||||
)));
|
||||
if ($buyRecord && getXVal($buyRecord, 'this_day_buy_times', 0) >= $goodsMeta['limit_num']) {
|
||||
$errCode = 2;
|
||||
$errMsg = 'Daily purchase limit';
|
||||
@ -110,10 +106,6 @@ class HashRateShopService {
|
||||
case mt\HashRateShop::WEEKLY_BUY_LIMIT: {
|
||||
$buyRecord = getXVal($buyRecordHash, $goodsId);
|
||||
$boughtTimes = $buyRecord ? $buyRecord['this_week_buy_times'] + $goodsNum : 1;
|
||||
error_log(json_encode(array(
|
||||
'buyRecordHash' =>$buyRecordHash,
|
||||
'boughtTimes' => $boughtTimes
|
||||
)));
|
||||
if ($buyRecord && getXVal($buyRecord, 'this_week_buy_times', 0) >= $goodsMeta['limit_num']) {
|
||||
$errCode = 2;
|
||||
$errMsg = 'Weekly purchase limit reached';
|
||||
|
Loading…
x
Reference in New Issue
Block a user