@@ -7,12 +7,14 @@ import (
7
7
"strconv"
8
8
9
9
fmt2 "github.com/ArtisanCloud/PowerLibs/v3/fmt"
10
+
10
11
"github.com/ArtisanCloud/PowerWeChat/v3/src/kernel"
11
12
"github.com/ArtisanCloud/PowerWeChat/v3/src/kernel/power"
12
13
"github.com/ArtisanCloud/PowerWeChat/v3/src/miniProgram"
13
14
"github.com/ArtisanCloud/PowerWeChat/v3/src/officialAccount"
14
15
"github.com/ArtisanCloud/PowerWeChat/v3/src/officialAccount/templateMessage/request"
15
16
"github.com/ArtisanCloud/PowerWeChat/v3/src/openPlatform"
17
+ "github.com/ArtisanCloud/PowerWeChat/v3/src/openWork"
16
18
"github.com/ArtisanCloud/PowerWeChat/v3/src/payment"
17
19
"github.com/ArtisanCloud/PowerWeChat/v3/src/work"
18
20
"go.opentelemetry.io/otel"
@@ -29,6 +31,8 @@ func GetOfficialConfig() *officialAccount.UserConfig {
29
31
Log : officialAccount.Log {
30
32
Level : "debug" ,
31
33
Stdout : false ,
34
+ File : "/Users/michaelhu/wechat/official-account/info.log" ,
35
+ Error : "/Users/michaelhu/wechat/official-account/error.log" ,
32
36
},
33
37
Http : officialAccount.Http {
34
38
ProxyURI : "" ,
@@ -40,7 +44,7 @@ func GetOfficialConfig() *officialAccount.UserConfig {
40
44
Password : "" ,
41
45
DB : 1 ,
42
46
}),
43
- HttpDebug : false ,
47
+ HttpDebug : true ,
44
48
Debug : false ,
45
49
}
46
50
}
@@ -55,8 +59,10 @@ func GetWorkConfig() *work.UserConfig {
55
59
ResponseType : os .Getenv ("array" ),
56
60
Log : work.Log {
57
61
Level : "debug" ,
58
- File : "./wechat/info.log" ,
59
- Error : "./wechat/error.log" ,
62
+ //File: "./wechat/info.log",
63
+ //Error: "./wechat/error.log",
64
+ File : "/Users/michaelhu/wechat/work/info.log" ,
65
+ Error : "/Users/michaelhu/wechat/work/error.log" ,
60
66
ENV : os .Getenv ("work.env" ),
61
67
},
62
68
@@ -101,8 +107,10 @@ func GetPaymentConfig() *payment.UserConfig {
101
107
ResponseType : os .Getenv ("array" ),
102
108
Log : payment.Log {
103
109
Level : "debug" ,
104
- File : "./wechat/info.log" ,
105
- Error : "./wechat/error.log" ,
110
+ //File: "./wechat/info.log",
111
+ //Error: "./wechat/error.log",
112
+ File : "/Users/michaelhu/wechat/payment/info.log" ,
113
+ Error : "/Users/michaelhu/wechat/payment/error.log" ,
106
114
},
107
115
Http : payment.Http {
108
116
Timeout : 30.0 ,
@@ -135,8 +143,8 @@ func GetMiniProgramConfig() *miniProgram.UserConfig {
135
143
ResponseType : os .Getenv ("array" ),
136
144
Log : miniProgram.Log {
137
145
Level : "debug" ,
138
- File : "./ wechat/info.log" ,
139
- Error : "./ wechat/error.log" ,
146
+ File : "/Users/michaelhu/ wechat/mini-program /info.log" ,
147
+ Error : "/Users/michaelhu/ wechat/mini-program /error.log" ,
140
148
},
141
149
Cache : kernel .NewRedisClient (& kernel.UniversalOptions {
142
150
Addrs : []string {"127.0.0.1:6379" },
@@ -162,8 +170,10 @@ func GetOpenPlatformConfig() *openPlatform.UserConfig {
162
170
ResponseType : os .Getenv ("array" ),
163
171
Log : openPlatform.Log {
164
172
Level : "debug" ,
165
- File : "./wechat/info.log" ,
166
- Error : "./wechat/error.log" ,
173
+ //File: "./wechat/info.log",
174
+ //Error: "./wechat/error.log",
175
+ File : "/Users/michaelhu/wechat/platform/info.log" ,
176
+ Error : "/Users/michaelhu/wechat/platform/error.log" ,
167
177
},
168
178
Cache : kernel .NewRedisClient (& kernel.UniversalOptions {
169
179
Addrs : []string {"127.0.0.1:6379" },
@@ -181,6 +191,28 @@ func GetOpenPlatformConfig() *openPlatform.UserConfig {
181
191
}
182
192
}
183
193
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
+
184
216
func initTracer () {
185
217
tp := trace .NewTracerProvider ()
186
218
// Set Global Tracer Provider
@@ -252,11 +284,20 @@ func main() {
252
284
}
253
285
fmt2 .Dump ("miniprogram config:" , miniProgramApp .GetConfig ().All ())
254
286
255
- // init miniProgram app
287
+ // init openplatform app
256
288
configOpenPlatform := GetOpenPlatformConfig ()
257
289
openPlatform , err := openPlatform .NewOpenPlatform (configOpenPlatform )
258
290
if err != nil {
259
291
fmt .Println (err .Error ())
260
292
}
261
293
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
+
262
303
}
0 commit comments