igl пре 1 година
родитељ
комит
2861a8acc5

+ 67 - 0
src/main/java/com/chelvc/cloud/maintain/controller/AttentionController.java

@@ -0,0 +1,67 @@
+package com.chelvc.cloud.maintain.controller;
+
+import com.chelvc.cloud.vehicle.api.dto.AttentionTotalDTO;
+import com.chelvc.cloud.vehicle.api.dto.AttentionUserDTO;
+import com.chelvc.cloud.vehicle.api.param.QueryAttentionParam;
+import com.chelvc.cloud.vehicle.api.service.AttentionService;
+import com.chelvc.framework.base.context.SessionContextHolder;
+import com.chelvc.framework.common.model.PagedDTO;
+import com.chelvc.framework.common.model.Pagination;
+import lombok.RequiredArgsConstructor;
+import org.apache.dubbo.config.annotation.DubboReference;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * 用户关注
+ * @PACKAGE_NAME: net.yeeu.collision.user.client.controller
+ * @NAME: AttentionController
+ * @USER: igl
+ * @DATE: 2023/8/14 9:55
+ */
+@Validated
+@RestController
+@RequestMapping("/client/attention")
+@RequiredArgsConstructor(onConstructor = @__(@Autowired))
+public class AttentionController {
+
+  @DubboReference
+  private AttentionService attentionService;
+
+  /**
+   * 关注/取关用户
+   *
+   * @param targetUserId 目标用户标识
+   * @author igl
+   * @date 2023/2/25 19:42
+   * @apiNote 如果已关注,则会取消关注
+   */
+  @PostMapping("/concern")
+  public void concern(@RequestParam("targetUserId") Long targetUserId) {
+    attentionService.concern(SessionContextHolder.getId(), targetUserId);
+  }
+
+  /**
+   * 分页查看关注、粉丝、好友
+   *
+   * @param page
+   * @param param
+   * @author igl
+   * @date 2023/8/14 12:42
+   */
+  @GetMapping("/list")
+  public Pagination<AttentionUserDTO> page(PagedDTO page, @Validated QueryAttentionParam param) {
+    return attentionService.page(page, param, SessionContextHolder.getId());
+  }
+
+  /**
+   * 查看关注、粉丝、好友总数
+   * @author igl
+   * @date 2023/8/15 19:42
+   */
+  @GetMapping("/total")
+  public AttentionTotalDTO queryTotalByUserId(){
+    return attentionService.queryTotalByUserId(SessionContextHolder.getId());
+  }
+}

+ 3 - 3
src/main/resources/application-dev.yml

@@ -2,7 +2,7 @@ spring:
   cloud:
     nacos:
       discovery:
-        server-addr: 47.108.128.78:6848
+        server-addr: 127.0.0.1:8848
   redis:
     host: 47.108.128.78
     port: 7031
@@ -10,11 +10,11 @@ spring:
 
 dubbo:
   registry:
-    address: nacos://47.108.128.78:6848
+    address: nacos://127.0.0.1:8848
 
 nacos:
   config:
-    server-addr: 47.108.128.78:6848
+    server-addr: 127.0.0.1:8848
 
 oauth:
   token: