diff --git a/geg/other/test.go b/geg/other/test.go index 8c43214c4..45b1e4ff3 100644 --- a/geg/other/test.go +++ b/geg/other/test.go @@ -1,17 +1,24 @@ package main import ( - "fmt" - "gitee.com/johng/gf/g/container/gtype" + "gitee.com/johng/gf/g/frame/gmvc" + "gitee.com/johng/gf/g/net/ghttp" ) - -func test() { - defer fmt.Println(1) - fmt.Println(2) +type ControllerIndex struct { + gmvc.Controller +} +func (c *ControllerIndex) Info() { + c.View.Assign("title", "Go Frame 第一个网站") + c.View.Assigns(map[string]interface{}{ + "name" : "很开心", + "score" : 100, + }) + c.View.Display("web/index.html") } - func main() { - v := gtype.NewInt(1) - fmt.Println(v.Set(2)) - fmt.Println(v.Set(2)) -} + s := ghttp.GetServer() + s.SetServerRoot("/home/john/Workspace/Go/GOPATH/src/gitee.com/johng/gf/geg/other/web/") + s.BindController("/", new(ControllerIndex)) + s.SetPort(8199) + s.Run() +} \ No newline at end of file diff --git a/geg/other/test2.go b/geg/other/test2.go new file mode 100644 index 000000000..c10973456 --- /dev/null +++ b/geg/other/test2.go @@ -0,0 +1,16 @@ +package main + +import ( + "gitee.com/johng/gf/g/os/gcron" + "gitee.com/johng/gf/g/os/glog" + "gitee.com/johng/gf/g/os/gtime" +) + +func main() { + start := gtime.Second() + gcron.Add("*/5 * * * * ?", func() { + glog.Println(gtime.Second() - start) + }) + + select{} +} \ No newline at end of file diff --git a/geg/other/web/index.html b/geg/other/web/index.html new file mode 100644 index 000000000..28d14454c --- /dev/null +++ b/geg/other/web/index.html @@ -0,0 +1 @@ +123456789