liugc 1 سال پیش
والد
کامیت
c43c54b28a
2فایلهای تغییر یافته به همراه11 افزوده شده و 2 حذف شده
  1. 5 2
      app/api/logic/ActivityLogic.php
  2. 6 0
      app/common/model/coupon/CouponRules.php

+ 5 - 2
app/api/logic/ActivityLogic.php

@@ -36,7 +36,7 @@ class ActivityLogic extends BaseLogic
             if($params['user_id']){
                 // property_head_id householder_mobile  householder_name address
                 $userInfo = User::where('id',$params['user_id'])->findOrEmpty();
-                if ($userInfo->isEmpty()) {
+                if (!$userInfo->isEmpty()) {
                     // 检查/注册
                     Log::info('getHomepageByActivityId params-102:'.json_encode([$userInfo]));
                     PropertyUserLogic::getPropertyUserIdByMobile([
@@ -48,9 +48,12 @@ class ActivityLogic extends BaseLogic
                 }
             }
             $res['activity_info'] = $propertyActivity->toArray();
-            $res['coupons'] = CouponRules::where('property_activity_id',$params['property_activity_id'])
+            $res['coupons'] = CouponRules::with(['couponCategoryOne'])->where('property_activity_id',$params['property_activity_id'])
                 ->select()
                 ->toArray();
+            foreach ($res['coupons'] as &$coupon) {
+                $coupon['goods_category_id'] = $coupon['couponCategoryOne']['goods_category_id'];
+            }
             $res['goods'] =  Goods::where('property_activity_id',$params['property_activity_id'])
                 ->where('is_agent',1)
                 ->visible(['id','goods_name','goods_image','base_service_fee','service_total','service_fee','goods_type'])

+ 6 - 0
app/common/model/coupon/CouponRules.php

@@ -43,4 +43,10 @@ class CouponRules extends BaseModel
     {
         return !empty($data['discount_ratio'])?$data['discount_ratio']*10:'';
     }
+
+    public function couponCategoryOne()
+    {
+        return $this->hasOne(CouponCategory::class, 'coupon_id', 'id');
+    }
+
 }