积分:完善积分获得、退还、使用 相关逻辑

This commit is contained in:
owen
2023-09-23 14:11:16 +08:00
parent dc46dff62c
commit 052328c5fa
24 changed files with 383 additions and 87 deletions

View File

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.member.api.point;
import cn.iocoder.yudao.module.member.api.point.dto.MemberPointConfigRespDTO;
import cn.iocoder.yudao.module.member.enums.point.MemberPointBizTypeEnum;
import javax.validation.constraints.Min;
@ -11,6 +12,13 @@ import javax.validation.constraints.Min;
*/
public interface MemberPointApi {
/**
* 获得积分配置
*
* @return 积分配置
*/
MemberPointConfigRespDTO getConfig();
/**
* 增加用户积分
*

View File

@ -0,0 +1,30 @@
package cn.iocoder.yudao.module.member.api.point.dto;
import lombok.Data;
/**
* 用户信息 Response DTO
*
* @author 芋道源码
*/
@Data
public class MemberPointConfigRespDTO {
/**
* 积分抵扣开关
*/
private Boolean tradeDeductEnable;
/**
* 积分抵扣,单位:分
* <p>
* 1 积分抵扣多少分
*/
private Integer tradeDeductUnitPrice;
/**
* 积分抵扣最大值
*/
private Integer tradeDeductMaxPrice;
/**
* 1 元赠送多少分
*/
private Integer tradeGivePoint;
}

View File

@ -33,5 +33,8 @@ public class MemberUserRespDTO {
* 手机
*/
private String mobile;
/**
* 积分
*/
private Integer point;
}

View File

@ -13,6 +13,7 @@ public interface ErrorCodeConstants {
ErrorCode USER_NOT_EXISTS = new ErrorCode(1004001000, "用户不存在");
ErrorCode USER_MOBILE_NOT_EXISTS = new ErrorCode(1004001001, "手机号未注册用户");
ErrorCode USER_MOBILE_USED = new ErrorCode(1004001002, "修改手机失败,该手机号({})已经被使用");
ErrorCode USER_POINT_NOT_ENOUGH = new ErrorCode(1004001003, "用户积分余额不足");
// ========== AUTH 模块 1004003000 ==========
ErrorCode AUTH_LOGIN_BAD_CREDENTIALS = new ErrorCode(1004003000, "登录失败,账号密码不正确");

View File

@ -18,8 +18,10 @@ public enum MemberPointBizTypeEnum implements IntArrayValuable {
SIGN(1, "签到", "签到获得 {} 积分", true),
ORDER_REWARD(10, "订单奖励", "下单获得 {} 积分", true),
ORDER_CANCEL(11, "订单取消", "退单获得 {} 积分", false), // 退回积分
ORDER_CANCEL(11, "订单取消", "订单取消,退还 {} 积分", true), // 退回积分
ORDER_USE(12, "订单使用", "下单使用 {} 积分", false), // 扣减积分
AFTER_SALE_REFUND_USED(13, "订单退款", "订单退款,退还 {} 积分", true), // 退回积分
AFTER_SALE_DEDUCT_GIVE(14, "订单退款", "订单退款,扣除赠送的 {} 积分", false), // 扣减积分
;
/**