|
|
|
@ -581,7 +581,11 @@ class Goods extends GoodsModel |
|
|
|
|
$value->goods_sku_no = $goodsInfo['goods_no_other']; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//是否展示看同款按钮 |
|
|
|
|
$goodsInfo->is_show_ktk = 1; |
|
|
|
|
if (in_array($goodsInfo['channel'], ['sn','sn1']) && !$goodsInfo['link_other']) { |
|
|
|
|
$goodsInfo->is_show_ktk = 0; |
|
|
|
|
} |
|
|
|
|
// 判断商品是否存在 |
|
|
|
|
if (empty($goodsInfo) || $goodsInfo['is_delete']) { |
|
|
|
|
throwError('很抱歉,商品信息不存在'); |
|
|
|
@ -623,6 +627,7 @@ class Goods extends GoodsModel |
|
|
|
|
|
|
|
|
|
$catService = new GoodsCategoryRel(); |
|
|
|
|
$catIds = $catService->where(['goods_id' => $goods->goods_id])->column('category_id'); |
|
|
|
|
$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); |
|
|
|
@ -631,7 +636,10 @@ class Goods extends GoodsModel |
|
|
|
|
$priceArr = \app\common\model\PriceSet::distributionPrice($goods['skuInfo']['goods_price'], $goods['skuInfo']['cost_price'], $catIds); |
|
|
|
|
$goods['skuInfo']['goods_price'] = $priceArr['distributionPrice']; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//处理店长临时设置的秒杀价 |
|
|
|
|
if ($goods['skuInfo']['sec_start_time'] && strtotime($goods['skuInfo']['sec_start_time']) <= $currtime && (strtotime($goods['skuInfo']['sec_start_time']) + 24 * 3600) >= $currtime) { |
|
|
|
|
$goods['skuInfo']['goods_price'] = $goods['skuInfo']['seckill_price']; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//(new static)->setGoodsMoney($goodsInfo); |
|
|
|
|
return $goods['skuInfo']; |
|
|
|
@ -680,7 +688,7 @@ class Goods extends GoodsModel |
|
|
|
|
$goods['line_price_min'] = $goods['goods_price_min']; |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$currtime = time(); |
|
|
|
|
$catService = new GoodsCategoryRel(); |
|
|
|
|
$catIds = $catService->where(['goods_id' => $goods->goods_id])->column('category_id'); |
|
|
|
|
$goods['line_price_min'] = $goods['goods_price_min'];//划线价格等于市场价 |
|
|
|
@ -702,13 +710,18 @@ class Goods extends GoodsModel |
|
|
|
|
//$goods['goods_price_min'] = $membershipPrice; |
|
|
|
|
$goods['goods_price_min'] = $priceArr['distributionPrice']; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//处理店长临时设置的秒杀价 |
|
|
|
|
if ($goods['sec_start_time'] && strtotime($goods['sec_start_time']) <= $currtime && (strtotime($goods['sec_start_time']) + 24 * 3600) >= $currtime) { |
|
|
|
|
$goods['goods_price_min'] = $goods['seckill_price']; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// if ($goods['discount'] == 10) { |
|
|
|
|
// $goods['discount'] = 0.0; |
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
// 会员折扣价: 商品sku列表 |
|
|
|
|
if ($goods->getRelation('skuList') || $goods->getRelation('skuList1')) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach ($goods['skuList'] as &$skuItem) { |
|
|
|
|
//处理图片和库 |
|
|
|
|
$goods_image = GoodsImage::where('goods_id', $skuItem['goods_id'])->order("id asc")->find(); |
|
|
|
@ -728,13 +741,17 @@ class Goods extends GoodsModel |
|
|
|
|
$priceArr = \app\common\model\PriceSet::distributionPrice($skuItem['goods_price'], $skuItem['cost_price'], $catIds); |
|
|
|
|
$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(用于购物车) |
|
|
|
|
if ($goods->getAttr('skuInfo')) { |
|
|
|
|
|
|
|
|
|
if (UserService::isPlusMember()) { |
|
|
|
|
|
|
|
|
|
// $sku_price_plus = []; |
|
|
|
@ -753,7 +770,10 @@ class Goods extends GoodsModel |
|
|
|
|
$priceArr = \app\common\model\PriceSet::distributionPrice($goods['skuInfo']['goods_price'], $goods['skuInfo']['cost_price'], $catIds); |
|
|
|
|
$goods['skuInfo']['goods_price'] = $priceArr['distributionPrice']; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//处理店长临时设置的秒杀价 |
|
|
|
|
if ($goods['skuInfo']['sec_start_time'] && strtotime($goods['skuInfo']['sec_start_time']) <= $currtime && (strtotime($goods['skuInfo']['sec_start_time']) + 24 * 3600) >= $currtime) { |
|
|
|
|
$goods['skuInfo']['goods_price'] = $goods['skuInfo']['seckill_price']; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -878,6 +898,7 @@ class Goods extends GoodsModel |
|
|
|
|
'sec_hour' => $data['sec_hour'], |
|
|
|
|
]; |
|
|
|
|
$skuData->save($up_data); |
|
|
|
|
GoodsModel::where('goods_id', $data['goods_id'])->update($up_data); |
|
|
|
|
} |
|
|
|
|
// } |
|
|
|
|
return true; |
|
|
|
|