Ai
2 Star 0 Fork 0

nextcyber/go-next-result

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
brief.go 931 Bytes
一键复制 编辑 原始数据 按行查看 历史
wvkity 提交于 2024-01-20 16:09 +08:00 . - 修改status、code数据类型
package res
import (
"strconv"
"time"
)
// Brief 异常简要信息类
type Brief struct {
// Success 是否成功
Success bool `json:"success"`
// 状态码
Code int `json:"code"`
// Msg 异常信息
Msg string `json:"msg"`
// Timestamp 时间戳
Timestamp string `json:"timestamp"`
// GmtCreate 时间字符串
GmtCreate string `json:"gmtCreate"`
}
func (_self *Brief) GetCode() int {
return _self.Code
}
func (_self *Brief) SetCode(code int) {
_self.Code = code
}
func (_self *Brief) GetMsg() string {
return _self.Msg
}
func (_self *Brief) SetMsg(msg string) {
_self.Msg = msg
}
// Verify 检验是否成功
func (_self *Brief) Verify() {
_self.Success = _self.Code == 0 || _self.Code == 200
}
// _setTime 设置时间
func (_self *Brief) _setTime() {
current := time.Now()
_self.GmtCreate = current.Format("2006-01-02 15:04:05.000")
_self.Timestamp = strconv.FormatInt(current.UnixMilli(), 0x0a)
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/nextcyber/go-next-result.git
git@gitee.com:nextcyber/go-next-result.git
nextcyber
go-next-result
go-next-result
47b8d5d30115

搜索帮助