|
@@ -313,8 +313,15 @@ func (s *subscribePush) Datas(spqp *SubPushQueryParam) (hasNextPage bool, total
|
|
|
|
|
|
func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, endtime int64, size int, isLimit bool) (result []*bxsubscribe.SubscribeInfo, count int64) {
|
|
func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, endtime int64, size int, isLimit bool) (result []*bxsubscribe.SubscribeInfo, count int64) {
|
|
querys := []string{}
|
|
querys := []string{}
|
|
- if len(spqp.SelectInfoIds) != 0 {
|
|
|
|
- querys = append(querys, fmt.Sprintf("a.id in ('%s')", strings.Join(spqp.SelectInfoIds, "','")))
|
|
|
|
|
|
+ var (
|
|
|
|
+ searchSql, findSql string
|
|
|
|
+ )
|
|
|
|
+ if spqp.SelectInfoIds != nil && len(spqp.SelectInfoIds) > 0 {
|
|
|
|
+ searchSql = fmt.Sprintf(" from %s a LEFT JOIN %s b ON a.infoid = b.infoid where %s order by a.id desc", aboutDbMsg[s.ModuleFlag].MysqlTable, Baseinfo, fmt.Sprintf("a.id in ('%s')", strings.Join(spqp.SelectInfoIds, "','")))
|
|
|
|
+ fmt.Println("searchSql", searchSql)
|
|
|
|
+ //查询总数
|
|
|
|
+ count = spqp.BaseServiceMysql.CountBySql(fmt.Sprintf("select count(a.id)" + searchSql))
|
|
|
|
+ findSql = "select a.id,a.date,a.infoid,a.isvisit,a.matchkeys,a.type,b.isvalidfile as attachment_count"
|
|
} else {
|
|
} else {
|
|
if spqp.IsEnt {
|
|
if spqp.IsEnt {
|
|
querys = []string{fmt.Sprintf("a.entid='%s'", spqp.EntId)}
|
|
querys = []string{fmt.Sprintf("a.entid='%s'", spqp.EntId)}
|
|
@@ -458,15 +465,14 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
|
|
querys = append(querys, fmt.Sprintf("b.isvalidfile =0 "))
|
|
querys = append(querys, fmt.Sprintf("b.isvalidfile =0 "))
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ searchSql = fmt.Sprintf(" from %s a LEFT JOIN %s b ON a.infoid = b.infoid LEFT JOIN %s t on t.infoid = b.infoid and t.labelcode=2 where %s"+
|
|
|
|
+ " order by a.id desc", aboutDbMsg[s.ModuleFlag].MysqlTable, Baseinfo, BidTags, strings.Join(querys, " and "))
|
|
|
|
+ fmt.Println("searchSql", searchSql)
|
|
|
|
+ //查询总数
|
|
|
|
+ count = spqp.BaseServiceMysql.CountBySql(fmt.Sprintf("select count(a.id)" + searchSql))
|
|
|
|
+ logx.Info("count:", count, "---", s.ModuleFlag)
|
|
|
|
+ findSql = "select a.id,a.date,a.infoid,a.isvisit,a.matchkeys,a.type,b.isvalidfile as attachment_count"
|
|
}
|
|
}
|
|
-
|
|
|
|
- searchSql := fmt.Sprintf(" from %s a LEFT JOIN %s b ON a.infoid = b.infoid LEFT JOIN %s t on t.infoid = b.infoid and t.labelcode=2 where %s"+
|
|
|
|
- " order by a.id desc", aboutDbMsg[s.ModuleFlag].MysqlTable, Baseinfo, BidTags, strings.Join(querys, " and "))
|
|
|
|
- fmt.Println("searchSql", searchSql)
|
|
|
|
- //查询总数
|
|
|
|
- count = spqp.BaseServiceMysql.CountBySql(fmt.Sprintf("select count(a.id)" + searchSql))
|
|
|
|
- logx.Info("count:", count, "---", s.ModuleFlag)
|
|
|
|
- findSql := "select a.id,a.date,a.infoid,a.isvisit,a.matchkeys,a.type,b.isvalidfile as attachment_count"
|
|
|
|
if s.ModuleFlag != MemberFlag && s.ModuleFlag != EntnicheFlag {
|
|
if s.ModuleFlag != MemberFlag && s.ModuleFlag != EntnicheFlag {
|
|
findSql += ",isvip"
|
|
findSql += ",isvip"
|
|
}
|
|
}
|
|
@@ -478,13 +484,26 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
|
|
list := spqp.BaseServiceMysql.SelectBySql(findSql)
|
|
list := spqp.BaseServiceMysql.SelectBySql(findSql)
|
|
if list != nil && len(*list) > 0 {
|
|
if list != nil && len(*list) > 0 {
|
|
pushCas := s.GetJyPushs(*list)
|
|
pushCas := s.GetJyPushs(*list)
|
|
- result = s.GetInfoByIds(spqp.Mgo_bidding, spqp.Bidding, spqp.Bidding_back, pushCas)
|
|
|
|
|
|
+ if !spqp.Export {
|
|
|
|
+ result = s.GetInfoByIds(spqp.Mgo_bidding, spqp.Bidding, spqp.Bidding_back, pushCas)
|
|
|
|
+ } else {
|
|
|
|
+ result = s.GetOnlyExportInfo(pushCas)
|
|
|
|
+ }
|
|
} else {
|
|
} else {
|
|
result = []*bxsubscribe.SubscribeInfo{}
|
|
result = []*bxsubscribe.SubscribeInfo{}
|
|
}
|
|
}
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+// GetOnlyInfoId 获取信息id
|
|
|
|
+func (s *subscribePush) GetOnlyExportInfo(pushCas []*PushCa) []*bxsubscribe.SubscribeInfo {
|
|
|
|
+ array := make([]*bxsubscribe.SubscribeInfo, len(pushCas))
|
|
|
|
+ for k, v := range pushCas {
|
|
|
|
+ array[k] = &bxsubscribe.SubscribeInfo{XId: encrypt.EncodeArticleId2ByCheck(v.InfoId), MatchKeys: v.Keys}
|
|
|
|
+ }
|
|
|
|
+ return array
|
|
|
|
+}
|
|
|
|
+
|
|
// 根据id取内容
|
|
// 根据id取内容
|
|
func (s *subscribePush) GetInfoByIds(Mgo_bidding mongodb.MongodbSim, bidding, bidding_back string, pushCas []*PushCa) []*bxsubscribe.SubscribeInfo {
|
|
func (s *subscribePush) GetInfoByIds(Mgo_bidding mongodb.MongodbSim, bidding, bidding_back string, pushCas []*PushCa) []*bxsubscribe.SubscribeInfo {
|
|
array := make([]*bxsubscribe.SubscribeInfo, len(pushCas))
|
|
array := make([]*bxsubscribe.SubscribeInfo, len(pushCas))
|