123456789101112131415161718192021222324252627 |
- package wechat
- import (
- "fmt"
- mini "github.com/ArtisanCloud/PowerWeChat/v2/src/miniProgram"
- )
- // NewClient 获取操作小程序的实例
- func NewClient(AppId, Secret string) (*mini.MiniProgram, error) {
- client, err := mini.NewMiniProgram(&mini.UserConfig{
- AppID: AppId,
- Secret: Secret,
- HttpDebug: true,
- Debug: false,
- // 可选,不传默认走程序内存
- //Cache: kernel.NewRedisClient(&kernel.RedisOptions{
- // Addr: RedisAddr,
- // Password: "",
- // DB: 0,
- //}),
- })
- if err != nil {
- fmt.Printf("init wechat miniprogram failed")
- }
- return client, err
- }
|