1
This commit is contained in:
parent
1e0148bd50
commit
ec16fc1705
3
app.go
3
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() {
|
||||
|
@ -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() {
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
20
sysutils.go
20
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)
|
||||
|
18
tglog.go
18
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
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user