重新初始化项目

This commit is contained in:
2023-04-27 15:56:12 +08:00
parent 10546eb629
commit d6e256ef9e
50 changed files with 1255 additions and 308 deletions

View File

@@ -2,9 +2,16 @@ package config
// 阿里云配置
type aliyunConfig struct {
Sms aliSmsConfig `mapstructure:"sms" yaml:"sms"` // 短信配置
Oss aliOssConfig `mapstructure:"oss" yaml:"oss"` // oss配置
}
// SmsConfig 阿里云短信配置
type aliSmsConfig struct {
AccessKeyId string `mapstructure:"access-key" yaml:"access-key"`
AccessKeySecret string `mapstructure:"access-key-secret" yaml:"access-key-secret"`
}
// OSSConfig 阿里云OSS配置
type aliOssConfig struct {
Endpoint string `mapstructure:"endpoint" yaml:"endpoint"`

View File

@@ -1,14 +1,13 @@
package config
var Scd systemConfigData
var Nacos nacosConfig
// 配置信息
type systemConfigData struct {
Admin appInfo `mapstructure:"admin" yaml:"admin"` // 系统配置-Admin
Api appInfo `mapstructure:"api" yaml:"api"` // 系统配置-Api
MySQL mysqlConfig `mapstructure:"mysql" yaml:"mysql"` // MySQL配置
Redis redisConfig `mapstructure:"redis" yaml:"redis"` // Redis配置
Aliyun aliyunConfig `mapstructure:"aliyun" yaml:"aliyun"` // 阿里云配置
Tencent tencentConfig `mapstructure:"tencent" yaml:"tencent"` // 腾讯相关配置
JWT JWT `mapstructure:"jwt" yaml:"jwt"`
}

15
config/redis.go Normal file
View File

@@ -0,0 +1,15 @@
package config
import "fmt"
// Redis配置
type redisConfig struct {
Host string `mapstructure:"host" yaml:"host"` // 主机
Port int `mapstructure:"port" yaml:"port"` // 端口
Password string `mapstructure:"password" yaml:"password"` // 密码
Db int `mapstructure:"db" yaml:"db"` // 数据库名称
}
func (r redisConfig) GetDSN() string {
return fmt.Sprintf("%s:%v", r.Host, r.Port)
}

View File

@@ -3,6 +3,8 @@ package config
// 腾讯相关配置
type tencentConfig struct {
MiniApp wechatMiniAppConfig `mapstructure:"mini-app" yaml:"mini-app"`
Payment wechatPayConfig `mapstructure:"payment" yaml:"payment"`
CApi capiConfig `mapstructure:"capi" yaml:"capi"`
}
// 微信小程序配置
@@ -10,3 +12,18 @@ type wechatMiniAppConfig struct {
AppId string `mapstructure:"app-id" yaml:"app-id"`
AppSecret string `mapstructure:"app-secret" yaml:"app-secret"`
}
// 微信支付配置
type wechatPayConfig struct {
MchId string `mapstructure:"mchId" yaml:"mchId"` // 商户号
SerialNo string `mapstructure:"serialNo" yaml:"serialNo"` // 商户API证书的证书序列号
ApiV3Key string `mapstructure:"apiV3Key" yaml:"apiV3Key"` // 支付key
PrivateKey string `mapstructure:"privateKey" yaml:"privateKey"` // 支付私钥绝对路径
}
// api密钥配置
type capiConfig struct {
AppId string `mapstructure:"app-id" yaml:"app-id"` // APP ID
SecretId string `mapstructure:"secret-id" yaml:"secret-id"` // Secret ID
SecretKey string `mapstructure:"secret-key" yaml:"secret-key"` // Secret Key
}