This commit is contained in:
aozhiwei 2020-09-07 16:57:34 +08:00
parent a9b6ae14e7
commit f58f61120a
5 changed files with 44 additions and 2 deletions

View File

@ -1,6 +1,14 @@
package q5 package q5
import "crypto/md5"
import "encoding/hex"
func Test()(a string) { func Test()(a string) {
return "testb" return "testb"
} }
func Md5Str(data string) string {
h := md5.New()
h.Write([]byte(data))
return hex.EncodeToString(h.Sum(nil))
}

View File

@ -1,5 +1,6 @@
package q5 package q5
import "net/http"
import "time" import "time"
func GetDaySeconds(seconds int64) int64 { func GetDaySeconds(seconds int64) int64 {
@ -9,3 +10,22 @@ func GetDaySeconds(seconds int64) int64 {
func GetTickCount() int64 { func GetTickCount() int64 {
return time.Now().UnixNano() / 1e6 return time.Now().UnixNano() / 1e6
} }
func MkInt64(lo32 int32, hi32 int32) int64 {
return int64(lo32) + (int64(hi32) << 32)
}
func Request(r *http.Request, name string) *XValue {
if r.Form == nil {
r.ParseForm()
}
v := &XValue{}
if vs, ok := r.Form[name]; ok {
if len(vs) > 0 {
v.SetString(vs[0])
} else {
v.SetString("")
}
}
return v
}

View File

@ -241,6 +241,10 @@ func (this *Timer) GetRunningTimer() *TimerList {
return nil return nil
} }
func (this *Timer) GetIdleMilliSeconds() int64 {
return 0
}
func (this *Timer) detachTimer(timerList *TimerList) { func (this *Timer) detachTimer(timerList *TimerList) {
if !timerList.entry.Empty() { if !timerList.entry.Empty() {
timerList.entry.DelInit() timerList.entry.DelInit()

View File

@ -11,6 +11,7 @@ func (this *XParams) Reset() *XParams {
return this return this
} }
func (this *XParams) SetInt32(val int32) *XParams { func (this *XParams) Init(initFunc func (*XParams)) *XParams {
initFunc(this)
return this return this
} }

View File

@ -57,6 +57,10 @@ func (this *XValue) SetUserData(val interface{}) *XValue {
return this return this
} }
func (this *XValue) GetInt32() int32 {
return int32(this.GetInt64())
}
func (this *XValue) GetInt64() int64 { func (this *XValue) GetInt64() int64 {
switch this._type { switch this._type {
case XVT_INT: case XVT_INT:
@ -81,5 +85,10 @@ func (this *XValue) GetInt64() int64 {
} }
func (this *XValue) GetString() string { func (this *XValue) GetString() string {
switch this._type {
case XVT_STRING:
return *(this._val.(*string))
default:
return "" return ""
}
} }