config.go
2.3 KB
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
package config
import (
"github.com/zeromicro/go-zero/core/stores/cache"
"github.com/zeromicro/go-zero/zrpc"
"time"
)
type JWT struct {
Secret string `json:",optional"`
Expires time.Duration `json:",optional"`
}
type JwtAuth struct {
AccessSecret string
Expire int64
}
type Config struct {
JwtAuth JwtAuth `json:",optional"`
UserRpc zrpc.RpcClientConf `json:",optional"`
AuthRpc zrpc.RpcClientConf `json:",optional"`
PostRpc zrpc.RpcClientConf `json:",optional"`
CommentRpc zrpc.RpcClientConf `json:",optional"`
JWT JWT `json:",optional"`
DB struct {
DataSource string
} `json:",optional"`
Cache cache.CacheConf `json:",optional"`
DTM DTM `json:",optional"`
Sms Sms `json:",optional"`
Oss Oss `json:",optional"`
Wechat Wechat `json:",optional"` // 学员端微信
CoachClient Wechat `json:",optional"` // 教练端微信
OfficialAccount Wechat `json:",optional"`
ThirdWechatApps []Wechat `json:",optional"`
}
type DTM struct {
Server Server `json:",optional"`
}
type Server struct {
Name string `json:",optional"`
Host string `json:",optional"`
GRPC GRPC `json:",optional"`
HTTP HTTP `json:",optional"`
Metrics Metrics `json:",optional"`
}
type HTTP struct {
Port string
}
type GRPC struct {
Port string
}
type Metrics struct {
Port string
}
type Sms struct {
Debug bool
DebugCode string
Expire int `json:",default=180"`
MaxSendTime int `json:",default=5"`
CompanyName string
SecretId string
SecretKey string
SmsAppId string
Sign string
TemplateId string
}
type Oss struct {
OssEndPoint string
AccessKeyID string
AccessKeySecret string
BuckName string
RegionID string
RoleArn string
CDN CDN
}
type Wechat struct {
AppName string `json:",optional"`
AppID string
AppSecret string
MsgTemplates []Template `json:",optional"`
}
func (wx Wechat) GetTemplate(code string) (Template, bool) {
for _, temp := range wx.MsgTemplates {
if temp.Code == code {
return temp, true
}
}
return Template{}, false
}
type CDN struct {
HostPairs []string
}
type Template struct {
ID string // 模板ID
Name string // 模板名称
Code string // 模板编码
}