[agent-go] 完成RabbitMQ连接部分的代码
This commit is contained in:
31
agent-go/rabbitmq/OctopusMessage.go
Normal file
31
agent-go/rabbitmq/OctopusMessage.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package rabbitmq
|
||||
|
||||
import (
|
||||
"agent-go/g"
|
||||
"time"
|
||||
)
|
||||
|
||||
type OctopusMessage struct {
|
||||
UUID string `json:"uuid"`
|
||||
InitTime time.Time `json:"init_time" format:"2023-03-21 16:38:30"`
|
||||
Type string `json:"type"`
|
||||
Content interface{} `json:"content"`
|
||||
Result interface{} `json:"result"`
|
||||
ACTime time.Time `json:"ac_time" format:"2023-03-21 16:38:30"`
|
||||
}
|
||||
|
||||
// BuildOctopusMsg 生成OctopusMessage
|
||||
func (m *OctopusMessage) BuildOctopusMsg(omType string, content interface{}) *OctopusMessage {
|
||||
|
||||
// 当前时间
|
||||
curTimeString := g.CurTimeString()
|
||||
|
||||
return &OctopusMessage{
|
||||
UUID: curTimeString,
|
||||
InitTime: time.Now(),
|
||||
Type: omType,
|
||||
Content: content,
|
||||
Result: nil,
|
||||
ACTime: time.Time{},
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user