Commit 6f895232 authored by 刘基明's avatar 刘基明

接口修改

parent 108f9fda
...@@ -2,6 +2,8 @@ package com.tanpu.community.controller; ...@@ -2,6 +2,8 @@ package com.tanpu.community.controller;
import com.tanpu.common.api.CommonResp; import com.tanpu.common.api.CommonResp;
import com.tanpu.common.auth.AuthLogin;
import com.tanpu.common.auth.UserHolder;
import com.tanpu.community.api.beans.qo.CommentQo; import com.tanpu.community.api.beans.qo.CommentQo;
import com.tanpu.community.api.beans.req.comment.CreateCommentReq; import com.tanpu.community.api.beans.req.comment.CreateCommentReq;
import com.tanpu.community.api.beans.req.comment.LikeCommentReq; import com.tanpu.community.api.beans.req.comment.LikeCommentReq;
...@@ -14,6 +16,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -14,6 +16,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List; import java.util.List;
@RestController @RestController
...@@ -24,21 +27,26 @@ public class CommentController { ...@@ -24,21 +27,26 @@ public class CommentController {
@Autowired @Autowired
private CommentManager commentManager; private CommentManager commentManager;
@Resource
private UserHolder userHolder;
@ApiOperation("发表评论") @ApiOperation("发表评论")
@AuthLogin
@PostMapping(value = "/publishComment") @PostMapping(value = "/publishComment")
@ResponseBody @ResponseBody
public CommonResp<Void> publishCommet(@RequestBody CreateCommentReq req) { public CommonResp<Void> publishCommet(@RequestBody CreateCommentReq req) {
String userId = "liujm"; String userId = userHolder.getUserInfo().getId();
commentManager.comment(req, userId); commentManager.comment(req, userId);
return CommonResp.success(); return CommonResp.success();
} }
@ApiOperation("查看评论") @ApiOperation("查看评论")
@AuthLogin
@PostMapping(value = "/queryComment") @PostMapping(value = "/queryComment")
@ResponseBody @ResponseBody
public CommonResp<Page<CommentQo>> queryComment(@RequestBody QueryCommentReq req) { public CommonResp<Page<CommentQo>> queryComment(@RequestBody QueryCommentReq req) {
//todo //todo
String userId = "liujm"; String userId = userHolder.getUserInfo().getId();
List<CommentQo> result = commentManager.queryComments(req.getThemeId(), userId); List<CommentQo> result = commentManager.queryComments(req.getThemeId(), userId);
return CommonResp.success(PageUtils.page(req.getPage(), result)); return CommonResp.success(PageUtils.page(req.getPage(), result));
} }
...@@ -47,7 +55,7 @@ public class CommentController { ...@@ -47,7 +55,7 @@ public class CommentController {
@PostMapping(value = "/likeComment") @PostMapping(value = "/likeComment")
@ResponseBody @ResponseBody
public CommonResp<Void> likeComment(@RequestBody LikeCommentReq req) { public CommonResp<Void> likeComment(@RequestBody LikeCommentReq req) {
String userId = "liujm"; String userId = userHolder.getUserId();
commentManager.likeComment(req, userId); commentManager.likeComment(req, userId);
return CommonResp.success(); return CommonResp.success();
} }
...@@ -57,7 +65,7 @@ public class CommentController { ...@@ -57,7 +65,7 @@ public class CommentController {
@ResponseBody @ResponseBody
public CommonResp<Void> reportComment(@RequestParam String commentId) { public CommonResp<Void> reportComment(@RequestParam String commentId) {
//todo //todo
String userId = "liujm"; String userId = userHolder.getUserId();
return CommonResp.failed("功能暂未开放"); return CommonResp.failed("功能暂未开放");
} }
} }
...@@ -10,8 +10,8 @@ import org.springframework.web.bind.annotation.RequestParam; ...@@ -10,8 +10,8 @@ import org.springframework.web.bind.annotation.RequestParam;
import java.util.List; import java.util.List;
@FeignClient(value = "service-product", url = "${tanpu.feo-product.svc:}", fallbackFactory = FeignBackClientForProducts.class, path = "/product") //@FeignClient(value = "service-product", url = "${tanpu.feo-product.svc:}", fallbackFactory = FeignBackClientForProducts.class, path = "/product")
//@FeignClient(value = "service-product", contextId = "product", fallbackFactory = FeignBackClientForProducts.class, url = "http://127.0.0.1:8194/product") @FeignClient(value = "service-product", contextId = "product", fallbackFactory = FeignBackClientForProducts.class, url = "http://172.20.0.68:8194/product")
public interface FeignClientForProducts { public interface FeignClientForProducts {
@ApiOperation("获取产品详情") @ApiOperation("获取产品详情")
......
...@@ -13,8 +13,8 @@ import org.springframework.web.bind.annotation.RequestParam; ...@@ -13,8 +13,8 @@ import org.springframework.web.bind.annotation.RequestParam;
import java.util.List; import java.util.List;
@FeignClient(value = "service-tanpuroom", url = "${tanpu.feo-tanpuroom.svc:}", fallbackFactory = FeignBackClientForTanpuroom.class, path = "/tanpuroom") //@FeignClient(value = "service-tanpuroom", url = "${tanpu.feo-tanpuroom.svc:}", fallbackFactory = FeignBackClientForTanpuroom.class, path = "/tanpuroom")
//@FeignClient(value = "service-tanpuroom", contextId = "tanpuroom", fallbackFactory = FeignBackClientForTanpuroom.class, url = "http://127.0.0.1:8086/tanpuroom") @FeignClient(value = "service-tanpuroom", contextId = "tanpuroom", fallbackFactory = FeignBackClientForTanpuroom.class, url = "http://172.20.1.221:8086/tanpuroom")
public interface FeignClientForTanpuroom { public interface FeignClientForTanpuroom {
......
...@@ -13,8 +13,8 @@ import org.springframework.web.bind.annotation.RequestBody; ...@@ -13,8 +13,8 @@ import org.springframework.web.bind.annotation.RequestBody;
import java.util.List; import java.util.List;
@FeignClient(value = "service-zhibo", url = "${tanpu.feo-zhibo.svc:}", fallbackFactory = FeignbackForZhibo.class, path = "/zhibo") //@FeignClient(value = "service-zhibo", url = "${tanpu.feo-zhibo.svc:}", fallbackFactory = FeignbackForZhibo.class, path = "/zhibo")
//@FeignClient(value = "service-zhibo", fallbackFactory = FeignbackForZhibo.class, url = "http://127.0.0.1:8183/zhibo") @FeignClient(value = "service-zhibo", fallbackFactory = FeignbackForZhibo.class, url = "http://172.20.0.169:8183/zhibo")
public interface FeignClientForZhibo { public interface FeignClientForZhibo {
@ApiOperation(value = "根据直播间id查询直播间信息") @ApiOperation(value = "根据直播间id查询直播间信息")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment