WIN-2308041133\Administrator 4 months ago
parent
commit
3b1c9e52ba
1 changed files with 14 additions and 1 deletions
  1. 14 1
      app/models/store/StoreCouponUser.php

+ 14 - 1
app/models/store/StoreCouponUser.php

@@ -136,13 +136,26 @@ class StoreCouponUser extends BaseModel
             $cateId = array_merge($cateId, $temp);
             $cateId = array_merge($cateId, $temp);
             $cateId = array_unique($cateId);
             $cateId = array_unique($cateId);
             foreach ($cateId as $value) {
             foreach ($cateId as $value) {
+//                $lst2[] = $model->alias('a')
+//                    ->join('store_coupon b', 'b.id=a.cid')
+//                    ->where('a.uid', $uid)
+//                    ->where('a.is_fail', 0)
+//                    ->where('a.status', 0)
+//                    ->where('a.use_min_price', '<=', $_price)
+//                    ->whereFindinSet('b.category_id', $value)
+//                    ->where('b.type', 1)
+//                    ->field('a.*,b.type')
+//                    ->order('a.coupon_price', 'DESC')
+//                    ->select()
+//                    ->hidden(['status', 'is_fail'])
+//                    ->toArray();
                 $lst2[] = $model->alias('a')
                 $lst2[] = $model->alias('a')
                     ->join('store_coupon b', 'b.id=a.cid')
                     ->join('store_coupon b', 'b.id=a.cid')
                     ->where('a.uid', $uid)
                     ->where('a.uid', $uid)
                     ->where('a.is_fail', 0)
                     ->where('a.is_fail', 0)
                     ->where('a.status', 0)
                     ->where('a.status', 0)
                     ->where('a.use_min_price', '<=', $_price)
                     ->where('a.use_min_price', '<=', $_price)
-                    ->whereFindinSet('b.category_id', $value)
+                    ->whereRaw("FIND_IN_SET(?, `b`.`category_id`)", [$value])
                     ->where('b.type', 1)
                     ->where('b.type', 1)
                     ->field('a.*,b.type')
                     ->field('a.*,b.type')
                     ->order('a.coupon_price', 'DESC')
                     ->order('a.coupon_price', 'DESC')