|
|
@ -8,7 +8,7 @@ |
|
|
|
* [transport:通用http ResponseEncoder](#transport通用http-responseencoder) |
|
|
|
* [transport:通用http ResponseEncoder](#transport通用http-responseencoder) |
|
|
|
* [meta:跨服务meta信息设置和获取](#meta跨服务meta信息设置和获取) |
|
|
|
* [meta:跨服务meta信息设置和获取](#meta跨服务meta信息设置和获取) |
|
|
|
* [encrypt:对称加密](#encrypt对称加密) |
|
|
|
* [encrypt:对称加密](#encrypt对称加密) |
|
|
|
<!-- TOC --> |
|
|
|
<!-- TOC --> |
|
|
|
|
|
|
|
|
|
|
|
## 安装 |
|
|
|
## 安装 |
|
|
|
|
|
|
|
|
|
|
@ -55,4 +55,47 @@ go get gitea.drugeyes.vip/pharnexbase/tools@v1.0.0 |
|
|
|
|
|
|
|
|
|
|
|
* v1 |
|
|
|
* v1 |
|
|
|
|
|
|
|
|
|
|
|
> 对称加密,目前包含:SHA1PRNG |
|
|
|
> 对称加密,目前包含:SHA1PRNG |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### glog:全局日志 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
* v1 |
|
|
|
|
|
|
|
* 本地环境不变,dev,pre,pro 上传阿里 |
|
|
|
|
|
|
|
```go |
|
|
|
|
|
|
|
// main.go 加入 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func initLog() (log.Logger, func()) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
l, f := glog.NewLogger(&glog.LoggerConfig{ |
|
|
|
|
|
|
|
Env: "dev", |
|
|
|
|
|
|
|
Id: id, |
|
|
|
|
|
|
|
Name: Name, |
|
|
|
|
|
|
|
Version: Version, |
|
|
|
|
|
|
|
AliLogConfig: glog.AliLogConfig{ |
|
|
|
|
|
|
|
AccessKey: "", |
|
|
|
|
|
|
|
AccessSecret: "", |
|
|
|
|
|
|
|
Endpoint: "", |
|
|
|
|
|
|
|
Project: "", |
|
|
|
|
|
|
|
LogStore: "", |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
glog.NewHelper(l) |
|
|
|
|
|
|
|
return l, f |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// main函数加入 |
|
|
|
|
|
|
|
func main() { |
|
|
|
|
|
|
|
... |
|
|
|
|
|
|
|
logger, f := initLog() |
|
|
|
|
|
|
|
defer f() |
|
|
|
|
|
|
|
... |
|
|
|
|
|
|
|
app, cleanup, err := wireApp(..., logger) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 使用 |
|
|
|
|
|
|
|
glog.Glog.WithContext(ctx).Error("请输入正确手机号") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|