|
@@ -50,7 +50,6 @@ func (b MessaggeService) Count(newUserId, positionId int64) (last map[string]int
|
|
// 用户列表查询
|
|
// 用户列表查询
|
|
func (b MessaggeService) UserList(in *messagecenter.UserReq) (data *[]map[string]interface{}, count int64, err error) {
|
|
func (b MessaggeService) UserList(in *messagecenter.UserReq) (data *[]map[string]interface{}, count int64, err error) {
|
|
sqlStr := ""
|
|
sqlStr := ""
|
|
- countStr := ""
|
|
|
|
tm := time.Now()
|
|
tm := time.Now()
|
|
if in.UserType == 2 {
|
|
if in.UserType == 2 {
|
|
var (
|
|
var (
|
|
@@ -243,7 +242,6 @@ func (b MessaggeService) UserList(in *messagecenter.UserReq) (data *[]map[string
|
|
if in.Size <= 0 || in.Size > 100 {
|
|
if in.Size <= 0 || in.Size > 100 {
|
|
in.Size = 50
|
|
in.Size = 50
|
|
}
|
|
}
|
|
- pageIndex := (in.Page - 1) * in.Size
|
|
|
|
sqlStr = fmt.Sprintf(`SELECT
|
|
sqlStr = fmt.Sprintf(`SELECT
|
|
(
|
|
(
|
|
CASE
|
|
CASE
|
|
@@ -270,32 +268,27 @@ func (b MessaggeService) UserList(in *messagecenter.UserReq) (data *[]map[string
|
|
(%s) a
|
|
(%s) a
|
|
LEFT JOIN socialize_message c ON ( a.message_id = c.id )
|
|
LEFT JOIN socialize_message c ON ( a.message_id = c.id )
|
|
ORDER BY
|
|
ORDER BY
|
|
- a.timestamp DESC limit %v ,%v`, restrictionSql, pageIndex, in.Size)
|
|
|
|
- countStr = fmt.Sprintf(`SELECT count(1)
|
|
|
|
|
|
+ a.timestamp DESC limit %v ,%v`, restrictionSql, (in.Page-1)*in.Size, in.Size)
|
|
|
|
+ count = IC.BaseMysql.CountBySql(fmt.Sprintf(`SELECT count(1)
|
|
FROM
|
|
FROM
|
|
- (%s) a
|
|
|
|
- LEFT JOIN socialize_message c ON ( a.message_id = c.id )
|
|
|
|
- ORDER BY
|
|
|
|
- a.timestamp DESC`, restrictionSql)
|
|
|
|
|
|
+ (%s) a`, restrictionSql))
|
|
}
|
|
}
|
|
if sqlStr != "" {
|
|
if sqlStr != "" {
|
|
log.Println("查询列表sql:", sqlStr)
|
|
log.Println("查询列表sql:", sqlStr)
|
|
- if in.UserType == 1 {
|
|
|
|
- count = IC.BaseMysql.CountBySql(countStr)
|
|
|
|
- }
|
|
|
|
data = IC.BaseMysql.SelectBySql(sqlStr)
|
|
data = IC.BaseMysql.SelectBySql(sqlStr)
|
|
if data != nil && len(*data) > 0 {
|
|
if data != nil && len(*data) > 0 {
|
|
log.Println("查询列表耗时2:", time.Since(tm), in.QueryType, count)
|
|
log.Println("查询列表耗时2:", time.Since(tm), in.QueryType, count)
|
|
switch in.UserType { //客服查询结果分页
|
|
switch in.UserType { //客服查询结果分页
|
|
case 1:
|
|
case 1:
|
|
- /*count = quitl.Int64All(len(*data))
|
|
|
|
- if in.Page*in.Size >= count {
|
|
|
|
- dataSize = (*data)[(in.Page-1)*in.Size:]
|
|
|
|
- } else {
|
|
|
|
- dataSize = (*data)[(in.Page-1)*in.Size : in.Page*in.Size]
|
|
|
|
- }*/
|
|
|
|
|
|
+ /*
|
|
|
|
+ if in.Page*in.Size >= count {
|
|
|
|
+ dataSize = (*data)[(in.Page-1)*in.Size:]
|
|
|
|
+ } else {
|
|
|
|
+ dataSize = (*data)[(in.Page-1)*in.Size : in.Page*in.Size]
|
|
|
|
+ }*/
|
|
return data, count, err
|
|
return data, count, err
|
|
case 2: //用户查询结果
|
|
case 2: //用户查询结果
|
|
|
|
+ count = quitl.Int64All(len(*data))
|
|
phoneMap, _, positionMap := EntPerson(in.EntId, true) //获取企业架构人员名称
|
|
phoneMap, _, positionMap := EntPerson(in.EntId, true) //获取企业架构人员名称
|
|
log.Println("查询列表耗时3:", time.Since(tm))
|
|
log.Println("查询列表耗时3:", time.Since(tm))
|
|
for _, v := range *data {
|
|
for _, v := range *data {
|