1
This commit is contained in:
parent
40f146b895
commit
0e78259a9d
@ -89,10 +89,11 @@ class ShopService {
|
|||||||
$errMsg = '';
|
$errMsg = '';
|
||||||
$buyRecordHash = ShopBuyRecord::allToHash();
|
$buyRecordHash = ShopBuyRecord::allToHash();
|
||||||
$boughtTimes = 1;
|
$boughtTimes = 1;
|
||||||
|
$goodsId = $goodsMeta['goods_id'];
|
||||||
{
|
{
|
||||||
switch ($goodsMeta['limit_type']) {
|
switch ($goodsMeta['limit_type']) {
|
||||||
case mt\Shop::DAILY_BUY_LIMIT: {
|
case mt\Shop::DAILY_BUY_LIMIT: {
|
||||||
$buyRecord = getXVal($buyRecordHash, $id);
|
$buyRecord = getXVal($buyRecordHash, $goodsId);
|
||||||
$boughtTimes = $buyRecord ? $buyRecord['this_day_buy_times'] + 1 : 1;
|
$boughtTimes = $buyRecord ? $buyRecord['this_day_buy_times'] + 1 : 1;
|
||||||
if ($buyRecord && getXVal($buyRecord, 'this_day_buy_times', 0) >= $goodsMeta['limit_num']) {
|
if ($buyRecord && getXVal($buyRecord, 'this_day_buy_times', 0) >= $goodsMeta['limit_num']) {
|
||||||
$this->_rspErr(2, 'Daily purchase limit');
|
$this->_rspErr(2, 'Daily purchase limit');
|
||||||
@ -101,7 +102,7 @@ class ShopService {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case mt\Shop::WEEKLY_BUY_LIMIT: {
|
case mt\Shop::WEEKLY_BUY_LIMIT: {
|
||||||
$buyRecord = getXVal($buyRecordHash, $id);
|
$buyRecord = getXVal($buyRecordHash, $goodsId);
|
||||||
$boughtTimes = $buyRecord ? $buyRecord['this_week_buy_times'] + 1 : 1;
|
$boughtTimes = $buyRecord ? $buyRecord['this_week_buy_times'] + 1 : 1;
|
||||||
if ($buyRecord && getXVal($buyRecord, 'this_week_buy_times', 0) >= $goodsMeta['limit_num']) {
|
if ($buyRecord && getXVal($buyRecord, 'this_week_buy_times', 0) >= $goodsMeta['limit_num']) {
|
||||||
$this->_rspErr(2, 'Weekly purchase limit reached');
|
$this->_rspErr(2, 'Weekly purchase limit reached');
|
||||||
@ -110,8 +111,8 @@ class ShopService {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case mt\Shop::TOTAL_BUY_LIMIT: {
|
case mt\Shop::TOTAL_BUY_LIMIT: {
|
||||||
// error_log("total buy limit " . $address . " " . $id . " " . $goodsMeta['limit_num']);
|
// error_log("total buy limit " . $address . " " . $goodsId . " " . $goodsMeta['limit_num']);
|
||||||
$buyRecord = getXVal($buyRecordHash, $id);
|
$buyRecord = getXVal($buyRecordHash, $goodsId);
|
||||||
$boughtTimes = $buyRecord ? $buyRecord['total_buy_times'] + 1 : 1;
|
$boughtTimes = $buyRecord ? $buyRecord['total_buy_times'] + 1 : 1;
|
||||||
if ($buyRecord && getXVal($buyRecord, 'total_buy_times', 0) >= $goodsMeta['limit_num']) {
|
if ($buyRecord && getXVal($buyRecord, 'total_buy_times', 0) >= $goodsMeta['limit_num']) {
|
||||||
$this->_rspErr(2, 'Purchase limit reached');
|
$this->_rspErr(2, 'Purchase limit reached');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user