WH01243 před 2 roky
rodič
revize
5567e2628b
1 změnil soubory, kde provedl 4 přidání a 4 odebrání
  1. 4 4
      jyBXSubscribe/rpc/model/push.go

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

@@ -317,9 +317,9 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
 		findSql = "select a.id,a.date,a.infoid,a.isvisit,a.matchkeys,a.type,b.isvalidfile as attachment_count"
 	} else {
 		if spqp.IsEnt {
-			userStr = fmt.Sprintf("  a.entid='%s'", spqp.EntId)
+			userStr = fmt.Sprintf(" ( SELECT c.* FROM %s c where c.entid='%s' ORDER BY c.id DESC LIMIT %d,%d)", aboutDbMsg[s.ModuleFlag].MysqlTable, spqp.EntId, (spqp.PageNum-1)*size, size)
 		} else {
-			userStr = fmt.Sprintf("  a.userid='%s'", common.If(s.ModuleFlag == "eType", spqp.EntUserId, common.InterfaceToStr(spqp.NewUserId)))
+			userStr = fmt.Sprintf(" ( SELECT c.* FROM %s c where c.userid='%s' ORDER BY c.id DESC LIMIT %d,%d)", aboutDbMsg[s.ModuleFlag].MysqlTable, common.If(s.ModuleFlag == "eType", spqp.EntUserId, common.InterfaceToStr(spqp.NewUserId)), (spqp.PageNum-1)*size, size)
 		}
 		codeMap, err := IC.CodeLib.CodeTransformation(context.Background(), &codeservice.Request{})
 		if codeMap.Data == nil || err != nil {
@@ -459,8 +459,8 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
 				querys = append(querys, fmt.Sprintf("b.isvalidfile =0 "))
 			}
 		}
-		searchSql = fmt.Sprintf(" from %s  a LEFT JOIN %s b ON %s and 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, userStr, BidTags, strings.Join(querys, " and "))
+		searchSql = fmt.Sprintf(" from %s  a INNER JOIN %s b ON  a.infoid = b.infoid   INNER JOIN %s t on t.infoid = b.infoid and t.labelcode=2  where %s"+
+			" order by a.id desc", userStr, Baseinfo, BidTags, strings.Join(querys, " and "))
 		logx.Info("searchSql", searchSql)
 		//查询总数
 		logx.Info(fmt.Sprintf("select count(a.id) " + searchSql))