|
|
@@ -56,7 +56,6 @@ public class CouponShareService {
|
|
|
public static final String MSG_COUPON_UNAVAILABLE = "该优惠券不可用或不属于你";
|
|
|
public static final String MSG_COUPON_INVALID = "优惠券已失效";
|
|
|
public static final String MSG_COUPON_EXPIRED = "优惠券已过期";
|
|
|
- public static final String MSG_ONLY_MEMBERSHIP = "仅会员专属券可分享";
|
|
|
public static final String MSG_SHARE_NOT_FOUND = "分享不存在或已失效";
|
|
|
public static final String MSG_SHARE_NOT_EXIST = "分享不存在";
|
|
|
public static final String MSG_ALREADY_CLAIMED = "该分享已被领取";
|
|
|
@@ -81,7 +80,6 @@ public class CouponShareService {
|
|
|
private static final String STATUS_REVOKED = "REVOKED";
|
|
|
private static final String STATUS_EXPIRED = "EXPIRED";
|
|
|
private static final String CLAIM_METHOD_SHARE = "SHARE";
|
|
|
- private static final String GIFTABLE_APPLICABLE_TO = "MEMBERSHIP";
|
|
|
private static final String AVAILABLE = "AVAILABLE";
|
|
|
private static final String ACTIVE = "ACTIVE";
|
|
|
private static final String SHARE_PATH_PREFIX = "/pages/coupon/share-claim?shareToken=";
|
|
|
@@ -140,7 +138,7 @@ public class CouponShareService {
|
|
|
return buildCreateResult(existing);
|
|
|
}
|
|
|
|
|
|
- // 券校验(属于赠送人家庭 && AVAILABLE && applicableTo=MEMBERSHIP && ACTIVE && 未过期)
|
|
|
+ // 券校验(属于赠送人家庭 && AVAILABLE && ACTIVE && 未过期;不限券类型,所有券均可分享)
|
|
|
FamilyCoupon fc = familyCouponMapper.selectById(familyCouponId);
|
|
|
if (fc == null || !Objects.equals(fc.getFamilyId(), giverFamilyId)
|
|
|
|| !AVAILABLE.equals(fc.getStatus())) {
|
|
|
@@ -150,9 +148,6 @@ public class CouponShareService {
|
|
|
if (coupon == null || !ACTIVE.equals(coupon.getStatus())) {
|
|
|
throw new IllegalArgumentException(MSG_COUPON_INVALID);
|
|
|
}
|
|
|
- if (!GIFTABLE_APPLICABLE_TO.equals(coupon.getApplicableTo())) {
|
|
|
- throw new IllegalArgumentException(MSG_ONLY_MEMBERSHIP);
|
|
|
- }
|
|
|
if (coupon.getValidFrom() != null && now.before(coupon.getValidFrom())
|
|
|
|| coupon.getValidUntil() != null && now.after(coupon.getValidUntil())) {
|
|
|
throw new IllegalArgumentException(MSG_COUPON_EXPIRED);
|
|
|
@@ -183,8 +178,8 @@ public class CouponShareService {
|
|
|
*
|
|
|
* @param shareToken 分享令牌
|
|
|
* @param viewerUserId 浏览用户(可空;本期仅返回 claimable,不区分 viewerCanClaim)
|
|
|
- * @return {shareToken, status, couponName, couponValue, couponType, minSpend,
|
|
|
- * validUntil, giverNickname, giverAvatar, expireAt, claimable}
|
|
|
+ * @return {shareToken, status, couponName, couponValue, couponType, applicableTo, productId,
|
|
|
+ * minSpend, validUntil, giverNickname, giverAvatar, expireAt, claimable}
|
|
|
*/
|
|
|
public Map<String, Object> detail(String shareToken, Long viewerUserId) {
|
|
|
if (!StringUtils.hasText(shareToken)) {
|
|
|
@@ -212,6 +207,8 @@ public class CouponShareService {
|
|
|
data.put("couponName", coupon != null ? coupon.getName() : "优惠券");
|
|
|
data.put("couponValue", coupon != null ? coupon.getValue() : null);
|
|
|
data.put("couponType", coupon != null ? coupon.getType() : null);
|
|
|
+ data.put("applicableTo", coupon != null ? coupon.getApplicableTo() : null);
|
|
|
+ data.put("productId", coupon != null ? coupon.getProductId() : null);
|
|
|
data.put("minSpend", coupon != null ? coupon.getMinSpend() : null);
|
|
|
data.put("validUntil", coupon != null ? coupon.getValidUntil() : null);
|
|
|
data.put("giverNickname", giver != null && StringUtils.hasText(giver.getNickname())
|