|
@@ -681,7 +681,7 @@ func GetFirstResearcherByVarietyTagId(tagId int) (researcher *admin.ResearcherAd
|
|
|
researcher = new(admin.ResearcherAdminAndUser)
|
|
|
|
|
|
// 获取标签研究员关系组
|
|
|
- relationList, e := research_variety_tag_relation.GetResearchVarietyTagRelationList()
|
|
|
+ relationList, e := research_variety_tag_relation.GetResearchUserVarietyTagRelationList()
|
|
|
if e != nil {
|
|
|
err = errors.New("获取研究员分组失败, Err: " + e.Error())
|
|
|
return
|
|
@@ -692,32 +692,26 @@ func GetFirstResearcherByVarietyTagId(tagId int) (researcher *admin.ResearcherAd
|
|
|
}
|
|
|
|
|
|
// 从当前组取出有效的研究员信息
|
|
|
- for i := range relationList {
|
|
|
- if relationList[i].VarietyTagId == tagId {
|
|
|
- item, e := admin.GetResearcherAdminAndWxUserByAdminId(relationList[i].AdminId)
|
|
|
- if e != nil && e != utils.ErrNoRow {
|
|
|
- err = errors.New("获取研究员成员信息失败, Err: " + e.Error())
|
|
|
- return
|
|
|
- }
|
|
|
- if item != nil && item.UserId > 0 && item.AdminId > 0 && item.OpenId != "" {
|
|
|
- researcher = item
|
|
|
- break
|
|
|
- }
|
|
|
+ for _, v := range relationList {
|
|
|
+ if v.VarietyTagId == tagId && v.AdminId > 0 && v.UserId > 0 && v.OpenId != "" {
|
|
|
+ researcher.UserId = v.UserId
|
|
|
+ researcher.UserName = v.UserName
|
|
|
+ researcher.AdminId = v.AdminId
|
|
|
+ researcher.AdminName = v.AdminName
|
|
|
+ researcher.OpenId = v.OpenId
|
|
|
+ return
|
|
|
}
|
|
|
}
|
|
|
// 未在当前组找到有效的研究员信息, 去其他组找
|
|
|
if researcher.UserId == 0 || researcher.AdminId == 0 || researcher.OpenId == "" {
|
|
|
- for i := range relationList {
|
|
|
- if relationList[i].VarietyTagId != tagId {
|
|
|
- item, e := admin.GetResearcherAdminAndWxUserByAdminId(relationList[i].AdminId)
|
|
|
- if e != nil && e != utils.ErrNoRow {
|
|
|
- err = errors.New("获取其他组研究员成员信息失败, Err: " + e.Error())
|
|
|
- return
|
|
|
- }
|
|
|
- if item != nil && item.UserId > 0 && item.AdminId > 0 && item.OpenId != "" {
|
|
|
- researcher = item
|
|
|
- break
|
|
|
- }
|
|
|
+ for _, v := range relationList {
|
|
|
+ if v.VarietyTagId != tagId && v.AdminId > 0 && v.UserId > 0 && v.OpenId != "" {
|
|
|
+ researcher.UserId = v.UserId
|
|
|
+ researcher.UserName = v.UserName
|
|
|
+ researcher.AdminId = v.AdminId
|
|
|
+ researcher.AdminName = v.AdminName
|
|
|
+ researcher.OpenId = v.OpenId
|
|
|
+ return
|
|
|
}
|
|
|
}
|
|
|
}
|