1
This commit is contained in:
parent
1c8f90db3c
commit
40f146b895
@ -106,10 +106,6 @@ class Item {
|
|||||||
const DRUG_TILI_SUBTYPE = 4;
|
const DRUG_TILI_SUBTYPE = 4;
|
||||||
const DRUG_DURABILITY_SUBTYPE = 5;
|
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 ROLE_CHIP_SUBTYPE = 1;
|
||||||
const GUN_CHIP_SUBTYPE = 2;
|
const GUN_CHIP_SUBTYPE = 2;
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ namespace services;
|
|||||||
|
|
||||||
require_once('mt/ShopGoods.php');
|
require_once('mt/ShopGoods.php');
|
||||||
require_once('mt/Item.php');
|
require_once('mt/Item.php');
|
||||||
|
require_once('mt/Shop.php');
|
||||||
|
|
||||||
require_once('models/ShopBuyRecord.php');
|
require_once('models/ShopBuyRecord.php');
|
||||||
require_once('models/Hero.php');
|
require_once('models/Hero.php');
|
||||||
@ -43,17 +44,17 @@ class ShopService {
|
|||||||
);
|
);
|
||||||
array_push($goodsList, $goodsDto);
|
array_push($goodsList, $goodsDto);
|
||||||
switch ($goodsMeta['limit_type']) {
|
switch ($goodsMeta['limit_type']) {
|
||||||
case mt\Item::DAILY_BUY_LIMIT: {
|
case mt\Shop::DAILY_BUY_LIMIT: {
|
||||||
$buyRecord = getXVal($buyRecordHash, $goodsMeta['goods_id']);
|
$buyRecord = getXVal($buyRecordHash, $goodsMeta['goods_id']);
|
||||||
$goodsDto['bought_times'] = $buyRecord ? $buyRecord['this_day_buy_times'] : 0;
|
$goodsDto['bought_times'] = $buyRecord ? $buyRecord['this_day_buy_times'] : 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case mt\Item::WEEKLY_BUY_LIMIT: {
|
case mt\Shop::WEEKLY_BUY_LIMIT: {
|
||||||
$buyRecord = getXVal($buyRecordHash, $goodsMeta['goods_id']);
|
$buyRecord = getXVal($buyRecordHash, $goodsMeta['goods_id']);
|
||||||
$goodsDto['bought_times'] = $buyRecord ? $buyRecord['this_week_buy_times'] : 0;
|
$goodsDto['bought_times'] = $buyRecord ? $buyRecord['this_week_buy_times'] : 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case mt\Item::TOTAL_BUY_LIMIT: {
|
case mt\Shop::TOTAL_BUY_LIMIT: {
|
||||||
$buyRecord = getXVal($buyRecordHash, $goodsMeta['goods_id']);
|
$buyRecord = getXVal($buyRecordHash, $goodsMeta['goods_id']);
|
||||||
$goodsDto['bought_times'] = $buyRecord ? $buyRecord['total_buy_times'] : 0;
|
$goodsDto['bought_times'] = $buyRecord ? $buyRecord['total_buy_times'] : 0;
|
||||||
}
|
}
|
||||||
@ -90,7 +91,7 @@ class ShopService {
|
|||||||
$boughtTimes = 1;
|
$boughtTimes = 1;
|
||||||
{
|
{
|
||||||
switch ($goodsMeta['limit_type']) {
|
switch ($goodsMeta['limit_type']) {
|
||||||
case ShopController::DAILY_BUY_LIMIT: {
|
case mt\Shop::DAILY_BUY_LIMIT: {
|
||||||
$buyRecord = getXVal($buyRecordHash, $id);
|
$buyRecord = getXVal($buyRecordHash, $id);
|
||||||
$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']) {
|
||||||
@ -99,7 +100,7 @@ class ShopService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ShopController::WEEKLY_BUY_LIMIT: {
|
case mt\Shop::WEEKLY_BUY_LIMIT: {
|
||||||
$buyRecord = getXVal($buyRecordHash, $id);
|
$buyRecord = getXVal($buyRecordHash, $id);
|
||||||
$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']) {
|
||||||
@ -108,7 +109,7 @@ class ShopService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ShopController::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 . " " . $id . " " . $goodsMeta['limit_num']);
|
||||||
$buyRecord = getXVal($buyRecordHash, $id);
|
$buyRecord = getXVal($buyRecordHash, $id);
|
||||||
$boughtTimes = $buyRecord ? $buyRecord['total_buy_times'] + 1 : 1;
|
$boughtTimes = $buyRecord ? $buyRecord['total_buy_times'] + 1 : 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user