|
|
|
@ -318,7 +318,6 @@ class Goods extends GoodsModel |
|
|
|
|
$v['image'] = getUrl($file_path['file_path'], $file_path['domain']); |
|
|
|
|
//$v['end_time'] = strtotime($info->p_time) - time(); |
|
|
|
|
$v['end_time'] = $info->p_time ? strtotime($info->p_time) - time() : 0; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
return $list; |
|
|
|
|
} |
|
|
|
@ -400,7 +399,6 @@ class Goods extends GoodsModel |
|
|
|
|
} |
|
|
|
|
$goodsInfo->goods_images = $goods_images; |
|
|
|
|
$goodsInfo->goods_image = $res['mainImageList'][0]; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ($res['infoImageList']) { |
|
|
|
@ -410,7 +408,6 @@ class Goods extends GoodsModel |
|
|
|
|
} |
|
|
|
|
$goodsInfo->content = $content; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case 'sn': |
|
|
|
@ -420,7 +417,6 @@ class Goods extends GoodsModel |
|
|
|
|
// code... |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -673,13 +669,13 @@ class Goods extends GoodsModel |
|
|
|
|
// $catService = new GoodsCategoryRel(); |
|
|
|
|
// $catIds = $catService->where(['goods_id' => $goods->goods_id])->column('category_id'); |
|
|
|
|
$catIds = GoodsCategoryRel::withoutGlobalScope()->where(['goods_id' => $goods->goods_id])->column('category_id'); |
|
|
|
|
$user = UserService::getCurrentLoginUser(); |
|
|
|
|
$currtime = time(); |
|
|
|
|
if ($goods->getAttr('skuInfo')) { |
|
|
|
|
if (UserService::isPlusMember()) { |
|
|
|
|
$goods['skuInfo']['goods_price'] = \app\common\model\PriceSet::membershipPrice($goods['skuInfo']['goods_price'], $goods['skuInfo']['cost_price'], $catIds); |
|
|
|
|
|
|
|
|
|
$goods['skuInfo']['goods_price'] = \app\common\model\PriceSet::membershipPrice($goods['skuInfo']['goods_price'], $goods['skuInfo']['cost_price'], $catIds,$user->store_id); |
|
|
|
|
} elseif (UserService::isDealerMember()) { |
|
|
|
|
$priceArr = \app\common\model\PriceSet::distributionPrice($goods['skuInfo']['goods_price'], $goods['skuInfo']['cost_price'], $catIds); |
|
|
|
|
$priceArr = \app\common\model\PriceSet::distributionPrice($goods['skuInfo']['goods_price'], $goods['skuInfo']['cost_price'], $catIds,$user->store_id); |
|
|
|
|
$goods['skuInfo']['goods_price'] = $priceArr['distributionPrice']; |
|
|
|
|
} |
|
|
|
|
//处理店长临时设置的秒杀价 |
|
|
|
@ -734,6 +730,7 @@ class Goods extends GoodsModel |
|
|
|
|
$goods['line_price_min'] = $goods['goods_price_min']; |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
$user = UserService::getCurrentLoginUser(); |
|
|
|
|
$currtime = time(); |
|
|
|
|
// $catService = new GoodsCategoryRel(); |
|
|
|
|
// $catIds = $catService->where(['goods_id' => $goods->goods_id])->column('category_id'); |
|
|
|
@ -743,18 +740,18 @@ class Goods extends GoodsModel |
|
|
|
|
|
|
|
|
|
//价格判断 |
|
|
|
|
if (UserService::isstore()) { |
|
|
|
|
$priceArr = \app\common\model\PriceSet::distributionPrice($goods['goods_price_min'], $goods['cost_price_min'], $catIds); |
|
|
|
|
$priceArr = \app\common\model\PriceSet::distributionPrice($goods['goods_price_min'], $goods['cost_price_min'], $catIds, $user->store_id); |
|
|
|
|
$goods_price_min = $goods['goods_price_min']; |
|
|
|
|
$goods['goods_price_min_plus'] = $priceArr['membershipPrice']; |
|
|
|
|
$goods['goods_price_min_dealer'] = $priceArr['distributionPrice']; |
|
|
|
|
$goods['goods_price_min'] = $goods['goods_price_min_plus']; //$goods['cost_price_min'];//店长售价,展示为成本价 |
|
|
|
|
$goods['discount'] = $goods_price_min > 0 ? bcdiv((string)($priceArr['membershipPrice'] * 10), (string)$goods_price_min, 1) : 0; |
|
|
|
|
} elseif (UserService::isPlusMember()) { |
|
|
|
|
$membershipPrice = \app\common\model\PriceSet::membershipPrice($goods['goods_price_min'], $goods['cost_price_min'], $catIds); |
|
|
|
|
$membershipPrice = \app\common\model\PriceSet::membershipPrice($goods['goods_price_min'], $goods['cost_price_min'], $catIds, $user->store_id); |
|
|
|
|
$goods['discount'] = $goods['goods_price_min'] > 0 ? bcdiv((string)($membershipPrice * 10), (string)$goods['goods_price_min'], 1) : 0; |
|
|
|
|
$goods['goods_price_min'] = $membershipPrice; |
|
|
|
|
} elseif (UserService::isDealerMember()) { |
|
|
|
|
$priceArr = \app\common\model\PriceSet::distributionPrice($goods['goods_price_min'], $goods['cost_price_min'], $catIds); |
|
|
|
|
$priceArr = \app\common\model\PriceSet::distributionPrice($goods['goods_price_min'], $goods['cost_price_min'], $catIds, $user->store_id); |
|
|
|
|
$goods['discount'] = $goods['goods_price_min'] > 0 ? bcdiv((string)($priceArr['distributionPrice'] * 10), (string)$goods['goods_price_min'], 1) : 0; |
|
|
|
|
//$goods['goods_price_min'] = $membershipPrice; |
|
|
|
|
$goods['goods_price_min'] = $priceArr['distributionPrice']; |
|
|
|
@ -782,21 +779,19 @@ class Goods extends GoodsModel |
|
|
|
|
|
|
|
|
|
//价格判断 |
|
|
|
|
if (UserService::isstore()) { |
|
|
|
|
$priceArr = \app\common\model\PriceSet::distributionPrice($skuItem['goods_price'], $skuItem['cost_price'], $catIds); |
|
|
|
|
$priceArr = \app\common\model\PriceSet::distributionPrice($skuItem['goods_price'], $skuItem['cost_price'], $catIds,$user->store_id); |
|
|
|
|
$skuItem['goods_price'] = $skuItem['cost_price']; //店长售价,展示为成本价 |
|
|
|
|
} elseif (UserService::isPlusMember()) { |
|
|
|
|
$skuItem['goods_price'] = \app\common\model\PriceSet::membershipPrice($skuItem['goods_price'], $skuItem['cost_price'], $catIds); |
|
|
|
|
$skuItem['goods_price'] = \app\common\model\PriceSet::membershipPrice($skuItem['goods_price'], $skuItem['cost_price'], $catIds,$user->store_id); |
|
|
|
|
} elseif (UserService::isDealerMember()) { |
|
|
|
|
$priceArr = \app\common\model\PriceSet::distributionPrice($skuItem['goods_price'], $skuItem['cost_price'], $catIds); |
|
|
|
|
$priceArr = \app\common\model\PriceSet::distributionPrice($skuItem['goods_price'], $skuItem['cost_price'], $catIds,$user->store_id); |
|
|
|
|
$skuItem['goods_price'] = $priceArr['distributionPrice']; |
|
|
|
|
} |
|
|
|
|
//处理店长临时设置的秒杀价 |
|
|
|
|
if ($skuItem['sec_start_time'] && strtotime($skuItem['sec_start_time']) <= $currtime && (strtotime($skuItem['sec_start_time']) + 24 * 3600) >= $currtime) { |
|
|
|
|
$skuItem['goods_price'] = $skuItem['seckill_price']; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 折扣价: 已选择的商品sku(用于购物车) |
|
|
|
@ -808,15 +803,14 @@ class Goods extends GoodsModel |
|
|
|
|
// $sku_price_plus[] = GoodsPriceModel::getDiscountPrice($v, 1, $goods['skuInfo']['goods_price']); |
|
|
|
|
// } |
|
|
|
|
// $goods['skuInfo']['goods_price'] = min($sku_price_plus); |
|
|
|
|
$goods['skuInfo']['goods_price'] = \app\common\model\PriceSet::membershipPrice($goods['skuInfo']['goods_price'], $goods['skuInfo']['cost_price'], $catIds); |
|
|
|
|
|
|
|
|
|
$goods['skuInfo']['goods_price'] = \app\common\model\PriceSet::membershipPrice($goods['skuInfo']['goods_price'], $goods['skuInfo']['cost_price'], $catIds,$user->store_id); |
|
|
|
|
} elseif (UserService::isDealerMember()) { |
|
|
|
|
// $sku_price_dealer = []; |
|
|
|
|
// foreach ($catIds as $k => $v) { |
|
|
|
|
// $sku_price_dealer[] = GoodsPriceModel::getDiscountPrice($v, 2, $goods['skuInfo']['goods_price']); |
|
|
|
|
// } |
|
|
|
|
//$goods['skuInfo']['goods_price'] = min($sku_price_dealer); |
|
|
|
|
$priceArr = \app\common\model\PriceSet::distributionPrice($goods['skuInfo']['goods_price'], $goods['skuInfo']['cost_price'], $catIds); |
|
|
|
|
$priceArr = \app\common\model\PriceSet::distributionPrice($goods['skuInfo']['goods_price'], $goods['skuInfo']['cost_price'], $catIds, $user->store_id); |
|
|
|
|
$goods['skuInfo']['goods_price'] = $priceArr['distributionPrice']; |
|
|
|
|
} |
|
|
|
|
//处理店长临时设置的秒杀价 |
|
|
|
|