This system is a Q-sharing systems micro-channel applet-based, in the form of micro-channel applet development, back-end using SSH framework for the development, the development of language Java, users can perform in the applet questions, answers, share stories, comments, onlookers and prepaid revenue and other operations, in the course of the crowd, the user may be interested in the content of a reward with thumbs up. For this system to ask questions and share, with free and paid two models, combining ease of interaction and knowledge sharing of information and entertainment performed; if a third person were watching for paid content, fee equal before gold View, gold proceeds will be divided equally into account both the content provider.
//author qq2803180149
@RestController
@RequestMapping("/app/article")
public class ApiArticleController {
@Autowired
private ArticleService articleService;
@Autowired
private JwtUtils jwtUtils;
@Autowired
private LikedService likedService;
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params) {
List<ArticleEntity> articleList = articleService.queryList(params);
return R.ok().put("articleList", articleList);
}
@RequestMapping("/detail")
public R detail(Integer id, String token){
ArticleEntity article = articleService.queryObject(id);
if(StringUtils.isNotEmpty(token)){
String userId = jwtUtils.getClaimByToken(token).getSubject();
Boolean liked = likedService.queryLiked(userId, id);
article.setLiked(liked);
}else {
article.setLiked(false);
}
return R.ok().put("article", article);
}
@RequestMapping("/getOneByColumnId")
public R getOneByColumnId(Integer columnId) {
ArticleEntity article = articleService.queryOneByColumnId(columnId);
return R.ok().put("article", article);
}
@RequestMapping("/getOnByColumnCode")
public R getOnByColumnCode(String columnCode, Long storeId) {
ArticleEntity article = articleService.queryOneByColumnCode(columnCode, storeId);
return R.ok().put("article", article);
}
@Login
@RequestMapping("/liked")
public R liked(Integer articleId, @RequestAttribute("userId") Integer userId) {
articleService.liked(articleId, userId);
return R.ok();
}
@Login
@RequestMapping("/unliked")
public R unliked(Integer articleId, @RequestAttribute("userId") Integer userId) {
articleService.unliked(articleId, userId);
return R.ok();
}
@Login
@RequestMapping("/comment")
public R comment(Integer articleId, @RequestAttribute("userId") Integer userId, String comment) {
articleService.comment(articleId, userId, comment);
return R.ok();
}
}