Skip to content

Commit

Permalink
Merge pull request #438 from ArtisanCloud/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Matrix-X committed Jan 29, 2024
2 parents 270b808 + 47812da commit 2277eed
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 18 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -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=
Expand Down
20 changes: 10 additions & 10 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
}),
Expand Down Expand Up @@ -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,
}),
Expand Down Expand Up @@ -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,
}),
Expand All @@ -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,
}),
Expand Down
11 changes: 6 additions & 5 deletions src/kernel/interactWithCache.go
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
package kernel

import (
"time"

"github.com/ArtisanCloud/PowerLibs/v3/cache"
"github.com/redis/go-redis/v9"
"time"
)

type InteractsWithCache struct {
Cache CacheInterface
}

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 {
Expand Down
2 changes: 2 additions & 0 deletions src/payment/profitSharing/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 2277eed

Please sign in to comment.