1
This commit is contained in:
parent
780b765c2a
commit
0caa884a24
@ -25,7 +25,7 @@ class HashRateShopController extends BaseAuthedController {
|
||||
{
|
||||
myself()->_verifySwitch('hashrate.shop.buy');
|
||||
$goodsId = getReqVal('goods_id', 0);
|
||||
$goodsNum = getReqVal('goods_num', 0);
|
||||
$goodsNum = intval(getReqVal('goods_num', 0));
|
||||
|
||||
if ($goodsNum < 1) {
|
||||
myself()->_rspErr(1, "goods_num parameter error, goods_num: {$goodsNum}");
|
||||
@ -59,12 +59,12 @@ class HashRateShopController extends BaseAuthedController {
|
||||
myself()->_rspErr(1, "config error");
|
||||
return;
|
||||
}
|
||||
if ($price < model\HashRate::getMyCurrentHashRate) {
|
||||
if ($price * $goodsNum < model\HashRate::getMyCurrentHashRate()) {
|
||||
myself()->_rspErr(2, "hashrate not enough");
|
||||
return;
|
||||
}
|
||||
HashRateShopBuyRecord::add($goodsMeta['goods_id'], $goodsNum);
|
||||
myself()->_decItems($costItems);
|
||||
model\HashRate::decMyCurrentHashRate($price * $goodsNum);
|
||||
HashRateShopBuyRecord::add($goodsMeta['goods_id'], $goodsNum, $goodsMeta['type']);
|
||||
for ($i = 0; $i < $goodsNum; $i++) {
|
||||
$this->internalAddItem($awardService,
|
||||
$propertyChgService,
|
||||
|
Loading…
x
Reference in New Issue
Block a user