Skip to content

Commit ca66e5f

Browse files
author
bajins
committed
添加默认系统错误
1 parent eb308cb commit ca66e5f

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

result/result.go

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,7 @@ import (
44
"github.com/gin-gonic/gin"
55
)
66

7-
/**
8-
* 请求返回成功
9-
*
10-
* @author claer www.bajins.com
11-
* @date 2019/6/28 12:48
12-
*/
7+
// 请求返回成功
138
func Success(msg string, data interface{}) gin.H {
149
//var d = &struct {
1510
// code int
@@ -20,12 +15,7 @@ func Success(msg string, data interface{}) gin.H {
2015
return gin.H{"code": 200, "message": msg, "data": data}
2116
}
2217

23-
/**
24-
* 请求返回错误
25-
*
26-
* @author claer www.bajins.com
27-
* @date 2019/6/28 12:48
28-
*/
18+
// 请求返回错误
2919
func Error(code int, msg string) gin.H {
3020
//var d = &struct {
3121
// code int
@@ -35,3 +25,14 @@ func Error(code int, msg string) gin.H {
3525

3626
return gin.H{"code": code, "message": msg, "data": ""}
3727
}
28+
29+
// 默认系统错误
30+
func SystemError() gin.H {
31+
//var d = &struct {
32+
// code int
33+
// message string
34+
// data interface{}
35+
//}{code:code,message:msg,data:""}
36+
37+
return gin.H{"code": 500, "message": "系统错误!", "data": ""}
38+
}

0 commit comments

Comments
 (0)