|
@@ -550,13 +550,13 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
|
|
|
//查询数量(需要去重)
|
|
|
if len(querys) > 1 {
|
|
|
//countSql = fmt.Sprintf("select count(1) as count from %s a STRAIGHT_JOIN %s b ON %s and a.infoid = b.infoid %s where %s", aboutDbMsg[s.ModuleFlag].MysqlTable, Baseinfo, userStr, leftJoinStr, strings.Join(querys, " and "))
|
|
|
- countSql = fmt.Sprintf("SELECT count(1) AS count FROM (SELECT DISTINCT matchkeys,infoid FROM %s a WHERE 1=1 %s ) a STRAIGHT_JOIN %s b ON a.infoid = b.infoid %s where %s", aboutDbMsg[s.ModuleFlag].MysqlTable, userStr, Baseinfo, leftJoinStr, strings.Join(querys, " and "))
|
|
|
+ countSql = fmt.Sprintf("SELECT count(1) AS count FROM (SELECT DISTINCT matchkeys,infoid FROM %s a WHERE source=2 %s ) a STRAIGHT_JOIN %s b ON a.infoid = b.infoid %s where %s", aboutDbMsg[s.ModuleFlag].MysqlTable, userStr, Baseinfo, leftJoinStr, strings.Join(querys, " and "))
|
|
|
} else {
|
|
|
//countSql = fmt.Sprintf("select count(1) as count from %s a where %s", aboutDbMsg[s.ModuleFlag].MysqlTable, userStr)
|
|
|
- countSql = fmt.Sprintf("SELECT count(1) AS count FROM ( SELECT DISTINCT matchkeys,infoid FROM %s a WHERE 1=1 %s ) AS data", aboutDbMsg[s.ModuleFlag].MysqlTable, userStr)
|
|
|
+ countSql = fmt.Sprintf("SELECT count(1) AS count FROM ( SELECT DISTINCT matchkeys,infoid FROM %s a WHERE source=2 %s ) AS data", aboutDbMsg[s.ModuleFlag].MysqlTable, userStr)
|
|
|
}
|
|
|
//列表查询
|
|
|
- findSql = fmt.Sprintf("select a.infoid,a.matchkeys,b.isvalidfile as attachment_count from (SELECT DISTINCT matchkeys,infoid FROM %s a WHERE 1=1 %s ) a STRAIGHT_JOIN %s b ON a.infoid = b.infoid %s where %s"+
|
|
|
+ findSql = fmt.Sprintf("select a.infoid,a.matchkeys,b.isvalidfile as attachment_count from (SELECT DISTINCT matchkeys,infoid FROM %s a WHERE source=2 %s ) a STRAIGHT_JOIN %s b ON a.infoid = b.infoid %s where %s"+
|
|
|
" order by b.publishtime desc", aboutDbMsg[s.ModuleFlag].MysqlTable, userStr, Baseinfo, leftJoinStr, strings.Join(querys, " and "))
|
|
|
} else {
|
|
|
if spqp.BuySubject == 1 {
|