scan the QR code to log in on the WeChat public account

This commit is contained in:
landaiqing
2024-08-15 23:56:46 +08:00
parent 55759a33db
commit e8fbff7e7f
28 changed files with 1095 additions and 432 deletions

33
core/wechat.go Normal file
View File

@@ -0,0 +1,33 @@
package core
import (
"github.com/ArtisanCloud/PowerWeChat/v3/src/kernel"
"github.com/ArtisanCloud/PowerWeChat/v3/src/officialAccount"
"os"
"schisandra-cloud-album/global"
)
func InitWechat() {
OfficialAccountApp, err := officialAccount.NewOfficialAccount(&officialAccount.UserConfig{
AppID: "wx55251c2f83b9fc25",
Secret: "d511800cd53d248afe1260bb8aeed230",
Token: "LDQ20020618xxx",
AESKey: global.CONFIG.Wechat.AESKey,
//Log: officialAccount.Log{
// Level: "debug",
// File: "./wechat.log",
//},
ResponseType: os.Getenv("response_type"),
HttpDebug: true,
Debug: true,
Cache: kernel.NewRedisClient(&kernel.UniversalOptions{
Addrs: []string{global.CONFIG.Redis.Addr()},
Password: global.CONFIG.Redis.Password,
DB: 0,
}),
})
if err != nil {
panic(err)
}
global.Wechat = OfficialAccountApp
}