|
@@ -42,7 +42,7 @@ func (l *GetViewStatusLogic) GetViewStatus(in *bxsubscribe.GetViewStatusReq) (*b
|
|
in.InfoId = util.DecodeId(in.InfoId)
|
|
in.InfoId = util.DecodeId(in.InfoId)
|
|
log.Println("查看状态参数", in)
|
|
log.Println("查看状态参数", in)
|
|
res := new(bxsubscribe.ViewStatusResp)
|
|
res := new(bxsubscribe.ViewStatusResp)
|
|
- finsql = `SELECT userid,isvisit,visittime,date FROM pushentniche where infoid =? and source in (2,3) order By date asc`
|
|
|
|
|
|
+ finsql = `SELECT userid,isvisit,visittime,date FROM pushentniche where infoid =? and source in (2,3) order By date desc`
|
|
if user.Role_admin_department {
|
|
if user.Role_admin_department {
|
|
users = model.GetDisUsers(common.IntAll(in.EntId), user.Dept.Id)
|
|
users = model.GetDisUsers(common.IntAll(in.EntId), user.Dept.Id)
|
|
if users != nil && len(*users) > 0 {
|
|
if users != nil && len(*users) > 0 {
|
|
@@ -59,7 +59,7 @@ func (l *GetViewStatusLogic) GetViewStatus(in *bxsubscribe.GetViewStatusReq) (*b
|
|
users = model.GetEntUsers(common.IntAll(in.EntId))
|
|
users = model.GetEntUsers(common.IntAll(in.EntId))
|
|
}
|
|
}
|
|
if len(ss) > 0 {
|
|
if len(ss) > 0 {
|
|
- finsql = fmt.Sprintf(`SELECT userid,isvisit,visittime,date FROM pushentniche where infoid =? and source in (2,3) %s order By date asc`, fmt.Sprintf(`and userid in (%s)`, strings.Join(ss, ",")))
|
|
|
|
|
|
+ finsql = fmt.Sprintf(`SELECT userid,isvisit,visittime,date FROM pushentniche where infoid =? and source in (2,3) %s order By date desc`, fmt.Sprintf(`and userid in (%s)`, strings.Join(ss, ",")))
|
|
}
|
|
}
|
|
data := IC.BaseServiceMysql.SelectBySql(finsql, in.InfoId)
|
|
data := IC.BaseServiceMysql.SelectBySql(finsql, in.InfoId)
|
|
userMap := make(map[int]string)
|
|
userMap := make(map[int]string)
|
|
@@ -76,14 +76,24 @@ func (l *GetViewStatusLogic) GetViewStatus(in *bxsubscribe.GetViewStatusReq) (*b
|
|
da.Isvisit = common.Int64All(v["isvisit"])
|
|
da.Isvisit = common.Int64All(v["isvisit"])
|
|
da.Visittime = common.Int64All(v["visittime"])
|
|
da.Visittime = common.Int64All(v["visittime"])
|
|
da.Id = common.Int64All(userid)
|
|
da.Id = common.Int64All(userid)
|
|
- if v2, ok1 := d[common.InterfaceToStr(userid)]; !ok1 {
|
|
|
|
|
|
+ if _, ok1 := d[common.InterfaceToStr(userid)]; !ok1 {
|
|
res.Items = append(res.Items, &da)
|
|
res.Items = append(res.Items, &da)
|
|
d[common.InterfaceToStr(userid)] = len(res.Items) - 1
|
|
d[common.InterfaceToStr(userid)] = len(res.Items) - 1
|
|
- } else {
|
|
|
|
- res.Items[v2] = &da
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ Reverse(&res.Items)
|
|
return res, nil
|
|
return res, nil
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+// 数组倒序函数
|
|
|
|
+func Reverse(arr *[]*bxsubscribe.UserStatus) {
|
|
|
|
+ var temp *bxsubscribe.UserStatus
|
|
|
|
+ length := len(*arr)
|
|
|
|
+ for i := 0; i < length/2; i++ {
|
|
|
|
+ temp = (*arr)[i]
|
|
|
|
+ (*arr)[i] = (*arr)[length-1-i]
|
|
|
|
+ (*arr)[length-1-i] = temp
|
|
|
|
+ }
|
|
|
|
+}
|