use of org.neusoft.neubbs.dto.ApiJsonDTO 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.dto.ApiJsonDTO 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.dto.ApiJsonDTO 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.dto.ApiJsonDTO in project neubbs by nuitcoder.
the class AccountController method validateCaptcha.
/**
* 校验验证码
* - 比较用户输入验证,是否匹配 session 中储存 5 位随机验证码
*
* @param captcha 用户输入验证码
* @return ApiJsonDTO 接口 JSON 传输对象
*/
@RequestMapping(value = "/validate-captcha", method = RequestMethod.GET)
public ApiJsonDTO validateCaptcha(@RequestParam(value = "captcha", required = false) String captcha) {
validationService.check(ParamConst.CAPTCHA, captcha);
captchaService.validate(captcha, httpService.getCaptchaText());
return new ApiJsonDTO().success();
}
use of org.neusoft.neubbs.dto.ApiJsonDTO 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));
}
Aggregations