use logrus to project default log tools
This commit is contained in:
+15
-15
@@ -9,10 +9,10 @@ import (
|
||||
)
|
||||
|
||||
type Context struct {
|
||||
*Application
|
||||
ContextBase
|
||||
Resp http.ResponseWriter
|
||||
Req *http.Request
|
||||
Application *Application
|
||||
RouterString []string
|
||||
Config Map
|
||||
Db *HoTimeDB
|
||||
@@ -22,22 +22,22 @@ type Context struct {
|
||||
HandlerStr string //复写请求url
|
||||
}
|
||||
|
||||
//唯一标志
|
||||
func (this *Context) Mtd(router [3]string) Map {
|
||||
this.Application.Router[router[0]][router[1]][router[2]](this)
|
||||
d := this.RespData
|
||||
this.RespData = nil
|
||||
// Mtd 唯一标志
|
||||
func (that *Context) Mtd(router [3]string) Map {
|
||||
that.Application.Router[router[0]][router[1]][router[2]](that)
|
||||
d := that.RespData
|
||||
that.RespData = nil
|
||||
return d
|
||||
}
|
||||
|
||||
//打印
|
||||
func (this *Context) Display(statu int, data interface{}) {
|
||||
func (that *Context) Display(statu int, data interface{}) {
|
||||
|
||||
resp := Map{"statu": statu}
|
||||
if statu != 0 {
|
||||
temp := Map{}
|
||||
|
||||
tpe := this.Config.GetMap("error").GetString(ObjToStr(statu))
|
||||
tpe := that.Config.GetMap("error").GetString(ObjToStr(statu))
|
||||
if tpe == "" {
|
||||
//logFmt(errors.New("找不到对应的错误码"), 2, LOG_WARN)
|
||||
}
|
||||
@@ -49,19 +49,19 @@ func (this *Context) Display(statu int, data interface{}) {
|
||||
resp["result"] = data
|
||||
}
|
||||
|
||||
this.RespData = resp
|
||||
that.RespData = resp
|
||||
|
||||
//this.Data=d;
|
||||
//that.Data=d;
|
||||
}
|
||||
|
||||
func (this *Context) View() {
|
||||
if this.RespData == nil {
|
||||
func (that *Context) View() {
|
||||
if that.RespData == nil {
|
||||
return
|
||||
}
|
||||
d, err := json.Marshal(this.RespData)
|
||||
d, err := json.Marshal(that.RespData)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
this.RespData = nil
|
||||
this.Resp.Write(d)
|
||||
that.RespData = nil
|
||||
that.Resp.Write(d)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user