浏览代码

关注列表不展示被禁用的研究员

xyxie 2 天之前
父节点
当前提交
0e5c73014e

+ 8 - 0
controllers/user/analyst_controller.go

@@ -70,6 +70,14 @@ func (an *AnalystController) AnalystDetail(analystId int) {
 			an.SuccessResult("获取研究员详情成功", defaultRes, result)
 			an.SuccessResult("获取研究员详情成功", defaultRes, result)
 			return
 			return
 		}
 		}
+		if !detail.Status {
+			defaultRes := &user.AnalystDetail{
+				Followed: string(userDao.Forbidden),
+				Status:   false,
+			}
+			an.SuccessResult("获取研究员详情成功", defaultRes, result)
+			return
+		}
 		an.SuccessResult("获取研究员详情成功", detail, result)
 		an.SuccessResult("获取研究员详情成功", detail, result)
 		return
 		return
 	})
 	})

+ 1 - 0
domian/financial_analyst/financial_analyst_service.go

@@ -84,5 +84,6 @@ func convertToBaseDTO(financialAnalyst financialAnalystDao.CrmFinancialAnalyst)
 		ProfessionalCertificate: financialAnalyst.ProfessionalCertificate,
 		ProfessionalCertificate: financialAnalyst.ProfessionalCertificate,
 		InvestmentCertificate:   financialAnalyst.InvestmentCertificate,
 		InvestmentCertificate:   financialAnalyst.InvestmentCertificate,
 		Position:                financialAnalyst.Position,
 		Position:                financialAnalyst.Position,
+		Status:                  financialAnalyst.Status == financialAnalystDao.AnalystStatusEnabled,
 	}
 	}
 }
 }

+ 14 - 5
domian/report/report_service.go

@@ -131,11 +131,20 @@ func GetReportById(reportId int, userId int) (ReportDTO ReportDTO, err error) {
 					Following:  string(userDao.Forbidden),
 					Following:  string(userDao.Forbidden),
 				}
 				}
 			} else {
 			} else {
-				item = Anthor{
-					Id:         author.Id,
-					Name:       author.Name,
-					HeadImgUrl: author.HeadImgUrl,
-					Following:  userDao.GetFollowing(userId, author.Id),
+				if author.Status {
+					item = Anthor{
+						Id:         author.Id,
+						Name:       author.Name,
+						HeadImgUrl: author.HeadImgUrl,
+						Following:  userDao.GetFollowing(userId, author.Id),
+					}
+				} else {
+					item = Anthor{
+						Id:         0,
+						Name:       name,
+						HeadImgUrl: author.HeadImgUrl,
+						Following:  string(userDao.Forbidden),
+					}
 				}
 				}
 			}
 			}
 			authorList = append(authorList, item)
 			authorList = append(authorList, item)

+ 2 - 2
routers/commentsRouter.go

@@ -301,7 +301,7 @@ func init() {
     beego.GlobalControllerRouter["eta/eta_mini_ht_api/controllers/user:AccountController"] = append(beego.GlobalControllerRouter["eta/eta_mini_ht_api/controllers/user:AccountController"],
     beego.GlobalControllerRouter["eta/eta_mini_ht_api/controllers/user:AccountController"] = append(beego.GlobalControllerRouter["eta/eta_mini_ht_api/controllers/user:AccountController"],
         beego.ControllerComments{
         beego.ControllerComments{
             Method: "CheckUserStatus",
             Method: "CheckUserStatus",
-            Router: `/checkUserStatus/`,
+            Router: `/checkUserStatus`,
             AllowHTTPMethods: []string{"post"},
             AllowHTTPMethods: []string{"post"},
             MethodParams: param.Make(),
             MethodParams: param.Make(),
             Filters: nil,
             Filters: nil,
@@ -310,7 +310,7 @@ func init() {
     beego.GlobalControllerRouter["eta/eta_mini_ht_api/controllers/user:AccountController"] = append(beego.GlobalControllerRouter["eta/eta_mini_ht_api/controllers/user:AccountController"],
     beego.GlobalControllerRouter["eta/eta_mini_ht_api/controllers/user:AccountController"] = append(beego.GlobalControllerRouter["eta/eta_mini_ht_api/controllers/user:AccountController"],
         beego.ControllerComments{
         beego.ControllerComments{
             Method: "GetRiskInfoToken",
             Method: "GetRiskInfoToken",
-            Router: `/v1/riskTestToken/`,
+            Router: `/v1/riskTestToken`,
             AllowHTTPMethods: []string{"get"},
             AllowHTTPMethods: []string{"get"},
             MethodParams: param.Make(),
             MethodParams: param.Make(),
             Filters: nil,
             Filters: nil,

+ 12 - 6
service/user/user_service.go

@@ -49,6 +49,7 @@ type AnalystDetail struct {
 	Position                string `json:"position"`
 	Position                string `json:"position"`
 	InvestmentCertificate   string `json:"investmentCertificate"`
 	InvestmentCertificate   string `json:"investmentCertificate"`
 	ProfessionalCertificate string `json:"professionalCertificate"`
 	ProfessionalCertificate string `json:"professionalCertificate"`
+	Status                  bool   `json:"status"`
 }
 }
 
 
 type UserProfile struct {
 type UserProfile struct {
@@ -264,6 +265,7 @@ func convertToAnalystDetail(dto analystService.FinancialAnalystDTO) AnalystDetai
 		Position:                dto.Position,
 		Position:                dto.Position,
 		InvestmentCertificate:   dto.InvestmentCertificate,
 		InvestmentCertificate:   dto.InvestmentCertificate,
 		ProfessionalCertificate: dto.ProfessionalCertificate,
 		ProfessionalCertificate: dto.ProfessionalCertificate,
+		Status:                  dto.Status,
 	}
 	}
 
 
 }
 }
@@ -323,7 +325,7 @@ func FollowAnalyst(userId int, analystId int, followType string) (err error) {
 	}
 	}
 	return
 	return
 }
 }
-func GetFollowingAnalystList(userId int) (analysts []FollowAnalystDTO, err error) {
+func GetFollowingAnalystList(userId int) (followedList []FollowAnalystDTO, err error) {
 	logger.Info("用户ID:%d", userId)
 	logger.Info("用户ID:%d", userId)
 	dtoList, err := userService.GetFollowingAnalystList(userId)
 	dtoList, err := userService.GetFollowingAnalystList(userId)
 	if err != nil {
 	if err != nil {
@@ -331,7 +333,8 @@ func GetFollowingAnalystList(userId int) (analysts []FollowAnalystDTO, err error
 		err = exception.New(exception.GetFollowingAnalystListFailed)
 		err = exception.New(exception.GetFollowingAnalystListFailed)
 		return
 		return
 	}
 	}
-	analysts, err = convertToAnalystList(dtoList)
+	followedList = make([]FollowAnalystDTO, 0)
+	analysts, err := convertToAnalystList(dtoList)
 	var wg sync.WaitGroup
 	var wg sync.WaitGroup
 	wg.Add(len(analysts))
 	wg.Add(len(analysts))
 	for i := 0; i < len(analysts); i++ {
 	for i := 0; i < len(analysts); i++ {
@@ -346,18 +349,21 @@ func GetFollowingAnalystList(userId int) (analysts []FollowAnalystDTO, err error
 			} else {
 			} else {
 				followDTo.HeadImgUrl = analystsDTO.HeadImgUrl
 				followDTo.HeadImgUrl = analystsDTO.HeadImgUrl
 			}
 			}
+			if analystsDTO.Status {
+				followedList = append(followedList, *followDTo)
+			}
 		}(&analysts[i])
 		}(&analysts[i])
 	}
 	}
 	wg.Wait()
 	wg.Wait()
 	//排序
 	//排序
-	sort.Slice(analysts, func(i, j int) bool {
+	sort.Slice(followedList, func(i, j int) bool {
 		// 首先按 NeedNotice 排序
 		// 首先按 NeedNotice 排序
-		if analysts[i].NeedNotice == analysts[j].NeedNotice {
+		if followedList[i].NeedNotice == followedList[j].NeedNotice {
 			// 对于 NeedNotice 相同的情况下,进行倒序排列
 			// 对于 NeedNotice 相同的情况下,进行倒序排列
-			return analysts[i].FollowedTime.After(analysts[j].FollowedTime)
+			return followedList[i].FollowedTime.After(followedList[j].FollowedTime)
 		}
 		}
 		// NeedNotice 为 true 的排在 false 的前面
 		// NeedNotice 为 true 的排在 false 的前面
-		return analysts[i].NeedNotice
+		return followedList[i].NeedNotice
 	})
 	})
 	//if err != nil {
 	//if err != nil {
 	//	logger.Error("转换研究员列表失败:%v", err)
 	//	logger.Error("转换研究员列表失败:%v", err)