[agent-go] 完成RabbitMQ连接部分的代码

This commit is contained in:
zeaslity
2023-03-21 17:08:22 +08:00
parent 1c57a631d9
commit fe8a4a03fc
19 changed files with 482 additions and 93 deletions

1
agent-go/g/Nacos.go Normal file
View File

@@ -0,0 +1 @@
package g

16
agent-go/g/TimeUtils.go Normal file
View File

@@ -0,0 +1,16 @@
package g
import (
"time"
)
// CurTimeString 输出系统时间的格式为"2006-01-02 15:04:05"形式的时间字符串
func CurTimeString() string {
now := time.Now()
/*loc := time.FixedZone("UTC+8", 8*60*60) // 创建东八区时区对象
localTime := now.In(loc) // 转换为东八区时间*/
return now.Format("2006-01-02 15:04:05")
}

View File

@@ -1,9 +1,20 @@
package g
import "github.com/spf13/viper"
type Global struct {
LOG *Logger
LOG *Logger
NacosConfig *viper.Viper
}
const (
QueueDirect = "direct"
QueueTopic = "topic"
ExecOmType = "EXECUTOR"
StatusOmType = "STATUS"
InitOmType = "INIT"
)
var logger, _ = NewLogger()
var G = NewGlobal(

View File

@@ -14,7 +14,7 @@ type Logger struct {
func NewLogger() (*Logger, error) {
config := zap.Config{
Encoding: "json",
Level: zap.NewAtomicLevelAt(zap.InfoLevel),
Level: zap.NewAtomicLevelAt(zap.DebugLevel),
OutputPaths: []string{"stdout"}, // 输出到控制台
ErrorOutputPaths: []string{"stderr"},
EncoderConfig: zapcore.EncoderConfig{