From 77b317f182390c6f88623a585cf6430262f4fd2c Mon Sep 17 00:00:00 2001 From: john Date: Fri, 26 Oct 2018 11:02:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B5=8B=E8=AF=95=E6=96=87?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- geg/other/test.go | 29 ++++++++++++++++++----------- geg/other/test2.go | 16 ++++++++++++++++ geg/other/web/index.html | 1 + 3 files changed, 35 insertions(+), 11 deletions(-) create mode 100644 geg/other/test2.go create mode 100644 geg/other/web/index.html 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