Bläddra i källkod

wip:消息分发接口自测提交

wangkaiyue 2 år sedan
förälder
incheckning
a129d967bd
1 ändrade filer med 8 tillägg och 8 borttagningar
  1. 8 8
      jyBXSubscribe/rpc/model/push.go

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

@@ -562,27 +562,27 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
 			if spqp.BuySubject == 1 {
 				//企业主体是企业的个人查询
 				if spqp.UserType == SubVipFlag {
-					userStr = fmt.Sprintf("  a.userid='%s' and (  a.product=1 or a.source>1     ) ", common.If(s.ModuleFlag == EntnicheFlag, spqp.EntUserId, common.InterfaceToStr(spqp.NewUserId)))
+					userStr += fmt.Sprintf(" and  a.userid='%s' and (  a.product=1 or a.source>1     ) ", common.If(s.ModuleFlag == EntnicheFlag, spqp.EntUserId, common.InterfaceToStr(spqp.NewUserId)))
 				} else if spqp.UserType == MemberFlag {
-					userStr = fmt.Sprintf("  a.userid='%s' and (  a.product=2  or a.source>1  ) ", common.If(s.ModuleFlag == EntnicheFlag, spqp.EntUserId, common.InterfaceToStr(spqp.NewUserId)))
+					userStr += fmt.Sprintf(" and  a.userid='%s' and (  a.product=2  or a.source>1  ) ", common.If(s.ModuleFlag == EntnicheFlag, spqp.EntUserId, common.InterfaceToStr(spqp.NewUserId)))
 				} else {
-					userStr = fmt.Sprintf("  a.userid='%s' and (  a.product is null  or a.source>1  ) ", common.If(s.ModuleFlag == EntnicheFlag, spqp.EntUserId, common.InterfaceToStr(spqp.NewUserId)))
+					userStr += fmt.Sprintf(" and  a.userid='%s' and (  a.product is null  or a.source>1  ) ", common.If(s.ModuleFlag == EntnicheFlag, spqp.EntUserId, common.InterfaceToStr(spqp.NewUserId)))
 				}
 			} else {
 				if s.ModuleFlag == EntnicheFlag {
 					//老商机管理个人订阅查询
-					userStr = fmt.Sprintf("  a.userid='%s'  and a.product is null", common.If(s.ModuleFlag == EntnicheFlag, spqp.EntUserId, common.InterfaceToStr(spqp.NewUserId)))
+					userStr += fmt.Sprintf(" and  a.userid='%s'  and a.product is null", common.If(s.ModuleFlag == EntnicheFlag, spqp.EntUserId, common.InterfaceToStr(spqp.NewUserId)))
 				} else {
 					//个人订阅查询
-					userStr = fmt.Sprintf("  a.userid='%s'", common.If(s.ModuleFlag == EntnicheFlag, spqp.EntUserId, common.InterfaceToStr(spqp.NewUserId)))
+					userStr += fmt.Sprintf(" and  a.userid='%s'", common.If(s.ModuleFlag == EntnicheFlag, spqp.EntUserId, common.InterfaceToStr(spqp.NewUserId)))
 				}
 			}
 
 			//查询数量
 			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 %s  a STRAIGHT_JOIN %s b ON a.infoid = b.infoid  %s where 1=1 %s and %s", aboutDbMsg[s.ModuleFlag].MysqlTable, Baseinfo, leftJoinStr, userStr, 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 %s  a where 1=1 %s", aboutDbMsg[s.ModuleFlag].MysqlTable, userStr)
 			}
 			//列表查询语句
 			findSql = "select a.id,a.date,a.infoid,a.isvisit,a.matchkeys,a.type,b.isvalidfile as attachment_count"
@@ -592,7 +592,7 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
 			if s.ModuleFlag != MemberFlag && s.ModuleFlag != EntnicheFlag {
 				findSql += ",a.isvip"
 			}
-			findSql = fmt.Sprintf("%s from %s  a STRAIGHT_JOIN %s b ON %s and a.infoid = b.infoid  %s where %s"+
+			findSql = fmt.Sprintf("%s from %s  a STRAIGHT_JOIN %s b ON 1=1 %s and a.infoid = b.infoid  %s where %s"+
 				" order by a.date desc,a.id desc", findSql, aboutDbMsg[s.ModuleFlag].MysqlTable, Baseinfo, userStr, leftJoinStr, strings.Join(querys, " and "))
 		}
 		//查询总数