mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-07-23 07:25:07 +08:00
trade: 1.支付成功后,增加用户积分;2.退款成功后,扣减用户积分
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
package cn.iocoder.yudao.module.member.api.user;
|
||||
|
||||
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
|
||||
import cn.iocoder.yudao.module.member.enums.point.MemberPointBizTypeEnum;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@ -57,4 +58,13 @@ public interface MemberUserApi {
|
||||
*/
|
||||
MemberUserRespDTO getUserByMobile(String mobile);
|
||||
|
||||
/**
|
||||
* 增加用户积分
|
||||
*
|
||||
* @param userId 用户编号
|
||||
* @param point 积分
|
||||
* @param bizType 业务类型 {@link MemberPointBizTypeEnum}
|
||||
* @param bizId 业务编号
|
||||
*/
|
||||
void addPoint(Long userId, Integer point, Integer bizType, String bizId);
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import cn.iocoder.yudao.framework.common.exception.ErrorCode;
|
||||
|
||||
/**
|
||||
* Member 错误码枚举类
|
||||
*
|
||||
* <p>
|
||||
* member 系统,使用 1-004-000-000 段
|
||||
*/
|
||||
public interface ErrorCodeConstants {
|
||||
@ -32,6 +32,7 @@ public interface ErrorCodeConstants {
|
||||
//========== 积分配置 1004007000 ==========
|
||||
|
||||
//========== 积分记录 1004008000 ==========
|
||||
ErrorCode POINT_RECORD_BIZ_NOT_SUPPORT = new ErrorCode(1004008000, "用户积分记录业务类型不支持");
|
||||
|
||||
//========== 签到配置 1004009000 ==========
|
||||
ErrorCode SIGN_IN_CONFIG_NOT_EXISTS = new ErrorCode(1004009000, "签到天数规则不存在");
|
||||
|
@ -18,17 +18,30 @@ public enum MemberExperienceBizTypeEnum {
|
||||
/**
|
||||
* 管理员调整、邀请新用户、下单、退单、签到、抽奖
|
||||
*/
|
||||
ADMIN(0, "管理员调整", "管理员调整获得 {} 经验"),
|
||||
INVITE_REGISTER(1, "邀新奖励", "邀请好友获得 {} 经验"),
|
||||
ORDER(2, "下单奖励", "下单获得 {} 经验"),
|
||||
REFUND(3, "退单扣除", "退单获得 {} 经验"),
|
||||
SIGN_IN(4, "签到奖励", "签到获得 {} 经验"),
|
||||
LOTTERY(5, "抽奖奖励", "抽奖获得 {} 经验"),
|
||||
ADMIN(0, "管理员调整", "管理员调整获得 {} 经验", false),
|
||||
INVITE_REGISTER(1, "邀新奖励", "邀请好友获得 {} 经验", false),
|
||||
ORDER(2, "下单奖励", "下单获得 {} 经验", false),
|
||||
REFUND(3, "退单扣除", "退单获得 {} 经验", true),
|
||||
SIGN_IN(4, "签到奖励", "签到获得 {} 经验", false),
|
||||
LOTTERY(5, "抽奖奖励", "抽奖获得 {} 经验", false),
|
||||
;
|
||||
|
||||
/**
|
||||
* 业务类型
|
||||
*/
|
||||
private final int type;
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
private final String title;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private final String description;
|
||||
/**
|
||||
* 是否为扣减积分
|
||||
*/
|
||||
private final boolean isReduce;
|
||||
|
||||
public static MemberExperienceBizTypeEnum getByType(Integer type) {
|
||||
return EnumUtil.getBy(MemberExperienceBizTypeEnum.class,
|
||||
|
@ -1,9 +1,12 @@
|
||||
package cn.iocoder.yudao.module.member.enums.point;
|
||||
|
||||
import cn.hutool.core.util.EnumUtil;
|
||||
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 会员积分的业务类型枚举
|
||||
*
|
||||
@ -13,9 +16,9 @@ import lombok.Getter;
|
||||
@Getter
|
||||
public enum MemberPointBizTypeEnum implements IntArrayValuable {
|
||||
|
||||
SIGN(1, "签到"),
|
||||
ORDER_BUY(10, "订单消费"),
|
||||
ORDER_CANCEL(11, "订单取消"); // 退回积分
|
||||
SIGN(1, "签到", "签到获得 {} 积分", false),
|
||||
ORDER_BUY(10, "订单消费", "下单获得 {} 积分", false),
|
||||
ORDER_CANCEL(11, "订单取消", "退单获得 {} 积分", true); // 退回积分
|
||||
|
||||
/**
|
||||
* 类型
|
||||
@ -25,10 +28,24 @@ public enum MemberPointBizTypeEnum implements IntArrayValuable {
|
||||
* 名字
|
||||
*/
|
||||
private final String name;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private final String description;
|
||||
/**
|
||||
* 是否为扣减积分
|
||||
*/
|
||||
private final boolean isReduce;
|
||||
|
||||
@Override
|
||||
public int[] array() {
|
||||
return new int[0];
|
||||
}
|
||||
|
||||
|
||||
public static MemberPointBizTypeEnum getByType(Integer type) {
|
||||
return EnumUtil.getBy(MemberPointBizTypeEnum.class,
|
||||
e -> Objects.equals(type, e.getType()));
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user