|
@@ -18,9 +18,9 @@ import (
|
|
|
)
|
|
|
|
|
|
// GetQuestionList 问题列表
|
|
|
-func GetQuestionList(condition string, pars []interface{}, orderStr string, startSize, pageSize int) (total int, resp *ybResponse.CommunityQuestionListResp, err error) {
|
|
|
+func GetQuestionList(condition string, pars []interface{}, startSize, pageSize int) (total int, resp *ybResponse.CommunityQuestionListResp, err error) {
|
|
|
resp = new(ybResponse.CommunityQuestionListResp)
|
|
|
- total, list, e := community_question.GetCommunityQuestionList(condition, pars, orderStr, startSize, pageSize)
|
|
|
+ total, list, e := community_question.GetCommunityQuestionList(condition, pars, startSize, pageSize)
|
|
|
if e != nil {
|
|
|
err = errors.New("获取问题列表失败 Err:" + e.Error())
|
|
|
return
|
|
@@ -36,16 +36,22 @@ func GetQuestionList(condition string, pars []interface{}, orderStr string, star
|
|
|
adminIdArr = append(adminIdArr, strconv.Itoa(list[i].ReplierAdminId))
|
|
|
}
|
|
|
}
|
|
|
- adminIds := strings.Join(adminIdArr, ",")
|
|
|
- adminList, err := admin.GetAdminListByIds(adminIds)
|
|
|
- if err != nil {
|
|
|
- return
|
|
|
- }
|
|
|
- adminLen := len(adminList)
|
|
|
+
|
|
|
+ //管理员信息
|
|
|
adminEnableMap := make(map[int]int, 0)
|
|
|
- if adminLen > 0 {
|
|
|
- for i := 0; i < adminLen; i++ {
|
|
|
- adminEnableMap[adminList[i].AdminId] = adminList[i].Enabled
|
|
|
+
|
|
|
+ if len(adminIdArr) > 0 {
|
|
|
+ adminIds := strings.Join(adminIdArr, ",")
|
|
|
+ adminList, tmpErr := admin.GetAdminListByIds(adminIds)
|
|
|
+ if tmpErr != nil {
|
|
|
+ err = tmpErr
|
|
|
+ return
|
|
|
+ }
|
|
|
+ adminLen := len(adminList)
|
|
|
+ if adminLen > 0 {
|
|
|
+ for i := 0; i < adminLen; i++ {
|
|
|
+ adminEnableMap[adminList[i].AdminId] = adminList[i].Enabled
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -86,29 +92,29 @@ func GetQuestionList(condition string, pars []interface{}, orderStr string, star
|
|
|
respList = append(respList, item)
|
|
|
}
|
|
|
// 数量统计
|
|
|
- countList, e := community_question.GetCommunityQuestionCount()
|
|
|
- if e != nil {
|
|
|
- err = errors.New("获取问题数量统计失败 Err:" + e.Error())
|
|
|
- return
|
|
|
- }
|
|
|
- respCount := new(ybResponse.CommunityQuestionCount)
|
|
|
- for _, v := range countList {
|
|
|
- if v.ReplyStatus == 1 {
|
|
|
- respCount.Free = v.Total
|
|
|
- continue
|
|
|
- }
|
|
|
- if v.ReplyStatus == 2 {
|
|
|
- respCount.Wait = v.Total
|
|
|
- continue
|
|
|
- }
|
|
|
- if v.ReplyStatus == 3 {
|
|
|
- respCount.Replied = v.Total
|
|
|
- continue
|
|
|
- }
|
|
|
- }
|
|
|
- respCount.Total = respCount.Free + respCount.Wait + respCount.Replied
|
|
|
+ //countList, e := community_question.GetCommunityQuestionCount()
|
|
|
+ //if e != nil {
|
|
|
+ // err = errors.New("获取问题数量统计失败 Err:" + e.Error())
|
|
|
+ // return
|
|
|
+ //}
|
|
|
+ //respCount := new(ybResponse.CommunityQuestionCount)
|
|
|
+ //for _, v := range countList {
|
|
|
+ // if v.ReplyStatus == 1 {
|
|
|
+ // respCount.Free = v.Total
|
|
|
+ // continue
|
|
|
+ // }
|
|
|
+ // if v.ReplyStatus == 2 {
|
|
|
+ // respCount.Wait = v.Total
|
|
|
+ // continue
|
|
|
+ // }
|
|
|
+ // if v.ReplyStatus == 3 {
|
|
|
+ // respCount.Replied = v.Total
|
|
|
+ // continue
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+ //respCount.Total = respCount.Free + respCount.Wait + respCount.Replied
|
|
|
resp.List = respList
|
|
|
- resp.Count = respCount
|
|
|
+ //resp.Count = respCount
|
|
|
return
|
|
|
}
|
|
|
|