use of org.neusoft.neubbs.controller.annotation.AccountActivation in project neubbs by nuitcoder.
the class TopicController method updateTopic.
/**
* 编辑话题
*
* @param requestBodyParamsMap request-body 内 JSON 数据
* @return ApiJsonDTO 接口 JSON 传输对象
*/
@LoginAuthorization
@AccountActivation
@RequestMapping(value = "/topic-update", method = RequestMethod.POST, consumes = "application/json")
public ApiJsonDTO updateTopic(@RequestBody Map<String, Object> requestBodyParamsMap) {
Integer topicId = (Integer) requestBodyParamsMap.get(ParamConst.TOPIC_ID);
String newCategoryNick = (String) requestBodyParamsMap.get(ParamConst.CATEGORY);
String newTitle = (String) requestBodyParamsMap.get(ParamConst.TITLE);
String newTopicContent = (String) requestBodyParamsMap.get(ParamConst.CONTENT);
validationService.check(ParamConst.ID, String.valueOf(topicId)).check(ParamConst.TOPIC_CATEGORY_NICK, newCategoryNick).check(ParamConst.TOPIC_TITLE, newTitle).check(ParamConst.TOPIC_CONTENT, newTopicContent);
topicService.alterTopicContent(topicId, newCategoryNick, newTitle, newTopicContent);
return new ApiJsonDTO().success();
}
use of org.neusoft.neubbs.controller.annotation.AccountActivation in project neubbs by nuitcoder.
the class TopicController method attentionTopic.
/**
* 关注话题
*
* @param requestBodyParamsMap request-body 内 JSON 数据
* @return ApiJsonDTO 接口 JSON 传输对象
*/
@LoginAuthorization
@AccountActivation
@RequestMapping(value = "/topic/attention", method = RequestMethod.POST, consumes = "application/json")
public ApiJsonDTO attentionTopic(@RequestBody Map<String, Object> requestBodyParamsMap) {
Integer topicId = (Integer) requestBodyParamsMap.get(ParamConst.TOPIC_ID);
validationService.check(ParamConst.TOPIC_ID, String.valueOf(topicId));
UserDO cookieUser = secretService.getUserInfoByAuthentication(httpService.getAuthenticationCookieValue());
return new ApiJsonDTO().success().model(topicService.operateAttentionTopic(cookieUser.getId(), topicId));
}
use of org.neusoft.neubbs.controller.annotation.AccountActivation in project neubbs by nuitcoder.
the class TopicController method removeTopicReply.
/**
* 删除回复
*
* @param requestBodyParamsMap request-body 内 JSON 数据
* @return ApiJsonDTO 接口 JSON 传输对象
*/
@LoginAuthorization
@AccountActivation
@AdminRank
@RequestMapping(value = "/topic/reply-remove", method = RequestMethod.POST, consumes = "application/json")
public ApiJsonDTO removeTopicReply(@RequestBody Map<String, Object> requestBodyParamsMap) {
Integer replyId = (Integer) requestBodyParamsMap.get(ParamConst.REPLY_ID);
validationService.check(ParamConst.ID, String.valueOf(replyId));
topicService.removeReply(replyId);
return new ApiJsonDTO().success();
}
use of org.neusoft.neubbs.controller.annotation.AccountActivation in project neubbs by nuitcoder.
the class AccountController method followingUser.
/**
* 关注用户
* - 主动关注其余用户
* - 自动切换:有 -> 无, 无 -> 有
*
* @param requestBodyParams request-body 内 JSON数据
* @return ApiJsonDTO 页面 JSON 传输对象
*/
@RequestMapping(value = "/following", method = RequestMethod.POST, consumes = "application/json")
@LoginAuthorization
@AccountActivation
public ApiJsonDTO followingUser(@RequestBody Map<String, Object> requestBodyParams) {
Integer followingUserId = (Integer) requestBodyParams.get(ParamConst.USER_ID);
validationService.check(ParamConst.USER_ID, String.valueOf(followingUserId));
UserDO cookieUser = secretService.getUserInfoByAuthentication(httpService.getAuthenticationCookieValue());
return new ApiJsonDTO().success().buildMap(ParamConst.FOLLOWING_USER_ID, userService.operateFollowUser(cookieUser.getId(), followingUserId));
}
use of org.neusoft.neubbs.controller.annotation.AccountActivation in project neubbs by nuitcoder.
the class AccountController method updateUserPassword.
/**
* 修改密码
*
* @param requestBodyParamsMap request-body 内 JSON数据
* @return ApiJsonDTO 页面 JSON 传输对象
*/
@LoginAuthorization
@AccountActivation
@RequestMapping(value = "/update-password", method = RequestMethod.POST, consumes = "application/json")
public ApiJsonDTO updateUserPassword(@RequestBody Map<String, Object> requestBodyParamsMap) {
String username = (String) requestBodyParamsMap.get(ParamConst.USERNAME);
String newPassword = (String) requestBodyParamsMap.get(ParamConst.PASSWORD);
validationService.check(ParamConst.USERNAME, username).check(ParamConst.PASSWORD, newPassword);
// confirm input username, can to match cookie user
UserDO cookieUser = secretService.getUserInfoByAuthentication(httpService.getAuthenticationCookieValue());
userService.confirmUserMatchCookieUser(username, cookieUser);
userService.alterUserPasswordByName(username, newPassword);
return new ApiJsonDTO().success();
}
Aggregations