From ec16fc170509e3c526bca94df30d20c480e5b728 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Sat, 12 Aug 2023 20:32:44 +0800 Subject: [PATCH] 1 --- app.go | 3 --- context.go | 8 ++++++-- httpserver.go | 3 ++- syslog.go | 4 ++-- sysutils.go | 20 ++++---------------- tglog.go | 18 +++++++++++------- 6 files changed, 25 insertions(+), 31 deletions(-) diff --git a/app.go b/app.go index eab6569..47ee4e9 100644 --- a/app.go +++ b/app.go @@ -175,9 +175,6 @@ func (this *App_) NowUnixNano() int64 { } func (this *App_) outputRuningLog() { - for _, val := range q5.GetInitLogs() { - SysLog().Info("%s", val) - } } func (this *App_) dispatchIMMsg() { diff --git a/context.go b/context.go index c9cab19..f413d21 100644 --- a/context.go +++ b/context.go @@ -49,13 +49,17 @@ func (this *Context) GetRemoteAddr() string { return q5.GetRequestRemoteAddr(this.r) } +/* func (this *Context) Request(name string) *q5.XValue { return q5.Request(this.r, name) } +*/ +/* func (this *Context) GetBody() *q5.XValue { return q5.GetPostBody(this.r) } +*/ func (this *Context) Header(name string) string { if val, ok := this.r.Header[name]; ok { @@ -70,10 +74,10 @@ func (this *Context) Response(data string) { } func (this *Context)ResponseErr(errCode int32, errMsg string) { - respObj := q5.NewMxoObject() + /*respObj := q5.NewMxoObject() respObj.SetXValue("errcode", q5.NewXInt32(errCode)) respObj.SetXValue("errmsg", q5.NewXString(errMsg)) - q5.Response(this.w, respObj.ToJsonStr()) + q5.Response(this.w, respObj.ToJsonStr())*/ } func (this *Context) ResponseOk() { diff --git a/httpserver.go b/httpserver.go index fa061e7..1c0cebf 100644 --- a/httpserver.go +++ b/httpserver.go @@ -75,6 +75,7 @@ func (this *HttpServer) Start(listen_port int32) { } func (this *HttpServer) dispatchRequest(c *Context) { + /* atomic.AddInt64(&this.totalRequestTimes, 1) handleName := c.Request("c").GetString() + "$" + c.Request("a").GetString() handle := this.getHandle(handleName) @@ -95,7 +96,7 @@ func (this *HttpServer) dispatchRequest(c *Context) { } else { c.Response(`{"errcode":404, "errmsg":"interface not found"}`) atomic.AddInt64(&this.pageNotFoundTimes, 1) - } + }*/ } func (this *HttpServer) getHandle(handleName string) HandlerFunc { diff --git a/syslog.go b/syslog.go index edfeb04..b3ecfb2 100644 --- a/syslog.go +++ b/syslog.go @@ -97,9 +97,9 @@ func (this *SysLog_) addLog(category string, format string, args ...interface{}) p.logMsg = time.Now().Format("2006-01-02 15:04:05") + category + " " + fmt.Sprintf(format, args...) + "\n" - if q5.Debug() { + /*if q5.Debug() { fmt.Print(p.logMsg) - } + }*/ this.msgMutex.Lock() defer this.msgMutex.Unlock() if this.botNode != nil { diff --git a/sysutils.go b/sysutils.go index 45682d6..1335c52 100644 --- a/sysutils.go +++ b/sysutils.go @@ -2,8 +2,8 @@ package f5 import ( "os" - "strings" - "q5" + //"strings" + //"q5" ) const ( @@ -26,19 +26,7 @@ func IsDevEnv() bool { return serverEnv == DEV_ENV } -func IsValidSessionId(accountId string, sessionId string, key string) bool { - tmpStrings := strings.Split(sessionId, "_") - if len(tmpStrings) < 4 { - return false - } - sessionCreateTime := new(q5.XValue).SetString(tmpStrings[0]).GetString() - registerTime := new(q5.XValue).SetString(tmpStrings[1]).GetString() - md5Str := new(q5.XValue).SetString(tmpStrings[2]).GetString() - //SysLog().Debug("%s", accountId + key + registerTime + sessionCreateTime) - //SysLog().Debug("md51=%s md52=%s", q5.Md5Str(accountId + key + registerTime + sessionCreateTime), md5Str) - return q5.Md5Str(accountId + key + registerTime + sessionCreateTime) == md5Str -} - +/* func ExtractRegisterTimeFromSessionId(sessionId string) int64 { tmpStrings := strings.Split(sessionId, "_") if len(tmpStrings) < 4 { @@ -70,7 +58,7 @@ func ExtractOpenIdFromAccountId(accountId string) string { } return strings.Join(tmpStrings[2:], "_") } - +*/ func New[T any](cb func(*T)) *T { obj := new(T) cb(obj) diff --git a/tglog.go b/tglog.go index 629593b..97e82ab 100644 --- a/tglog.go +++ b/tglog.go @@ -1,10 +1,10 @@ package f5 -import "os" -import "fmt" +//import "os" +//import "fmt" import "sync" -import "time" -import "q5" +//import "time" +//import "q5" const TGLOG_ROOT = "/data/logs/%s/upload/" const POLY_TGLOG_ROOT = "/data/logs/%s/%d/upload/" @@ -26,7 +26,7 @@ type TGLog_ struct { func (this *TGLog_) Init() { this.chGoSaveExit = make(chan int) - go this.goSaveToFile() + //go this.goSaveToFile() } func (this *TGLog_) UnInit() { @@ -37,6 +37,7 @@ func (this *TGLog_) SetPolyLog(isPolyLog bool) { this.isPolyLog = isPolyLog } +/* func (this *TGLog_) AddTrackLog( gameId int32, accountId string, @@ -75,8 +76,9 @@ func (this *TGLog_) AddTrackLogEx( this.topNode = p this.botNode = p } -} - +//} +*/ + /* func (this *TGLog_) goSaveToFile() { var workNode *TGLogMsgNode for { @@ -119,3 +121,5 @@ func (this *TGLog_) getLogFile(gameId int32) *os.File { return nil } } + + */