whitefang 1 год назад
Родитель
Сommit
2d28804f6d
1 измененных файлов с 2 добавлено и 12 удалено
  1. 2 12
      app/api/logic/UserCouponLogic.php

+ 2 - 12
app/api/logic/UserCouponLogic.php

@@ -83,27 +83,17 @@ class UserCouponLogic extends BaseLogic
                 $where[] = ['voucher_status','IN',$params['voucher_status']];
             }
             $where[] = ['user_id','=',$params['user_id']];
-            $data = UserCoupon::with(['couponRules'=>function(Query $query){
-                $query->field(['id','code']);
-                $query->with(['couponWithCategory'=>function(Query $query){
-                    $query->field('id,name');
-                }]);
-            }])
-                ->where($where)
+            $data = UserCoupon::where($where)
                 ->where(function(Query $query){
                     $query->where(' expire_time >'. (time()-86400*7));
                 })
-                ->field(['id', 'user_id', 'code','begin_use','expire_time', 'voucher_status','voucher_count'])
+                ->field(['id','amount','amount_require','begin_use','voucher_status','discount_ratio','event_name','expire_time','max_deductible_price','server_category_name','mold_type'])
                 ->append(['voucher_status_text'])
                 ->order(['id' => 'desc'])
                 ->select()
                 ->toArray();
             $couponCodes = [];
             foreach($data as $k => $v){
-                if($v['couponRules']){
-                    $v['couponRules']['goods_category_ids'] = array_column($v['couponRules']['couponWithCategory'],'id');
-                    $data[$k] = $v;
-                }
                 if($v['expire_time'] < time()){
                     $couponCodes[] = $v['code'];
                     $data[$k]['voucher_status_text'] = '已过期';