liweifan 2 роки тому
батько
коміт
758afc2b1b

+ 0 - 1
cooleshow-user/user-student/src/main/java/com/yonge/cooleshow/student/StudentApplication.java

@@ -4,7 +4,6 @@ import com.spring4all.swagger.EnableSwagger2Doc;
 import com.yonge.cooleshow.common.constant.AppConstant;
 import com.yonge.toolset.base.BaseApplication;
 import org.mybatis.spring.annotation.MapperScan;
-import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
 import org.springframework.cloud.openfeign.EnableFeignClients;

+ 4 - 0
cooleshow-user/user-website/pom.xml

@@ -73,6 +73,10 @@
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
             </plugin>
+            <plugin>
+                <groupId>com.spotify</groupId>
+                <artifactId>docker-maven-plugin</artifactId>
+            </plugin>
         </plugins>
     </build>
 </project>

+ 20 - 3
cooleshow-user/user-website/src/main/java/com/yonge/cooleshow/website/controller/StudentController.java

@@ -5,7 +5,9 @@ import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
 import com.yonge.cooleshow.auth.api.entity.SysUser;
 import com.yonge.cooleshow.biz.dal.entity.Student;
 import com.yonge.cooleshow.biz.dal.entity.Subject;
+import com.yonge.cooleshow.biz.dal.enums.YesOrNoEnum;
 import com.yonge.cooleshow.biz.dal.service.StudentService;
+import com.yonge.cooleshow.biz.dal.service.StudentStarService;
 import com.yonge.cooleshow.biz.dal.support.PageUtil;
 import com.yonge.cooleshow.biz.dal.vo.MyFollow;
 import com.yonge.cooleshow.biz.dal.vo.StudentHomeVo;
@@ -30,6 +32,8 @@ public class StudentController extends BaseController {
     @Autowired
     private StudentService studentService;
     @Autowired
+    private StudentStarService studentStarService;
+    @Autowired
     private SysUserFeignService sysUserFeignService;
 
     @ApiOperation(value = "查询学员")
@@ -88,8 +92,21 @@ public class StudentController extends BaseController {
         return succeed(PageUtil.pageInfo(pages));
     }
 
-
-
-
+    @ApiOperation(value = "关注/取消关注")
+    @GetMapping("/starOrUnStar")
+    public HttpResponseResult<Boolean> starOrUnStar(@ApiParam(value = "老师ID", required = true) @RequestParam("userId") Long userId,
+                                                    @ApiParam(value = "状态 0 取消关注 1 关注", required = true) @RequestParam("starStatus") YesOrNoEnum starStatus) {
+        if (null == userId) {
+            return failed("缺少老师ID");
+        }
+        if (null == starStatus) {
+            return failed("缺少关注状态");
+        }
+        SysUser user = sysUserFeignService.queryUserInfo();
+        if (user == null || null == user.getId()) {
+            return failed(HttpStatus.FORBIDDEN, "请登录");
+        }
+        return studentStarService.starOrUnStar(user.getId(), userId, starStatus);
+    }
 
 }