新增问诊订单详情。修改错误码格式

This commit is contained in:
2023-09-06 14:30:54 +08:00
parent dc0217d191
commit 654c0fed05
23 changed files with 810 additions and 59 deletions
+8 -8
View File
@@ -12,7 +12,7 @@ type res struct {
Message string `json:"message"`
}
func Result(code int, data interface{}, msg string, c *gin.Context) {
func result(code int, data interface{}, msg string, c *gin.Context) {
if data == nil {
data = gin.H{}
}
@@ -24,29 +24,29 @@ func Result(code int, data interface{}, msg string, c *gin.Context) {
}
func Ok(c *gin.Context) {
Result(consts.HTTP_SUCCESS, map[string]interface{}{}, "成功", c)
result(consts.HttpSuccess, map[string]interface{}{}, "成功", c)
}
func OkWithMessage(message string, c *gin.Context) {
Result(consts.HTTP_SUCCESS, map[string]interface{}{}, message, c)
result(consts.HttpSuccess, map[string]interface{}{}, message, c)
}
func OkWithData(data interface{}, c *gin.Context) {
Result(consts.HTTP_SUCCESS, data, "成功", c)
result(consts.HttpSuccess, data, "成功", c)
}
func OkWithDetailed(data interface{}, message string, c *gin.Context) {
Result(consts.HTTP_SUCCESS, data, message, c)
result(consts.HttpSuccess, data, message, c)
}
func Fail(c *gin.Context) {
Result(consts.HTTP_ERROR, map[string]interface{}{}, "失败", c)
result(consts.HttpError, map[string]interface{}{}, "失败", c)
}
func FailWithMessage(message string, c *gin.Context) {
Result(consts.HTTP_ERROR, map[string]interface{}{}, message, c)
result(consts.HttpError, map[string]interface{}{}, message, c)
}
func FailWithDetailed(data interface{}, message string, c *gin.Context) {
Result(consts.HTTP_ERROR, data, message, c)
result(consts.HttpError, data, message, c)
}