Browse Source

APP:修改我的近况和族友圈

Alex 4 năm trước cách đây
mục cha
commit
920d0a258c

+ 10 - 15
ruoyi-app/src/main/java/com/ruoyi/app/controller/MyPublishController.java

@@ -54,14 +54,11 @@ public class MyPublishController extends AppBaseController {
      * @return
      */
     @ApiOperation("族友圈 分页列表")
-    @ApiImplicitParam(name = "appUserId", value = "会员ID",paramType="Long")
     @GetMapping("/selectCircle")
-    public TableDataInfo selectCircle(Long appUserId){
-        if (appUserId == null) {
-            return new TableDataInfo();
-        }
+    public TableDataInfo selectCircle(){
+        AppMemberVo user = getLoginUser().getUser();
         List<TbMyPublish> list = publishService.selectPublish(new LambdaQueryWrapper<TbMyPublish>()
-                .eq(TbMyPublish::getAppUserId,appUserId)
+                .eq(TbMyPublish::getAppUserId,user.getUserId())
         );
         return getDataTable(list);
     }
@@ -70,19 +67,16 @@ public class MyPublishController extends AppBaseController {
      * 查询我的近况 列表
      */
     @ApiOperation("我的近况 分页列表")
-    @ApiImplicitParam(name = "appUserId", value = "会员ID",paramType="Long")
     @GetMapping("/list")
-    public TableDataInfo pageList(Long appUserId) {
-        if (appUserId == null) {
-            return new TableDataInfo();
-        }
+    public TableDataInfo pageList() {
+        AppMemberVo user = getLoginUser().getUser();
         TbMyPublish tbMyPublish = new TbMyPublish();
-        tbMyPublish.setAppUserId(appUserId);
+        tbMyPublish.setAppUserId(user.getUserId());
         tbMyPublish.setDeleted("N");
         return publishService.pageList(tbMyPublish);
     }
 
-    @ApiOperation("获取我的近况")
+    @ApiOperation("获取我的近况详情")
     @ApiImplicitParam(name = "id", value = "主键id",paramType="Long")
     @GetMapping("/get")
     public AjaxResult get(Long id) {
@@ -123,13 +117,14 @@ public class MyPublishController extends AppBaseController {
     @PostMapping("/add")
     @Transactional(rollbackFor = Exception.class)
     public AjaxResult add(@RequestBody TbMyPublish publish) {
-        if (publish.getAppUserId() == null || StringUtils.isBlank(publish.getContents())) {
-            return AjaxResult.error("数据为空");
+        if (StringUtils.isBlank(publish.getContents())) {
+            return AjaxResult.error("内容不能为空");
         }
         if (publish.getContents().length() > 500) {
             return AjaxResult.error("发表内容不能超过500字");
         }
         AppMemberVo user = getLoginUser().getUser();
+        publish.setAppUserId(user.getUserId());
         publish.setCreateBy(user.getUserId().toString());
         publish.setCreateTime(new Date());
         if (!publishService.save(publish)){