|
@@ -400,14 +400,33 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
|
|
|
userStr := " 1=1 "
|
|
|
var (
|
|
|
countSql, findSql string
|
|
|
+ list []map[string]interface{}
|
|
|
)
|
|
|
querys = append(querys, " ")
|
|
|
if spqp.SelectInfoIds != nil && len(spqp.SelectInfoIds) > 0 {
|
|
|
- countSql = fmt.Sprintf("select count(1) as count from %s a where %s", aboutDbMsg[s.ModuleFlag].MysqlTable, fmt.Sprintf("a.id in ('%s')", strings.Join(spqp.SelectInfoIds, "','")))
|
|
|
- logx.Info("countSql", countSql)
|
|
|
- findSql = fmt.Sprintf("select a.id,a.date,a.infoid,a.isvisit,REPLACE(a.matchkeys,'+',' ') as matchkeys,a.type,a.attachment_count from %s a where %s order by a.date desc,a.id desc", aboutDbMsg[s.ModuleFlag].MysqlTable, fmt.Sprintf("a.id in ('%s')", strings.Join(spqp.SelectInfoIds, "','")))
|
|
|
- //查询总数
|
|
|
- count = spqp.BaseServiceMysql.CountBySql(countSql)
|
|
|
+ var (
|
|
|
+ selectInfoIds []string
|
|
|
+ )
|
|
|
+ for _, sId := range spqp.SelectInfoIds {
|
|
|
+ selectInfoIds = append(selectInfoIds, sId)
|
|
|
+ if len(selectInfoIds) == 50 {
|
|
|
+ findSelectSql := fmt.Sprintf("select a.id,a.date,a.infoid,a.isvisit,REPLACE(a.matchkeys,'+',' ') as matchkeys,a.type,a.attachment_count from %s a where %s order by a.date desc,a.id desc", aboutDbMsg[s.ModuleFlag].MysqlTable, fmt.Sprintf("a.id in ('%s')", strings.Join(selectInfoIds, "','")))
|
|
|
+ logx.Info(spqp.NewUserId, "subscribePush info ids query sql:", findSelectSql)
|
|
|
+ list = append(list, *spqp.BaseServiceMysql.SelectBySql(findSelectSql)...)
|
|
|
+ selectInfoIds = []string{}
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if len(selectInfoIds) > 0 {
|
|
|
+ findSelectSql := fmt.Sprintf("select a.id,a.date,a.infoid,a.isvisit,REPLACE(a.matchkeys,'+',' ') as matchkeys,a.type,a.attachment_count from %s a where %s order by a.date desc,a.id desc", aboutDbMsg[s.ModuleFlag].MysqlTable, fmt.Sprintf("a.id in ('%s')", strings.Join(selectInfoIds, "','")))
|
|
|
+ logx.Info(spqp.NewUserId, "subscribePush info ids query sql:", findSelectSql)
|
|
|
+ list = append(list, *spqp.BaseServiceMysql.SelectBySql(findSelectSql)...)
|
|
|
+ selectInfoIds = []string{}
|
|
|
+ }
|
|
|
+ //countSql = fmt.Sprintf("select count(1) as count from %s a where %s", aboutDbMsg[s.ModuleFlag].MysqlTable, fmt.Sprintf("a.id in ('%s')", strings.Join(spqp.SelectInfoIds, "','")))
|
|
|
+ //logx.Info("countSql", countSql)
|
|
|
+ //findSql = fmt.Sprintf("select a.id,a.date,a.infoid,a.isvisit,REPLACE(a.matchkeys,'+',' ') as matchkeys,a.type,a.attachment_count from %s a where %s order by a.date desc,a.id desc", aboutDbMsg[s.ModuleFlag].MysqlTable, fmt.Sprintf("a.id in ('%s')", strings.Join(spqp.SelectInfoIds, "','")))
|
|
|
+ ////查询总数
|
|
|
+ //count = spqp.BaseServiceMysql.CountBySql(countSql)
|
|
|
} else {
|
|
|
//公共查询条件
|
|
|
//时间
|
|
@@ -670,16 +689,16 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
|
|
|
count = spqp.BaseServiceMysql.CountBySql(countSql)
|
|
|
}
|
|
|
log.Println("数据总数查询", count)
|
|
|
+ if isLimit {
|
|
|
+ findSql += fmt.Sprintf(" limit %d,%d", (spqp.PageNum-1)*size, size)
|
|
|
+ }
|
|
|
+ list = *spqp.BaseServiceMysql.SelectBySql(findSql)
|
|
|
+ logx.Info(spqp.NewUserId, "subscribePush query sql:", findSql)
|
|
|
}
|
|
|
- if isLimit {
|
|
|
- findSql += fmt.Sprintf(" limit %d,%d", (spqp.PageNum-1)*size, size)
|
|
|
- }
|
|
|
- logx.Info(spqp.NewUserId, "subscribePush query sql:", findSql)
|
|
|
- list := spqp.BaseServiceMysql.SelectBySql(findSql)
|
|
|
end1 := time.Now().Unix()
|
|
|
log.Println("mysql查询用时:", end1-start)
|
|
|
- if list != nil && len(*list) > 0 {
|
|
|
- pushCas := s.GetJyPushs(*list)
|
|
|
+ if list != nil && len(list) > 0 {
|
|
|
+ pushCas := s.GetJyPushs(list)
|
|
|
if !spqp.Export {
|
|
|
result = s.GetInfoByIds(spqp.Mgo_bidding, spqp.Bidding, spqp.Bidding_back, pushCas, spqp.IsPayUser)
|
|
|
} else {
|