package com.wfuhui.modules.bbs.api;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.wfuhui.common.annotation.AuthIgnore;
import com.wfuhui.common.utils.R;
import com.wfuhui.modules.bbs.entity.FollowEntity;
import com.wfuhui.modules.bbs.entity.LikeEntity;
import com.wfuhui.modules.bbs.entity.ReplyEntity;
import com.wfuhui.modules.bbs.entity.TopicEntity;
import com.wfuhui.modules.bbs.service.FollowService;
import com.wfuhui.modules.bbs.service.LikeService;
import com.wfuhui.modules.bbs.service.ReplyService;
import com.wfuhui.modules.bbs.service.TopicService;
/**
* 帖子
*/
@RestController
@RequestMapping("/api/topic")
public class ApiTopicController {
@Autowired
private TopicService topicService;
@Autowired
private LikeService likeService;
@Autowired
private ReplyService replyService;
@Autowired
private FollowService followService;
/**
* 列表
* @param params
* @return
*/
@AuthIgnore
@GetMapping("list")
public R list(@RequestParam Map<String, Object> params){
List<TopicEntity> topicList = topicService.queryList(params);
Integer total = topicService.queryTotal(params);
return R.ok().put("topicList", topicList).put("total", total);
}
/**
* 我的
* @param params
* @param userId
* @return
*/
@GetMapping("mylist")
public R mylist(@RequestParam Map<String, Object> params, @RequestAttribute Long userId){
params.put("userId", userId);
List<TopicEntity> topicList = topicService.queryList(params);
return R.ok().put("topicList", topicList);
}
/**
* 发布
* @param topic
* @param userId
* @return
*/
@RequestMapping("/save")
public R save(@RequestBody TopicEntity topic, @RequestAttribute Long userId){
topic.setMemberId(userId);
topic.setCreateTime(new Date());
topicService.save(topic);
return R.ok();
}
/**
* 详情
* @param id
* @return
*/
@AuthIgnore
@RequestMapping("/detail")
public R detail(Integer id) {
TopicEntity topic = topicService.queryObject(id);
return R.ok().put("topic", topic);
}
/**
* 删除
* @param id
* @return
*/
@RequestMapping("/del")
public R del(Integer id) {
topicService.delete(id);;
return R.ok();
}
/**
* 是否点赞
* @param topicId
* @param userId
* @return
*/
@RequestMapping("/isLike")
public R isLike(Integer topicId, @RequestAttribute Long userId){
Map<String, Object> map = new HashMap<String, Object>();
map.put("topicId", topicId);
map.put("userId", userId);
int total = likeService.queryTotal(map);
if(total > 0) {
return R.ok();
}
return R.error("未点赞");
}
/**
* 点赞
* @param topicId
* @param userId
* @return
*/
@RequestMapping("/like")
public R like(Integer topicId, @RequestAttribute Long userId) {
Map<String, Object> params = new HashMap<String, Object>();
params.put("topicId", topicId);
params.put("userId", userId);
Integer total = likeService.queryTotal(params);
if(total > 0) {
return R.ok();
}
LikeEntity like = new LikeEntity();
like.setTopicId(topicId);
like.setCreateTime(new Date());
like.setMemberId(userId);
likeService.save(like);
return R.ok();
}
/**
* 取消点赞
* @param topicId
* @param userId
* @return
*/
@RequestMapping("/unlike")
public R unlike(Integer topicId, @RequestAttribute Long userId) {
likeService.remove(topicId, userId);
return R.ok();
}
/**
* 回复
* @param reply
* @param userId
* @return
*/
@RequestMapping("/reply")
public R save(@RequestBody ReplyEntity reply, @RequestAttribute Long userId){
reply.setMemberId(userId);
reply.setCreateTime(new Date());
replyService.save(reply);
return R.ok();
}
@RequestMapping("/isFollow")
public R isFollow(Long uId, @RequestAttribute Long userId){
Map<String, Object> map = new HashMap<String, Object>();
map.put("memberId", userId);
map.put("userId", uId);
int total = followService.queryTotal(map);
if(total > 0) {
return R.ok();
}
return R.error("未关注");
}
@RequestMapping("/follow")
public R follow(Long uId, @RequestAttribute Long userId) {
Map<String, Object> params = new HashMap<String, Object>();
params.put("memberId", userId);
params.put("userId", uId);
Integer total = followService.queryTotal(params);
if(total > 0) {
return R.ok();
}
FollowEntity follow = new FollowEntity();
follow.setUserId(uId);
follow.setCreateTime(new Date());
follow.setMemberId(userId);
followService.save(follow);
return R.ok();
}
@RequestMapping("/unfollow")
public R unfollow(Long uId, @RequestAttribute Long userId) {
followService.remove(uId, userId);
return R.ok();
}
@RequestMapping("/mineLike")
public R mineLike(@RequestAttribute Long userId) {
List<TopicEntity> topicList = likeService.queryLike(userId);
return R.ok().put("topicList", topicList);
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
程序开发软件:Idea + 微信开发者工具 + mysql 开发技术:Springboot后端,小程序客户端,bootstrap后端界面 为了方便朋友们在手机端微信交流问题,开发了这个小程序论坛app设计,一共有2个身份包括用户端和管理员端。用户端在小程序手机端使用,用户可以注册账号登录,也可以直接用微信授权登录,登录小程序后可以查询全部论坛帖子,也可以分类查询帖子列表,点击帖子详情页面后可以查询图文并茂的帖子内容,可以收藏点赞转发帖子,也可以发布评论信息,用户也可以发布帖子,发布帖子的时候可以选择多个图片和多个视频上传的,用户个人中心可以修改个人信息,管理自己发布的帖子,查询自己收藏的帖子,管理自己发布的评论信息,查询自己关注的用户;管理员在web端登录后可以统计分析用户数、帖子数、回复数等,可以管理所有用户信息,管理论坛话题分类信息,管理所有帖子和评论信息等。 后台登录地址:http://localhost:10001/admin/login.html 管理员账号密码:admin/admin
资源推荐
资源详情
资源评论
收起资源包目录
基于微信小程序在线论坛bbs交流系统设计springboot后端 (609个子文件)
bootstrap.min.css 118KB
AdminLTE.min.css 88KB
ueditor.css 44KB
all-skins.min.css 40KB
ueditor.min.css 34KB
font-awesome.min.css 30KB
video-js.css 21KB
image.css 19KB
video.css 15KB
attachment.css 15KB
layer.css 14KB
video-js.min.css 11KB
shCoreDefault.css 7KB
bootstrap-table.min.css 6KB
bootstrap-table.min.css 5KB
layer.css 5KB
scrawl.css 4KB
style.css 3KB
codemirror.css 3KB
charts.css 3KB
carousel.css 2KB
background.css 2KB
emotion.css 2KB
dialogbase.css 2KB
music.css 2KB
edittable.css 1KB
demo.css 1KB
jquery.fileupload-ui.css 1KB
template.css 1KB
main.css 708B
jquery.fileupload.css 682B
webuploader.css 515B
jquery.fileupload-noscript.css 433B
help.css 395B
demo-ie8.css 387B
jquery.fileupload-ui-noscript.css 362B
style.css 285B
common.css 218B
iframe.css 42B
fontawesome-webfont.eot 162KB
glyphicons-halflings-regular.eot 20KB
vjs.eot 3KB
UEditorSnapscreen.exe 508KB
wface.gif 49KB
jxface2.gif 40KB
yface.gif 28KB
bface.gif 27KB
icons.gif 20KB
file-icons.gif 20KB
file-icons.gif 20KB
tface.gif 19KB
fface.gif 18KB
cface.gif 8KB
loading-0.gif 6KB
loading.gif 4KB
icons-all.gif 4KB
progressbar.gif 3KB
loading-2.gif 2KB
videologo.gif 2KB
cancelbutton.gif 1KB
button-bg.gif 1KB
lock.gif 1KB
alignicon.gif 1KB
word.gif 1019B
icon_doc.gif 1012B
icon_psd.gif 1009B
icon_rar.gif 1007B
icon_xls.gif 1005B
icon_ppt.gif 1001B
icon_mv.gif 1001B
icon_pdf.gif 996B
icon_mp3.gif 986B
icon_txt.gif 970B
icon_jpg.gif 950B
icon_exe.gif 949B
icon_chm.gif 923B
loading.gif 734B
loading-1.gif 701B
icons.gif 453B
icons.gif 453B
icons.gif 453B
success.gif 445B
success.gif 445B
success.gif 445B
cursor_v.gif 370B
cursor_h.gif 253B
anchor.gif 184B
highlighted.gif 111B
unhighlighted.gif 111B
bg.gif 84B
pagebreak.gif 54B
spacer.gif 43B
0.gif 43B
wordimage.html 6KB
map.html 6KB
emotion.html 6KB
image.html 6KB
category.html 5KB
show.html 5KB
charts.html 5KB
共 609 条
- 1
- 2
- 3
- 4
- 5
- 6
- 7
资源评论
软硬件源码设计案例
- 粉丝: 1548
- 资源: 1055
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- pta题库答案c语言之排序4统计工龄.zip
- pta题库答案c语言之树结构7堆中的路径.zip
- pta题库答案c语言之树结构3TreeTraversalsAgain.zip
- pta题库答案c语言之树结构2ListLeaves.zip
- pta题库答案c语言之树结构1树的同构.zip
- 基于C++实现民航飞行与地图简易管理系统可执行程序+说明+详细注释.zip
- pta题库答案c语言之复杂度1最大子列和问题.zip
- 三维装箱问题(Three-Dimensional Bin Packing Problem,3D-BPP)是一个经典的组合优化问题
- 以下是一些关于Linux线程同步的基本概念和方法.txt
- 以下是一个简化的示例,它使用pygame库来模拟烟花动画的框架.txt
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功