This commit is contained in:
aozhiwei 2023-07-31 15:20:10 +08:00
parent 1c8f90db3c
commit 40f146b895
2 changed files with 7 additions and 10 deletions

View File

@ -106,10 +106,6 @@ class Item {
const DRUG_TILI_SUBTYPE = 4;
const DRUG_DURABILITY_SUBTYPE = 5;
const DAILY_BUY_LIMIT = 1;
const WEEKLY_BUY_LIMIT = 2;
const TOTAL_BUY_LIMIT = 3;
const ROLE_CHIP_SUBTYPE = 1;
const GUN_CHIP_SUBTYPE = 2;

View File

@ -4,6 +4,7 @@ namespace services;
require_once('mt/ShopGoods.php');
require_once('mt/Item.php');
require_once('mt/Shop.php');
require_once('models/ShopBuyRecord.php');
require_once('models/Hero.php');
@ -43,17 +44,17 @@ class ShopService {
);
array_push($goodsList, $goodsDto);
switch ($goodsMeta['limit_type']) {
case mt\Item::DAILY_BUY_LIMIT: {
case mt\Shop::DAILY_BUY_LIMIT: {
$buyRecord = getXVal($buyRecordHash, $goodsMeta['goods_id']);
$goodsDto['bought_times'] = $buyRecord ? $buyRecord['this_day_buy_times'] : 0;
}
break;
case mt\Item::WEEKLY_BUY_LIMIT: {
case mt\Shop::WEEKLY_BUY_LIMIT: {
$buyRecord = getXVal($buyRecordHash, $goodsMeta['goods_id']);
$goodsDto['bought_times'] = $buyRecord ? $buyRecord['this_week_buy_times'] : 0;
}
break;
case mt\Item::TOTAL_BUY_LIMIT: {
case mt\Shop::TOTAL_BUY_LIMIT: {
$buyRecord = getXVal($buyRecordHash, $goodsMeta['goods_id']);
$goodsDto['bought_times'] = $buyRecord ? $buyRecord['total_buy_times'] : 0;
}
@ -90,7 +91,7 @@ class ShopService {
$boughtTimes = 1;
{
switch ($goodsMeta['limit_type']) {
case ShopController::DAILY_BUY_LIMIT: {
case mt\Shop::DAILY_BUY_LIMIT: {
$buyRecord = getXVal($buyRecordHash, $id);
$boughtTimes = $buyRecord ? $buyRecord['this_day_buy_times'] + 1 : 1;
if ($buyRecord && getXVal($buyRecord, 'this_day_buy_times', 0) >= $goodsMeta['limit_num']) {
@ -99,7 +100,7 @@ class ShopService {
}
}
break;
case ShopController::WEEKLY_BUY_LIMIT: {
case mt\Shop::WEEKLY_BUY_LIMIT: {
$buyRecord = getXVal($buyRecordHash, $id);
$boughtTimes = $buyRecord ? $buyRecord['this_week_buy_times'] + 1 : 1;
if ($buyRecord && getXVal($buyRecord, 'this_week_buy_times', 0) >= $goodsMeta['limit_num']) {
@ -108,7 +109,7 @@ class ShopService {
}
}
break;
case ShopController::TOTAL_BUY_LIMIT: {
case mt\Shop::TOTAL_BUY_LIMIT: {
// error_log("total buy limit " . $address . " " . $id . " " . $goodsMeta['limit_num']);
$buyRecord = getXVal($buyRecordHash, $id);
$boughtTimes = $buyRecord ? $buyRecord['total_buy_times'] + 1 : 1;