Skip to content

Commit 03bb1b4

Browse files
author
Matrix-X
committed
update(main): open openwork config
1 parent ad88194 commit 03bb1b4

File tree

1 file changed

+35
-2
lines changed

1 file changed

+35
-2
lines changed

main.go

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,18 @@ package main
33
import (
44
"context"
55
"fmt"
6-
fmt2 "github.com/ArtisanCloud/PowerLibs/v3/fmt"
76
"os"
87
"strconv"
98

9+
fmt2 "github.com/ArtisanCloud/PowerLibs/v3/fmt"
10+
1011
"github.com/ArtisanCloud/PowerWeChat/v3/src/kernel"
1112
"github.com/ArtisanCloud/PowerWeChat/v3/src/kernel/power"
1213
"github.com/ArtisanCloud/PowerWeChat/v3/src/miniProgram"
1314
"github.com/ArtisanCloud/PowerWeChat/v3/src/officialAccount"
1415
"github.com/ArtisanCloud/PowerWeChat/v3/src/officialAccount/templateMessage/request"
1516
"github.com/ArtisanCloud/PowerWeChat/v3/src/openPlatform"
17+
"github.com/ArtisanCloud/PowerWeChat/v3/src/openWork"
1618
"github.com/ArtisanCloud/PowerWeChat/v3/src/payment"
1719
"github.com/ArtisanCloud/PowerWeChat/v3/src/work"
1820
"go.opentelemetry.io/otel"
@@ -189,6 +191,28 @@ func GetOpenPlatformConfig() *openPlatform.UserConfig {
189191
}
190192
}
191193

194+
func GetOpenWorkConfig() *openWork.UserConfig {
195+
return &openWork.UserConfig{
196+
AppID: "123",
197+
Secret: "321",
198+
AuthCode: "123",
199+
AESKey: "321",
200+
ResponseType: os.Getenv("array"),
201+
202+
Cache: kernel.NewRedisClient(&kernel.UniversalOptions{
203+
Addrs: []string{"127.0.0.1:6379"},
204+
Password: "",
205+
DB: 1,
206+
}),
207+
208+
// OAuth: "",
209+
// HttpDebug: "",
210+
// Debug: "",
211+
// NotifyURL: "",
212+
// Sandbox: "",
213+
}
214+
}
215+
192216
func initTracer() {
193217
tp := trace.NewTracerProvider()
194218
// Set Global Tracer Provider
@@ -260,11 +284,20 @@ func main() {
260284
}
261285
fmt2.Dump("miniprogram config:", miniProgramApp.GetConfig().All())
262286

263-
// init miniProgram app
287+
// init openplatform app
264288
configOpenPlatform := GetOpenPlatformConfig()
265289
openPlatform, err := openPlatform.NewOpenPlatform(configOpenPlatform)
266290
if err != nil {
267291
fmt.Println(err.Error())
268292
}
269293
fmt2.Dump("openPlatform config:", openPlatform.GetConfig().All())
294+
295+
// init openwork app
296+
configOpenWork := GetOpenWorkConfig()
297+
openWork, err := openWork.NewOpenWork(configOpenWork)
298+
if err != nil {
299+
fmt.Println(err.Error())
300+
}
301+
fmt2.Dump("openPlatform config:", openWork.GetConfig().All())
302+
270303
}

0 commit comments

Comments
 (0)