记得上下班打卡 | git大法好,push需谨慎

Commit e061f0af authored by 张国柄's avatar 张国柄

fix:bug:#65|#22;

parent 70959b0e
......@@ -12,7 +12,7 @@ public class AdamMemberCodeParam implements Serializable {
private static final long serialVersionUID = -7273522103593077617L;
@ApiModelProperty(position = 1, required = true, value = "会员类型ID", example = "1")
private String memberId;
@ApiModelProperty(position = 2, required = true, value = "会员价格ID", example = "101")
@ApiModelProperty(position = 2, required = true, value = "会员价格ID", example = "1")
private String memberPriceId;
@ApiModelProperty(position = 3, required = true, value = "类型:0-用户购买兑换码,1-后台生成兑换码", example = "1")
private Integer type;
......
......@@ -16,7 +16,7 @@ public class AdamMemberOrderParam implements Serializable {
@ApiModelProperty(position = 10, required = true, value = "会员ID[50]", example = "1")
@NotBlank
private String memberId;
@ApiModelProperty(position = 11, required = true, value = "会员价格ID", example = "101")
@ApiModelProperty(position = 11, required = true, value = "会员价格ID", example = "1")
@NotBlank
private String memberPriceId;
@ApiModelProperty(position = 12, required = true, value = "购买方式:0-购买会员,1-购买会员码", allowableValues = "0,1")
......
......@@ -57,21 +57,21 @@ public class CurrentUtil {
}
if (ip == null || ip.length() == 0 || CLI_UNKNOWN.equalsIgnoreCase(ip)) {
ip = request.getRemoteAddr();
if (LOCALHOST_IP1.equalsIgnoreCase(ip) || LOCALHOST_IP.equalsIgnoreCase(ip)) {
// 根据网卡取本机配置的IP
InetAddress iNet = null;
try {
iNet = InetAddress.getLocalHost();
} catch (UnknownHostException e) {
e.printStackTrace();
}
ip = iNet.getHostAddress();
}
// if (LOCALHOST_IP1.equalsIgnoreCase(ip) || LOCALHOST_IP.equalsIgnoreCase(ip)) {
// // 根据网卡取本机配置的IP
// InetAddress iNet = null;
// try {
// iNet = InetAddress.getLocalHost();
// } catch (UnknownHostException e) {
// e.printStackTrace();
// }
// ip = iNet.getHostAddress();
// }
}
// 使用代理,则获取第一个IP地址
if (!StringUtils.isEmpty(ip) && ip.indexOf(IP_UTILS_FLAG) > 0) {
ip = ip.substring(0, ip.indexOf(IP_UTILS_FLAG));
}
return "0:0:0:0:0:0:0:1".equals(ip) ? "127.0.0.1" : ip;
return LOCALHOST_IP.equals(ip) ? LOCALHOST_IP1 : ip;
}
}
......@@ -173,9 +173,10 @@ public class AdamMemberOrderController {
public ResponseDto<AdamMemberOrderResult> exchangeMemberCode(@Valid @RequestBody AdamMemberOrderCodeParam param) {
log.debug("member/order/exchange:param:{}", JsonUtils.toJson(param));
String currentUid = CurrentUtil.getCurrentUid();
if (null != adamRdmService.getUserMemberVoByUid(currentUid)) {// 仅限从未购买过会员的用户使用
return ResponseDto.failure(ErrorMapping.get("10200"));
}
// TODO: 2021/6/19 关闭该验证(如果已是会员继续兑换则保留原会员号,兑换码对应会员号记录至会员订单)
// if (null != adamRdmService.getUserMemberVoByUid(currentUid)) {// 仅限从未购买过会员的用户使用
// return ResponseDto.failure(ErrorMapping.get("10200"));
// }
// TODO: 2021/6/9 判断黑名单,待定(暂不做)
......
......@@ -31,6 +31,7 @@ public class AdamUserMemberServiceImpl extends ServiceImpl<AdamUserMemberMapper,
@Override
public String getNextMemberNo(String memberId) {
long s = System.currentTimeMillis();
int memberMaxNo = adamRdmService.getMaxMemberNo();
if (-1 == memberMaxNo) {
if (RedisLockUtil.tryLock(LOCK_KEY_UMEMBER_NO, 1, 3000)) {
......@@ -58,6 +59,7 @@ public class AdamUserMemberServiceImpl extends ServiceImpl<AdamUserMemberMapper,
// 不能是完全相同的数字
nextMemberNoStr = String.valueOf(adamRdmService.incrMemberNo());
}
log.debug("#MNO耗时:{}ms", System.currentTimeMillis() - s);
return nextMemberNoStr;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment