|
@@ -7,6 +7,7 @@ import (
|
|
|
"eta/eta_mini_ht_api/common/exception"
|
|
|
authUtils "eta/eta_mini_ht_api/common/utils/auth"
|
|
|
"eta/eta_mini_ht_api/controllers"
|
|
|
+ userService "eta/eta_mini_ht_api/domian/user"
|
|
|
"eta/eta_mini_ht_api/service/auth"
|
|
|
"eta/eta_mini_ht_api/service/user"
|
|
|
"fmt"
|
|
@@ -91,6 +92,10 @@ func (u *UserController) Feedback() {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+type BatchFollowResp struct {
|
|
|
+ FollowStatus string `json:"followStatus"`
|
|
|
+ List []userService.FollowDTO `json:"list"`
|
|
|
+}
|
|
|
type FollowResp struct {
|
|
|
AnalystId int `json:"analystId"`
|
|
|
FollowedType string `json:"FollowedType"`
|
|
@@ -193,14 +198,31 @@ func (u *UserController) CheckFollowStatus(names string) {
|
|
|
nameList[i] = strings.TrimSpace(nameList[i])
|
|
|
}
|
|
|
list, err := user.CheckFollowStatusByNames(userInfo.Id, nameList)
|
|
|
+ status := true
|
|
|
+ data := BatchFollowResp{
|
|
|
+ List: list,
|
|
|
+ }
|
|
|
+ for i := 0; i < len(list); i++ {
|
|
|
+ if !checkFollowing(list[i].FollowType) {
|
|
|
+ status = false
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if status {
|
|
|
+ data.FollowStatus = "following"
|
|
|
+ } else {
|
|
|
+ data.FollowStatus = "unfollowed"
|
|
|
+ }
|
|
|
if err != nil {
|
|
|
u.FailedResult("获取关注状态失败", result)
|
|
|
return
|
|
|
}
|
|
|
- u.SuccessResult("获取关注状态成功", list, result)
|
|
|
+ u.SuccessResult("获取关注状态成功", data, result)
|
|
|
return
|
|
|
})
|
|
|
-
|
|
|
+}
|
|
|
+func checkFollowing(followType string) bool {
|
|
|
+ return followType == "following"
|
|
|
}
|
|
|
|
|
|
// FollowAnalyst 关注研究员
|