code review:分销逻辑

This commit is contained in:
YunaiV
2023-09-12 09:20:42 +08:00
parent 18c9f22560
commit 82c6354e1d
13 changed files with 46 additions and 32 deletions

View File

@ -6,6 +6,7 @@ import cn.iocoder.yudao.module.trade.api.brokerage.dto.BrokerageUserDTO;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
// TODO @疯狂:是不是不需要这个啦?
/**
* 分销 API 接口
*
@ -31,6 +32,7 @@ public interface BrokerageApi {
*/
default boolean bindUser(@NotNull Long userId, @NotNull Long bindUserId, @NotNull LocalDateTime registerTime) {
// 注册时间在30秒内的都算新用户
// TODO @疯狂:这个要不抽到 service 里哈?
boolean isNewUser = LocalDateTimeUtils.afterNow(registerTime.minusSeconds(30));
return bindUser(userId, bindUserId, isNewUser);
}
@ -43,5 +45,8 @@ public interface BrokerageApi {
* @param isNewUser 是否为新用户
* @return 是否绑定
*/
boolean bindUser(@NotNull Long userId, @NotNull Long bindUserId, @NotNull Boolean isNewUser);
boolean bindUser(@NotNull(message = "用户编号不能为空") Long userId,
@NotNull(message = "推广员编号不能为空") Long bindUserId,
@NotNull Boolean isNewUser);
}

View File

@ -6,6 +6,7 @@ import lombok.Getter;
import java.util.Arrays;
// TODO @疯狂:是不是搞成层级,类似 level 这样?因为本质上,它是 1 级、2 级、3 级这样的关系哈
/**
* 分销用户类型枚举
*