hotime/example/main.go

45 lines
1.0 KiB
Go
Raw Normal View History

2017-08-17 02:37:00 +00:00
package main
import (
2022-03-13 09:02:19 +00:00
. "code.hoteas.com/golang/hotime"
2022-03-14 08:48:19 +00:00
"code.hoteas.com/golang/hotime/example/app"
2022-03-12 21:06:28 +00:00
//. "code.hoteas.com/golang/hotime/common"
2017-09-05 03:09:13 +00:00
"fmt"
2018-04-08 16:02:13 +00:00
"time"
2017-08-17 02:37:00 +00:00
)
func main() {
date, _ := time.Parse("2006-01-02 15:04", time.Now().Format("2006-01-02")+" 14:00")
fmt.Println(date, date.Unix())
2021-10-26 16:27:24 +00:00
//fmt.Println("0123456"[1:7])
2022-03-13 09:02:19 +00:00
appIns := Init("config/config.json")
2022-03-12 21:06:28 +00:00
//a:=Map{}
//a.GetBool()
2022-03-13 09:02:19 +00:00
appIns.SetConnectListener(func(that *Context) (isFinished bool) {
2022-03-16 01:58:24 +00:00
//that.Session("admin_id", 1)
if len(that.RouterString) == 3 {
if that.HandlerStr == "/app/hotime/test" {
that.Session("admin_id", 1)
that.Display(0, that.SessionId)
return true
}
if that.RouterString[1] == "wechat" || that.RouterString[1] == "websocket" {
if appIns.MethodRouter[that.HandlerStr] != nil {
appIns.MethodRouter[that.HandlerStr](that)
return true
}
}
}
2022-03-13 09:02:19 +00:00
return isFinished
})
//appIns.Db.Action(func(db db.HoTimeDB) (isSuccess bool) {
// return isSuccess
//})
2022-03-14 08:48:19 +00:00
appIns.Run(Router{
"app": app.Project,
})
2017-08-17 02:37:00 +00:00
}