WH01243 2 роки тому
батько
коміт
bce69740d1
1 змінених файлів з 49 додано та 38 видалено
  1. 49 38
      jyBXSubscribe/rpc/model/push.go

+ 49 - 38
jyBXSubscribe/rpc/model/push.go

@@ -838,47 +838,58 @@ func (s *subscribePush) listManager(spqp *SubPushQueryParam, list []map[string]i
 				wg.Done()
 				<-wc
 			}()
-			/*redisKey := fmt.Sprintf("pushinfo_%s_%s", spqp.UserId, common.ObjToString(v["_id"]))
+			//redis.Put("pushcache_2_a", redisKey, 1, 86400)
 			title := strings.Replace(common.ObjToString(v["title"]), "\n", "", -1)
-			var pushInsert = []interface{}{}
 			infoid := common.InterfaceToStr(v["_id"])
-			log.Println("infoid", infoid)
-			spqp.BaseServiceMysql.ExecTx("推送记录保存", func(tx *sql.Tx) bool {
-				//推送记录
-				matchkeys := getKeys(title, keyword)
-				matchkey := strings.Join(matchkeys, " ")
-				entid := spqp.EntId
-				entUserId := spqp.EntUserId
-				deptid := spqp.DeptId
-				id := int64(0)
-				switch s.ModuleFlag {
-				case "eType":
-					pushInsert = append(pushInsert, entid, deptid, entUserId, common.InterfaceToStr(infoid), matchkey, now)
-					id, _ = spqp.BaseServiceMysql.InsertIgnoreBatch(aboutDbMsg[s.ModuleFlag].MysqlTable, ennicheInsertCollKey, pushInsert)
-				case "mType":
-					pushInsert = append(pushInsert, common.InterfaceToStr(spqp.NewUserId), common.InterfaceToStr(infoid), matchkey, now)
-					id, _ = spqp.BaseServiceMysql.InsertIgnoreBatch(aboutDbMsg[s.ModuleFlag].MysqlTable, memberInsertCollKey, pushInsert)
-				case "vType":
-					pushInsert = append(pushInsert, common.InterfaceToStr(spqp.NewUserId), common.InterfaceToStr(infoid), matchkey, now, 1)
-					id, _ = spqp.BaseServiceMysql.InsertIgnoreBatch(aboutDbMsg[s.ModuleFlag].MysqlTable, subscribeInsertCollKey, pushInsert)
-				case "fType":
-					pushInsert = append(pushInsert, common.InterfaceToStr(spqp.NewUserId), common.InterfaceToStr(infoid), matchkey, now, 0)
-					id, _ = spqp.BaseServiceMysql.InsertIgnoreBatch(aboutDbMsg[s.ModuleFlag].MysqlTable, subscribeInsertCollKey, pushInsert)
+			matchkeys := getKeys(title, keyword)
+			resultList = append(resultList, s.InfoFormat(&PushCa{
+				InfoId:     infoid,
+				Date:       time.Now().Unix(),
+				Index:      1,
+				Keys:       matchkeys,
+				FileExists: v["filetext"] != nil,
+			}, &v))
+			/*redisKey := fmt.Sprintf("pushinfo_%s_%s", spqp.UserId, common.ObjToString(v["_id"]))
+			  title := strings.Replace(common.ObjToString(v["title"]), "\n", "", -1)
+			  var pushInsert = []interface{}{}
+			  infoid := common.InterfaceToStr(v["_id"])
+			  log.Println("infoid", infoid)
+			  spqp.BaseServiceMysql.ExecTx("推送记录保存", func(tx *sql.Tx) bool {
+			  	//推送记录
+			  	matchkeys := getKeys(title, keyword)
+			  	matchkey := strings.Join(matchkeys, " ")
+			  	entid := spqp.EntId
+			  	entUserId := spqp.EntUserId
+			  	deptid := spqp.DeptId
+			  	id := int64(0)
+			  	switch s.ModuleFlag {
+			  	case "eType":
+			  		pushInsert = append(pushInsert, entid, deptid, entUserId, common.InterfaceToStr(infoid), matchkey, now)
+			  		id, _ = spqp.BaseServiceMysql.InsertIgnoreBatch(aboutDbMsg[s.ModuleFlag].MysqlTable, ennicheInsertCollKey, pushInsert)
+			  	case "mType":
+			  		pushInsert = append(pushInsert, common.InterfaceToStr(spqp.NewUserId), common.InterfaceToStr(infoid), matchkey, now)
+			  		id, _ = spqp.BaseServiceMysql.InsertIgnoreBatch(aboutDbMsg[s.ModuleFlag].MysqlTable, memberInsertCollKey, pushInsert)
+			  	case "vType":
+			  		pushInsert = append(pushInsert, common.InterfaceToStr(spqp.NewUserId), common.InterfaceToStr(infoid), matchkey, now, 1)
+			  		id, _ = spqp.BaseServiceMysql.InsertIgnoreBatch(aboutDbMsg[s.ModuleFlag].MysqlTable, subscribeInsertCollKey, pushInsert)
+			  	case "fType":
+			  		pushInsert = append(pushInsert, common.InterfaceToStr(spqp.NewUserId), common.InterfaceToStr(infoid), matchkey, now, 0)
+			  		id, _ = spqp.BaseServiceMysql.InsertIgnoreBatch(aboutDbMsg[s.ModuleFlag].MysqlTable, subscribeInsertCollKey, pushInsert)
 
-				}
-				if id > 0 {
-					redis.Put("pushcache_2_a", redisKey, 1, 86400)
-					resultList = append(resultList, s.InfoFormat(&PushCa{
-						InfoId:     infoid,
-						Date:       time.Now().Unix(),
-						Index:      id,
-						Keys:       matchkeys,
-						FileExists: v["filetext"] != nil,
-					}, &v))
-					return true
-				}
-				return false
-			})*/
+			  	}
+			  	if id > 0 {
+			  		redis.Put("pushcache_2_a", redisKey, 1, 86400)
+			  		resultList = append(resultList, s.InfoFormat(&PushCa{
+			  			InfoId:     infoid,
+			  			Date:       time.Now().Unix(),
+			  			Index:      id,
+			  			Keys:       matchkeys,
+			  			FileExists: v["filetext"] != nil,
+			  		}, &v))
+			  		return true
+			  	}
+			  	return false
+			  })*/
 		}(v)
 	}
 	wg.Wait()