|
- package friend_circle
-
- import (
- "code.fnuoos.com/EggPlanet/egg_system_rules.git/md"
- "code.fnuoos.com/EggPlanet/egg_system_rules.git/rule/egg_energy"
- "code.fnuoos.com/go_rely_warehouse/zyos_go_es.git/es"
- "fmt"
- "testing"
- )
-
- // 创建朋友圈索引
- func TestCreateFriendCircleIndex(t *testing.T) {
- es.Init("http://123.57.140.192:9200", "elastic", "fnuo123")
- index := md.EggFriendCircleEsIndex
- err := es.CreateIndexIfNotExists(index, md.EggFriendCircleEsMapping)
- if err != nil {
- fmt.Println(err)
- }
- fmt.Println("success")
- }
-
- // 删除朋友圈索引
- func TestDeleteFriendCircleIndex(t *testing.T) {
- es.Init("http://123.57.140.192:9200", "elastic", "fnuo123")
-
- _, err := es.DeleteIndex(md.EggFriendCircleEsIndex)
- if err != nil {
- fmt.Println(err)
- return
- }
-
- fmt.Println("success")
- }
-
- // 创建朋友圈点赞索引
- func TestCreateFriendCircleCommentLikeIndex(t *testing.T) {
- es.Init("http://123.57.140.192:9200", "elastic", "fnuo123")
- for i := 0; i < 10; i++ {
- index := fmt.Sprintf("%s%d", md.EggFriendCircleLikeEsIndex, i)
- err := es.CreateIndexIfNotExists(index, md.EggFriendCircleLikeEsMapping)
- if err != nil {
- fmt.Println(err)
- }
- }
-
- fmt.Println("success")
- }
-
- // 删除朋友圈点赞索引
- func TestDeleteFriendCircleCommentLikeIndex(t *testing.T) {
- es.Init("http://123.57.140.192:9200", "elastic", "fnuo123")
- for i := 0; i < 10; i++ {
- index := fmt.Sprintf("%s%d", md.EggFriendCircleLikeEsIndex, i)
- _, err := es.DeleteIndex(index)
- if err != nil {
- fmt.Println(err)
- return
- }
- }
-
- fmt.Println("success")
- }
-
- // 创建朋友圈评论索引
- func TestCreateFriendCircleCommentIndex(t *testing.T) {
- es.Init("http://123.57.140.192:9200", "elastic", "fnuo123")
- for i := 0; i < 10; i++ {
- index := fmt.Sprintf("%s%d", md.EggFriendCircleCommentEsIndex, i)
- err := es.CreateIndexIfNotExists(index, md.EggFriendCircleCommentEsMapping)
- if err != nil {
- fmt.Println(err)
- }
- }
-
- fmt.Println("success")
- }
-
- // 删除朋友圈评论索引
- func TestDeleteFriendCircleCommentIndex(t *testing.T) {
- es.Init("http://123.57.140.192:9200", "elastic", "fnuo123")
- for i := 0; i < 10; i++ {
- index := fmt.Sprintf("%s%d", md.EggFriendCircleCommentEsIndex, i)
- _, err := es.DeleteIndex(index)
- if err != nil {
- fmt.Println(err)
- return
- }
- }
- fmt.Println("success")
- }
-
- // 删除蛋蛋分记录
- func TestDeleteEggScoreIndex(t *testing.T) {
- es.Init("http://120.55.48.175:9200", "elastic", "fnuo123")
- index := fmt.Sprintf("%s_%d", md.EggEnergyUserEggScoreEsAlias, 202451)
- _, err := es.DeleteIndex(index)
- if err != nil {
- fmt.Println(err)
- return
- }
- fmt.Println("success")
- }
-
- // 创建临时蛋蛋分记录
- func TestCreateTempEggScoreIndex(t *testing.T) {
- es.Init("http://123.57.140.192:9200/", "elastic", "fnuo123")
- index := fmt.Sprintf("%s_%d", md.EggEnergyUserEggScoreEsAlias, 202451)
- err := es.CreateIndexIfNotExists(index, md.EggEnergyUserEggScoreEsMapping)
- if err != nil {
- fmt.Println(err)
- }
-
- for i := 1; i < 41; i++ {
- egg_energy.ExistOrDefaultUserEggScore(int64(i))
- }
-
- fmt.Println("success")
- }
-
- // 创建蛋蛋分记录
- func TestCreateEggScoreIndex(t *testing.T) {
- es.Init("http://123.57.140.192:9200/", "elastic", "fnuo123")
- index := fmt.Sprintf("%s_%d", md.EggEnergyUserEggScoreEsAlias, 202451)
- err := es.CreateIndexIfNotExists(index, md.EggEnergyUserEggScoreEsMapping)
- if err != nil {
- fmt.Println(err)
- }
-
- fmt.Println("success")
- }
|