取消会员
This commit is contained in:
parent
fa416ada57
commit
9b7159f8c1
@ -148,4 +148,12 @@ public class PersonController {
|
||||
personService.becomeVip(reqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@PutMapping("/cancel-vip")
|
||||
@Operation(summary = "取消会员")
|
||||
@Parameter(name = "userid", description = "用户编号", required = true)
|
||||
public CommonResult<Boolean> cancelVip(@RequestParam("userid") Integer userid) {
|
||||
personService.cancelVip(userid);
|
||||
return success(true);
|
||||
}
|
||||
}
|
||||
@ -110,4 +110,11 @@ public interface PersonService {
|
||||
* @param reqVO 开通会员请求参数
|
||||
*/
|
||||
void becomeVip(@Valid PersonBecomeVipReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 取消会员
|
||||
*
|
||||
* @param userid 用户编号
|
||||
*/
|
||||
void cancelVip(Integer userid);
|
||||
}
|
||||
@ -151,4 +151,16 @@ public class PersonServiceImpl implements PersonService {
|
||||
.set(PersonDO::getVipstarttime, reqVO.getVipstarttime()) // 设置会员开始时间
|
||||
.set(PersonDO::getVipendtime, reqVO.getVipendtime())); // 设置会员结束时间
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancelVip(Integer userid) {
|
||||
// 校验用户存在
|
||||
validatePersonExists(userid);
|
||||
// 取消会员:将vipstarttime、vipendtime设置为null,isvip设置为0
|
||||
personMapper.update(null, new LambdaUpdateWrapper<PersonDO>()
|
||||
.eq(PersonDO::getId, userid)
|
||||
.set(PersonDO::getIsvip, 0) // 设置为非会员状态
|
||||
.set(PersonDO::getVipstarttime, null) // 清空会员开始时间
|
||||
.set(PersonDO::getVipendtime, null)); // 清空会员结束时间
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user