'满减券', self::TYPE_TASTE => '体验券', ]; } /** * 可领取列表 * * @param array $without 需要排除的ID列表 * @return Coupon[]|array|Collection * @throws DataNotFoundException * @throws DbException * @throws ModelNotFoundException */ public static function normalList(array $without = []) { $now = date('Y-m-d H:i:s'); return self::whereNotIn('id', $without) ->whereNull('deleted_at') ->where('begin_at', '<', $now) ->where('end_at', '>', $now) ->where('remain', '>', 0) ->order('sort', 'desc') ->order('created_at', 'desc') ->select(); } /** * 获取首页推荐优惠券 * * @return Coupon|array|\think\Model|null * @throws DataNotFoundException * @throws DbException * @throws ModelNotFoundException */ public static function homeCoupon() { $now = date('Y-m-d H:i:s'); return self::where('is_home', self::COMMON_ON) ->whereNull('deleted_at') ->where('begin_at', '<', $now) ->where('end_at', '>', $now) ->where('remain', '>', 0) ->order('sort', 'desc') ->order('created_at', 'desc') ->find(); } }