This commit is contained in:
aozhiwei 2023-07-31 12:08:43 +08:00
parent b31eccf460
commit bf3844a3dd
2 changed files with 4 additions and 32 deletions

View File

@ -70,9 +70,7 @@ class ShopGoods
if (!self::$metaList) {
self::$metaList = getMetaTable('shopGoods@shopGoods.php');
foreach (self::$metaList as &$meta) {
$meta['item_id'] = $meta['goods_id'];
$meta['item_num'] = $meta['goods_num'];
$meta['goods_id'] = $meta['id'];
$meta['free_type'] = 0;
}
}
return self::$metaList;

View File

@ -32,6 +32,9 @@ class ShopService {
$goodsList = array();
foreach ($goodsMetaList as $goodsMeta) {
if ($goodsMeta['is_close']) {
continue;
}
$goodsDto = array(
'goods_id' => $goodsMeta['goods_id'],
'goods_meta' => self::goodsMetaToInfo($goodsMeta),
@ -75,33 +78,10 @@ class ShopService {
} else if ($goodsMeta['goods_id'] != 9999){
error_log('item not found:' . json_encode($goodsMeta));
}
if (!empty($goods['free_type'])) {
$count = self::getFreeBuyTimes($goodsMeta['free_type'],
$goodsMeta['goods_id'],
$goodsMeta['goods_id']);
$goodsDto['free_num'] = $goodsDto['free_num'] - $count;
}
}
return $goodsList;
}
public static function getFreeBuyTimes()
{
return 0;
switch ($free_type) {
case 1: {
$dayTime = myself()->_getNowDaySeconds();
$sql = 'SELECT COUNT(idx) as cnt FROM t_shop_free_record WHERE account_id = ? AND `id` = ? AND goods_id = ? AND createtime >= ?';
$row = $conn->execQueryOne($sql, array($account, $id, $goodsId, $dayTime));
return $row['cnt'];
}
break;
}
return 0;
}
public static function buyLimitCheck($goodsMeta, &$errCode, &$errMsg)
{
$errCode = 0;
@ -157,12 +137,6 @@ class ShopService {
'recommend' => $goodsMeta['recommend'],
'token_type' => $goodsMeta['token_type'],
'price' => $goodsMeta['price'],
'discount' => $goodsMeta['discount'],
'limit_type' => $goodsMeta['limit_type'],
'limit_num' => $goodsMeta['limit_num'],
'buy_cond' => $goodsMeta['buy_cond'],
'buy_gift' => $goodsMeta['buy_gift'],
'normal_gift' => $goodsMeta['normal_gift'],
'free_type' => $goodsMeta['free_type'],
'shop_icon' => $goodsMeta['shop_icon'],
);