打印影响延迟优化
This commit is contained in:
+12
-11
@@ -13,19 +13,18 @@ type Context struct {
|
||||
*Application
|
||||
Resp http.ResponseWriter
|
||||
Req *http.Request
|
||||
Log Map//日志有则创建
|
||||
Log Map //日志有则创建
|
||||
RouterString []string
|
||||
Config Map
|
||||
Db *HoTimeDB
|
||||
RespData Map
|
||||
RespFunc func()
|
||||
RespFunc func()
|
||||
CacheIns
|
||||
SessionIns
|
||||
DataSize int
|
||||
HandlerStr string //复写请求url
|
||||
}
|
||||
|
||||
|
||||
// Mtd 唯一标志
|
||||
func (that *Context) Mtd(router [3]string) Map {
|
||||
that.Application.Router[router[0]][router[1]][router[2]](that)
|
||||
@@ -61,26 +60,28 @@ func (that *Context) Display(statu int, data interface{}) {
|
||||
}
|
||||
|
||||
func (that *Context) View() {
|
||||
if that.RespFunc!=nil {
|
||||
if that.RespFunc != nil {
|
||||
that.RespFunc()
|
||||
}
|
||||
if that.RespData == nil {
|
||||
return
|
||||
}
|
||||
//创建日志
|
||||
if that.Log!=nil{
|
||||
that.Log["time"]=time.Now().Unix()
|
||||
if that.Session("admin_id").Data!=nil{
|
||||
that.Log["admin_id"]=that.Session("admin_id").ToCeilInt()
|
||||
if that.Log != nil {
|
||||
that.Log["time"] = time.Now().Unix()
|
||||
if that.Session("admin_id").Data != nil {
|
||||
that.Log["admin_id"] = that.Session("admin_id").ToCeilInt()
|
||||
}
|
||||
if that.Session("user_id").Data!=nil{
|
||||
that.Log["user_id"]=that.Session("user_id").ToCeilInt()
|
||||
if that.Session("user_id").Data != nil {
|
||||
that.Log["user_id"] = that.Session("user_id").ToCeilInt()
|
||||
}
|
||||
that.Db.Insert("logs",that.Log)
|
||||
that.Db.Insert("logs", that.Log)
|
||||
}
|
||||
|
||||
d, err := json.Marshal(that.RespData)
|
||||
if err != nil {
|
||||
that.Display(1, err.Error())
|
||||
that.View()
|
||||
return
|
||||
}
|
||||
that.DataSize = len(d)
|
||||
|
||||
Reference in New Issue
Block a user