|
|
@ -6,11 +6,15 @@ import ( |
|
|
|
) |
|
|
|
|
|
|
|
type StatusResult struct { |
|
|
|
Code string `json:"code"` |
|
|
|
Message string `json:"msg"` |
|
|
|
Scene string `json:"scene,omitempty"` |
|
|
|
SequenceId int `json:"sequenceId,omitempty"` |
|
|
|
Timestamp int64 `json:"timestamp"` |
|
|
|
Code string `json:"code"` |
|
|
|
Message string `json:"msg"` |
|
|
|
Timestamp int64 `json:"timestamp"` |
|
|
|
} |
|
|
|
|
|
|
|
type StatusResultEx struct { |
|
|
|
StatusResult |
|
|
|
Scene string `json:"scene"` |
|
|
|
SequenceId int `json:"sequenceId"` |
|
|
|
} |
|
|
|
|
|
|
|
func failureResponse(ctx *fiber.Ctx, code string, msg string, stat int) error { |
|
|
@ -28,13 +32,14 @@ func successResponse(ctx *fiber.Ctx, msg string) error { |
|
|
|
|
|
|
|
func successResponseEx(ctx *fiber.Ctx, msg string, scene string, seq int) error { |
|
|
|
var ret = make(map[string]interface{}) |
|
|
|
ret["status"] = StatusResult{ |
|
|
|
Code: "0", |
|
|
|
Message: msg, |
|
|
|
Timestamp: time.Now().Unix(), |
|
|
|
ret["status"] = StatusResultEx{ |
|
|
|
StatusResult: StatusResult{ |
|
|
|
Code: "0", |
|
|
|
Message: msg, |
|
|
|
Timestamp: time.Now().Unix(), |
|
|
|
}, |
|
|
|
SequenceId: seq, |
|
|
|
Scene: scene, |
|
|
|
} |
|
|
|
|
|
|
|
return ctx.JSON(ret) |
|
|
|
} |