Commit 7b68309b by 杨树贤

添加响应函数

parent 7df494af
package app
import (
"github.com/gin-gonic/gin"
)
type Gin struct {
C *gin.Context
}
type Response struct {
Code int `json:"code"`
Msg string `json:"msg"`
Data interface{} `json:"data"`
}
// Response setting gin.JSON
func (g *Gin) Response(errCode int, errMsg string, data interface{}) {
g.C.JSON(200, Response{
Code: errCode,
Msg: errMsg,
Data: data,
})
return
}
package logger
import (
"LC_soapi/pkg/util"
"fmt"
"time"
)
......@@ -17,11 +19,15 @@ type ErrorLog struct {
}
//上报请求日志
func ReportErrorLog(msg string,code int) {
func ReportErrorLog(msg string,code int,method string) {
var errLog ErrorLog
caller:=util.GetCaller(2);
fmt.Println(caller)
errLog.TimeStamp = int(time.Now().Unix())
errLog.DateTimeStr = time.Now().Format("2006-01-02 15:04:05")
errLog.App = "Search"
errLog.ServerIp = "2123"
errLog.ServerIp = "127.0.0.1"
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment