|
|
|
@ -121,6 +121,14 @@ public class MyController extends BaseController {
|
|
|
|
|
userRespDTO.setAppleId(user.getAppleId());
|
|
|
|
|
userRespDTO.setWxNickname(user.getWxNickname());
|
|
|
|
|
userRespDTO.setAppleEmail(user.getAppleEmail());
|
|
|
|
|
userRespDTO.setEnableNotice(1);
|
|
|
|
|
userRespDTO.setEnablePush(1);
|
|
|
|
|
if (0 ==user.getEnableNotice()) {
|
|
|
|
|
userRespDTO.setEnableNotice(0);
|
|
|
|
|
}
|
|
|
|
|
if (0 == user.getEnablePush()) {
|
|
|
|
|
userRespDTO.setEnablePush(0);
|
|
|
|
|
}
|
|
|
|
|
return Result.success(userRespDTO);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -514,8 +522,35 @@ public class MyController extends BaseController {
|
|
|
|
|
return Result.success(token);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "14.1 启用/停用 消息, 0为停用,1为启用", notes = "启用/停用 消息, 0为停用,1为启用")
|
|
|
|
|
@PutMapping("/enableNotice/{flag}")
|
|
|
|
|
public Result<Void> updateEnableNotice(@RequestHeader(value = "Authorization", required = true) String authorization,@PathVariable int flag){
|
|
|
|
|
//验证是否登录,并且拿到ID
|
|
|
|
|
UserLoginDto userLoginDto = getUserLoginDto(authorization);
|
|
|
|
|
if (null == userLoginDto) {
|
|
|
|
|
return Result.unauthorized(null);
|
|
|
|
|
}
|
|
|
|
|
String userId = userLoginDto.getUserId();
|
|
|
|
|
UserInfo userInfo = userInfoService.findById(userId);
|
|
|
|
|
userInfo.setEnableNotice(flag);
|
|
|
|
|
userInfoService.update(userInfo);
|
|
|
|
|
return Result.success();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "14.2 启用/停用 推送, 0为停用,1为启用", notes = "启用/停用 推送, 0为停用,1为启用")
|
|
|
|
|
@PutMapping("/enablePush/{flag}")
|
|
|
|
|
public Result<Void> updateEnablePush(@RequestHeader(value = "Authorization", required = true) String authorization,@PathVariable int flag){
|
|
|
|
|
//验证是否登录,并且拿到ID
|
|
|
|
|
UserLoginDto userLoginDto = getUserLoginDto(authorization);
|
|
|
|
|
if (null == userLoginDto) {
|
|
|
|
|
return Result.unauthorized(null);
|
|
|
|
|
}
|
|
|
|
|
String userId = userLoginDto.getUserId();
|
|
|
|
|
UserInfo userInfo = userInfoService.findById(userId);
|
|
|
|
|
userInfo.setEnablePush(flag);
|
|
|
|
|
userInfoService.update(userInfo);
|
|
|
|
|
return Result.success();
|
|
|
|
|
}
|
|
|
|
|
private Integer getIndex(UserInfo u) {
|
|
|
|
|
return Integer.valueOf(Arrays.stream(u.getBadges().split(",")).filter(s->s.startsWith(String.valueOf(UserBadgeEnum.CONTRIBUTOR.getCode()))).findFirst().get().split("_")[1]);
|
|
|
|
|
}
|
|
|
|
|