liujc преди 1 месец
родител
ревизия
c59471f082

+ 3 - 0
cooleshow-app/src/main/java/com/yonge/cooleshow/student/controller/TeacherController.java

@@ -127,6 +127,9 @@ public class TeacherController extends BaseController {
     @GetMapping("/queryHotTeacherList")
     public HttpResponseResult<List<HotTeacherVo>> queryHotTeacherList() {
         SysUser user = sysUserFeignService.queryUserInfo();
+        if (user == null || null == user.getId()) {
+            return failed(HttpStatus.FORBIDDEN, "请登录");
+        }
         Long userId = null;
         if (user != null && null != user.getId()) {
             userId = user.getId();

+ 2 - 2
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/TeacherServiceImpl.java

@@ -1200,8 +1200,8 @@ public class TeacherServiceImpl extends ServiceImpl<TeacherDao, Teacher> impleme
         }
 
         Student student = studentService.getById(userId);
-        Long subjectId = null;
-        if (student.getSubjectId() != null) {
+        Long subjectId = -1L;
+        if (student !=null && student.getSubjectId() != null) {
             subjectId = Long.parseLong(student.getSubjectId());
         }