|
|
@@ -126,7 +126,7 @@ class UserCouponLogic extends BaseLogic
|
|
|
* @param $params
|
|
|
* @return array|false
|
|
|
*/
|
|
|
- public static function categoryCouponList($params)
|
|
|
+ public static function categoryCouponLists($params)
|
|
|
{
|
|
|
try{
|
|
|
$data = CouponRules::alias('cr')
|
|
|
@@ -151,4 +151,33 @@ class UserCouponLogic extends BaseLogic
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ public static function categoryWithAmountLists($params)
|
|
|
+ {
|
|
|
+ try{
|
|
|
+ $data = UserCoupon::alias('uc')
|
|
|
+ ->where('user_id',$params['user_id'])
|
|
|
+ ->leftJoin('coupon_rules cr','uc.code=cr.code')
|
|
|
+ ->leftJoin('coupon_category cc','cc.coupon_id=cr.id')
|
|
|
+ ->where('cc.goods_category_id',$params['goods_category_id'])
|
|
|
+ ->where('uc.user_id',$params['user_id'])
|
|
|
+ ->where('uc.begin_use','<=',time())
|
|
|
+ ->where('uc.expire_time','>',time())
|
|
|
+ ->where('uc.voucher_count','>',0)
|
|
|
+ ->where('uc.voucher_status',0)
|
|
|
+ ->where('uc.amount_require','<=',$params['amount'])
|
|
|
+ ->field(['uc.id','uc.code','uc.amount','uc.amount_require','uc.discount_ratio','uc.server_category_name',
|
|
|
+ 'uc.event_name','uc.expire_time','uc.begin_use','uc.max_deductible_price','uc.mold_type','uc.server_category_name'])
|
|
|
+ ->select()
|
|
|
+ ->toArray();
|
|
|
+ foreach($data as $k => $v){
|
|
|
+ $data[$k]['begin_use'] = date("Y-m-d H:i:s",$v['begin_use'] );
|
|
|
+ $data[$k]['expire_time'] = date("Y-m-d H:i:s",$v['expire_time'] );
|
|
|
+ }
|
|
|
+ return $data;
|
|
|
+ } catch(\Exception $e){
|
|
|
+ self::setError($e->getMessage());
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|