|
|
@@ -16,7 +16,7 @@ class GoodsLogic extends BaseLogic
|
|
|
{
|
|
|
|
|
|
/**
|
|
|
- * @notes 文章详情
|
|
|
+ * @notes 商品详情
|
|
|
* @param $goods_id
|
|
|
* @param $userId
|
|
|
* @return array
|
|
|
@@ -71,11 +71,20 @@ class GoodsLogic extends BaseLogic
|
|
|
return $goods;
|
|
|
}
|
|
|
|
|
|
- public static function eventDetail($id){
|
|
|
+ public static function eventDetail($id,$userId){
|
|
|
$goods = Goods::where(['id'=>$id])->visible([
|
|
|
'id','goods_image','goods_name','goods_banners','good_unit','sell_num','base_service_fee',
|
|
|
'service_total','service_fee','service_image','fee_schedule','warranty_period','goods_payment_type','goods_category_id'
|
|
|
- ])->select()->toArray();
|
|
|
+ ])->select()
|
|
|
+ ->each(function (&$item, $key) use ($userId){
|
|
|
+ //判定是否存在可使用的用户优惠券,存在的话直接更新展示价格
|
|
|
+ if($userId!=0){
|
|
|
+ $result = UserCouponLogic::categoryWithAmountLists(['user_id'=>$userId,'amount'=>$item['service_fee'],'goods_category_id'=>$item['goods_category_id'],'goods_id'=>$item['id']]);
|
|
|
+ if(!empty($result[0]['amount'])){
|
|
|
+ $item['base_service_fee'] = '券后'.($item['base_service_fee'] - $result[0]['amount']);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })->toArray();
|
|
|
|
|
|
if(!empty($goods)){
|
|
|
$data = [];
|