release: 删除会员码 参数接收问题

release-2024-08-08
huangyw 4 months ago
parent f6b7ca9ceb
commit e2ff175fd1

@ -41,7 +41,7 @@ public class ErrorConstants {
// 会员部分
public static final String MEMBERSHIP_CODE_NOT_EXISTS = "会员码不存在";
public static final String MEMBERSHIP_CODE_ALREADY_USED = "会员码已使用,禁止删除";
public static final String MEMBERSHIP_CODE_ALREADY_USED = "会员码已使用";
// 抽奖部分
public static final String CAN_NOT_EDIT = "不允许修改";

@ -108,6 +108,9 @@ public class MembershipController extends BaseController {
@ApiOperation(value = "5.删除会员码", notes = "仅限admin权限用户调用")
@PostMapping("/code/del")
@GlobalInterceptor(checkAdminLogin = true)
@ApiImplicitParams(
@ApiImplicitParam(name = "id", value = "会员码id", required = true, dataType = "String", paramType = "query")
)
public Result<Void> delMembershipCode(
@RequestHeader(value = "Authorization", required = true) String authorization,
@ApiParam(value = "会员码id", required = true) String id) {

@ -129,6 +129,11 @@ public class MembershipCodeService {
if (membershipCode == null) {
throw new BizException(ErrorConstants.MEMBERSHIP_CODE_NOT_EXISTS);
}
if (!Objects.equals(membershipCode.getStatus(), MembershipEnums.CREATED.getCode())) {
// 已使用,禁止删除
throw new BizException(ErrorConstants.MEMBERSHIP_CODE_ALREADY_USED);
}
// 处理会员码表
membershipCode.setStatus(MembershipEnums.BIND.getCode());
membershipCode.setUserId(userLoginDto.getUserId());

Loading…
Cancel
Save