浏览代码

新增判断

WH01243 2 年之前
父节点
当前提交
779a2f8874
共有 1 个文件被更改,包括 9 次插入5 次删除
  1. 9 5
      jyBXSubscribe/rpc/model/push.go

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

@@ -496,15 +496,19 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
 		//关键词
 		find_in_set := []string{}
 		if spqp.PositionType == 0 {
-			for _, v := range strings.Split(spqp.Key, ",") {
-				find_in_set = append(find_in_set, fmt.Sprintf("find_in_set('%s',replace(replace(a.matchkeys,'+',','),' ',','))", v))
+			if spqp.Key != "" {
+				for _, v := range strings.Split(spqp.Key, ",") {
+					find_in_set = append(find_in_set, fmt.Sprintf("find_in_set('%s',replace(replace(a.matchkeys,'+',','),' ',','))", v))
+				}
 			}
-			for _, v := range strings.Split(spqp.Item, ",") {
-				find_in_set = append(find_in_set, fmt.Sprintf("find_in_set('%s',replace(replace(a.matchitems,'+',','),' ',','))", v))
+			if spqp.Item != "" {
+				for _, v := range strings.Split(spqp.Item, ",") {
+					find_in_set = append(find_in_set, fmt.Sprintf("find_in_set('%s',replace(replace(a.matchitems,'+',','),' ',','))", v))
+				}
 			}
 		} else {
+			find_in_set := []string{}
 			if spqp.Key != "" {
-				find_in_set := []string{}
 				for _, v := range strings.Split(spqp.Key, ",") {
 					find_in_set = append(find_in_set, fmt.Sprintf("find_in_set('%s',replace(replace(a.matchkeys,'+',','),' ',','))", v))
 				}