diff --git a/go.mod b/go.mod index bbb6a8a5..565191ed 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ go 1.17 //replace github.com/ArtisanCloud/PowerSocialite/v3 => ../PowerSocialite require ( - github.com/ArtisanCloud/PowerLibs/v3 v3.0.18 + github.com/ArtisanCloud/PowerLibs/v3 v3.1.0 github.com/ArtisanCloud/PowerSocialite/v3 v3.0.7 github.com/go-playground/assert/v2 v2.0.1 github.com/redis/go-redis/v9 v9.0.3 diff --git a/go.sum b/go.sum index cb5d9b86..033417cf 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,6 @@ github.com/ArtisanCloud/PowerLibs/v3 v3.0.3/go.mod h1:6/cNm8Dv8wdogyB5yPZGTm9KhaXIifiOw8a2IuD07hw= -github.com/ArtisanCloud/PowerLibs/v3 v3.0.18 h1:JFTJkK42lmNUyeeK9fajsWmd0VZ3k2AsdcwazDOg/UA= -github.com/ArtisanCloud/PowerLibs/v3 v3.0.18/go.mod h1:nuUJGlLNKhBmo5nLBqJOuKD2+oDoJkWaqzxxhkLPo5s= +github.com/ArtisanCloud/PowerLibs/v3 v3.1.0 h1:lvKnj+bVtgQJ+eu9LsuOHkV6owRkY6fM+67aLyM22Kk= +github.com/ArtisanCloud/PowerLibs/v3 v3.1.0/go.mod h1:nuUJGlLNKhBmo5nLBqJOuKD2+oDoJkWaqzxxhkLPo5s= github.com/ArtisanCloud/PowerSocialite/v3 v3.0.7 h1:P+erNlErr+X2v7Et+yTWaTfIRhw+HfpAPdvNIEwk9Gw= github.com/ArtisanCloud/PowerSocialite/v3 v3.0.7/go.mod h1:VZQNCvcK/rldF3QaExiSl1gJEAkyc5/I8RLOd3WFZq4= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= diff --git a/main.go b/main.go index e3f491e5..7d4e1dfe 100644 --- a/main.go +++ b/main.go @@ -27,8 +27,8 @@ func GetOfficialConfig() *officialAccount.UserConfig { File: "./wechat/info.log", Error: "./wechat/error.log", }, - Cache: kernel.NewRedisClient(&kernel.RedisOptions{ - Addr: "127.0.0.1:6379", + Cache: kernel.NewRedisClient(&kernel.UniversalOptions{ + Addrs: []string{"127.0.0.1:6379"}, Password: "", //Username: "username", DB: 1, @@ -60,8 +60,8 @@ func GetWorkConfig() *work.UserConfig { Callback: os.Getenv("app_oauth_callback_url"), Scopes: []string{}, }, - Cache: kernel.NewRedisClient(&kernel.RedisOptions{ - Addr: "127.0.0.1:6379", + Cache: kernel.NewRedisClient(&kernel.UniversalOptions{ + Addrs: []string{"127.0.0.1:6379"}, Password: "", DB: 1, }), @@ -101,8 +101,8 @@ func GetPaymentConfig() *payment.UserConfig { BaseURI: "https://api.mch.weixin.qq.com", }, - Cache: kernel.NewRedisClient(&kernel.RedisOptions{ - Addr: "127.0.0.1:6379", + Cache: kernel.NewRedisClient(&kernel.UniversalOptions{ + Addrs: []string{"127.0.0.1:6379"}, Password: "", DB: 1, }), @@ -130,8 +130,8 @@ func GetMiniProgramConfig() *miniProgram.UserConfig { File: "./wechat/info.log", Error: "./wechat/error.log", }, - Cache: kernel.NewRedisClient(&kernel.RedisOptions{ - Addr: "127.0.0.1:6379", + Cache: kernel.NewRedisClient(&kernel.UniversalOptions{ + Addrs: []string{"127.0.0.1:6379"}, Password: "", DB: 1, }), @@ -155,8 +155,8 @@ func GetOpenPlatformConfig() *openPlatform.UserConfig { File: "./wechat/info.log", Error: "./wechat/error.log", }, - Cache: kernel.NewRedisClient(&kernel.RedisOptions{ - Addr: "127.0.0.1:6379", + Cache: kernel.NewRedisClient(&kernel.UniversalOptions{ + Addrs: []string{"127.0.0.1:6379"}, Password: "", DB: 1, }), diff --git a/src/kernel/interactWithCache.go b/src/kernel/interactWithCache.go index 9d78c3c9..8984803b 100644 --- a/src/kernel/interactWithCache.go +++ b/src/kernel/interactWithCache.go @@ -1,9 +1,10 @@ package kernel import ( + "time" + "github.com/ArtisanCloud/PowerLibs/v3/cache" "github.com/redis/go-redis/v9" - "time" ) type InteractsWithCache struct { @@ -11,18 +12,18 @@ type InteractsWithCache struct { } type CacheInterface cache.CacheInterface -type RedisOptions redis.Options +type UniversalOptions redis.UniversalOptions -func NewRedisClient(options *RedisOptions) CacheInterface { +func NewRedisClient(options *UniversalOptions) CacheInterface { if options == nil { return nil } - if options.Addr == "" { + if len(options.Addrs) == 0 { return nil } - return cache.NewGRedis((*redis.Options)(options)) + return cache.NewGRedis((*redis.UniversalOptions)(options)) } func NewInteractsWithCache(client CacheInterface) *InteractsWithCache { diff --git a/src/payment/profitSharing/client.go b/src/payment/profitSharing/client.go index 21b718dd..993c02f0 100644 --- a/src/payment/profitSharing/client.go +++ b/src/payment/profitSharing/client.go @@ -143,7 +143,9 @@ func (comp *Client) AddReceiver( result := &response.ResponseProfitSharingAddReceiver{} + config := (*comp.App).GetConfig() options := &object.HashMap{ + "appid": config.GetString("app_id", ""), "type": receiverType, "account": account, "name": name,