-
Notifications
You must be signed in to change notification settings - Fork 13
/
main.go
74 lines (56 loc) · 1.84 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package main
import (
"github.com/gin-gonic/gin"
"log"
"power-wechat-tutorial/config"
"power-wechat-tutorial/routes"
"power-wechat-tutorial/services"
)
var Host = ""
var Port = "8888"
// @title PowerWechat API Docs
// @version 1.0.1
// @description 这是一个开源的使用教程,包含PowerWechat的大部分接口调试代码.
// @termsOfService http://artisan-cloud.com/terms/
// @contact.name ArtisanCloud Support
// @contact.url https://powerwechat.artisan-cloud.com/zh/start/qa.html
// @contact.email matrix-x@artisan-cloud.como
// @license.name MIT 2.0
// @license.url https://github.com/ArtisanCloud/PowerWeChat?tab=MIT-1-ov-file#readme
// @host localhost:8080
// @BasePath /api/v1
// @securityDefinitions.basic BasicAuth
// @externalDocs.description OpenAPI
// @externalDocs.url https://swagger.io/resources/open-api/
func main() {
conf := config.Get()
var err error
services.PaymentApp, err = services.NewWXPaymentApp(conf)
if err != nil || services.PaymentApp == nil {
panic(err)
}
services.MiniProgramApp, err = services.NewMiniMiniProgramService(conf)
if err != nil || services.MiniProgramApp == nil {
panic(err)
}
services.OfficialAccountApp, err = services.NewOfficialAccountAppService(conf)
if err != nil || services.OfficialAccountApp == nil {
panic(err)
}
services.WeComApp, err = services.NewWeComService(conf)
if err != nil || services.WeComApp == nil {
panic(err)
}
services.WeComContactApp, err = services.NewWeComContactService(conf)
if err != nil || services.WeComContactApp == nil {
panic(err)
}
services.OpenPlatformApp, err = services.NewOpenPlatformAppService(conf)
if err != nil || services.OpenPlatformApp == nil {
panic(err)
}
r := gin.Default()
// Initialize the routes
routes.InitializeRoutes(r)
log.Fatalln(r.Run(Host + ":" + Port))
}