From 75deac51339d30044be05edcc0195f5d6be8b37c Mon Sep 17 00:00:00 2001 From: shenjiachi Date: Wed, 18 Dec 2024 13:46:44 +0800 Subject: [PATCH] update --- .../friend_circle/hdl_friend_circle._test.go | 57 +++++++++++++++++++ app/hdl/hdl_home_page.go | 3 +- 2 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 app/hdl/friend_circle/hdl_friend_circle._test.go diff --git a/app/hdl/friend_circle/hdl_friend_circle._test.go b/app/hdl/friend_circle/hdl_friend_circle._test.go new file mode 100644 index 0000000..a05d907 --- /dev/null +++ b/app/hdl/friend_circle/hdl_friend_circle._test.go @@ -0,0 +1,57 @@ +package friend_circle + +import ( + "code.fnuoos.com/EggPlanet/egg_system_rules.git/md" + "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") + err := es.CreateIndexIfNotExists(md.EggFriendCircleEsIndex, md.EggFriendCircleEsMapping) + if err != nil { + fmt.Println(err) + } + 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 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 TestDeleteIndex(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") +} diff --git a/app/hdl/hdl_home_page.go b/app/hdl/hdl_home_page.go index 0a14841..d7c991f 100644 --- a/app/hdl/hdl_home_page.go +++ b/app/hdl/hdl_home_page.go @@ -109,11 +109,10 @@ func HomePage(c *gin.Context) { e.OutErr(c, e.ERR_DB_ORM, nil) return } - signEggEnergyValue, _ := decimal.NewFromString(signPersonalEggEnergy) personEggEnergyValue, _ := decimal.NewFromString(personEggEnergy.Amount) teamEggEnergyValue, _ := decimal.NewFromString(teamEggEnergy.Amount) - totalEggEnergy, _ = signEggEnergyValue.Add(personEggEnergyValue).Add(teamEggEnergyValue).Float64() + totalEggEnergy, _ = personEggEnergyValue.Add(teamEggEnergyValue).Float64() //4、活跃积分(个人+团队) var totalActivePoints float64