WH01243 2 жил өмнө
parent
commit
c02357b027

+ 4 - 5
jyBXSubscribe/rpc/model/push.go

@@ -305,6 +305,7 @@ 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) {
 	querys := []string{}
 	userStr := " "
+	leftJoinStr := " "
 	var (
 		searchSql, findSql string
 	)
@@ -419,10 +420,8 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
 				}
 
 			}
-			if len(find_in_set) == 1 {
-				find_in_set = append(find_in_set, "9999")
-			}
 			if len(find_in_set) > 0 {
+				leftJoinStr = fmt.Sprintf(" INNER JOIN %s t on t.infoid = b.infoid and t.labelcode=2 ", BidTags)
 				querys = append(querys, fmt.Sprintf(" t.labelvalues in (%s)", strings.Join(find_in_set, ",")))
 			}
 		}
@@ -459,8 +458,8 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
 				querys = append(querys, fmt.Sprintf("b.isvalidfile =0 "))
 			}
 		}
-		searchSql = fmt.Sprintf(" from %s  a INNER JOIN %s b ON %s and a.infoid = b.infoid   INNER JOIN %s t on t.infoid = b.infoid and t.labelcode=2  where %s"+
-			" order by a.id desc", aboutDbMsg[s.ModuleFlag].MysqlTable, Baseinfo, userStr, BidTags, strings.Join(querys, " and "))
+		searchSql = fmt.Sprintf(" from %s  a INNER JOIN %s b ON %s and a.infoid = b.infoid  %s where %s"+
+			" order by a.id desc", aboutDbMsg[s.ModuleFlag].MysqlTable, Baseinfo, userStr, leftJoinStr, strings.Join(querys, " and "))
 		logx.Info("searchSql", searchSql)
 		//查询总数
 		logx.Info(fmt.Sprintf("select count(a.id) " + searchSql))