diff --git a/.idea/libraries/GOPATH__hotime_.xml b/.idea/libraries/GOPATH__hotime_.xml
index 05b5382..55a4127 100644
--- a/.idea/libraries/GOPATH__hotime_.xml
+++ b/.idea/libraries/GOPATH__hotime_.xml
@@ -1,14 +1,14 @@
-
-
+
+
-
-
+
+
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 4eb782b..3fceb37 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -5,9 +5,14 @@
+
+
+
+
+
+
+
-
-
@@ -17,7 +22,6 @@
-
@@ -30,8 +34,8 @@
-
-
+
+
@@ -43,7 +47,7 @@
-
+
@@ -53,7 +57,7 @@
-
+
@@ -63,17 +67,27 @@
-
+
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
@@ -82,8 +96,8 @@
-
-
+
+
@@ -93,7 +107,7 @@
-
+
@@ -103,7 +117,7 @@
-
+
@@ -112,18 +126,8 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
+
@@ -191,20 +195,10 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
@@ -221,7 +215,6 @@
-
@@ -229,6 +222,10 @@
+
+
+
+
@@ -239,6 +236,10 @@
+
+
+
+
@@ -271,6 +272,7 @@
+
@@ -314,6 +316,10 @@
+
+
+
+
@@ -338,9 +344,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -352,6 +374,10 @@
+
+
+
+
project
@@ -362,12 +388,25 @@
-
+
+
+ project
+
+
+ true
+
+
+
+ DIRECTORY
+
+ false
+
+
@@ -381,23 +420,23 @@
- C:\Users\92597\AppData\Roaming\Subversion
+ C:\Users\彭\AppData\Roaming\Subversion
125
-
-
+
+
@@ -429,6 +468,8 @@
+
+
1500458878821
@@ -567,7 +608,7 @@
-
+
@@ -579,15 +620,15 @@
-
-
+
+
-
+
-
+
@@ -614,7 +655,8 @@
-
+
+
@@ -623,32 +665,24 @@
-
-
-
-
-
-
-
-
-
+
-
+
-
+
@@ -656,14 +690,14 @@
-
+
-
+
@@ -671,7 +705,7 @@
-
+
@@ -679,21 +713,21 @@
-
+
-
+
-
+
@@ -701,14 +735,14 @@
-
+
-
+
@@ -716,14 +750,14 @@
-
+
-
+
@@ -731,14 +765,14 @@
-
+
-
+
@@ -746,21 +780,21 @@
-
+
-
+
-
+
@@ -768,7 +802,7 @@
-
+
@@ -776,21 +810,21 @@
-
+
-
+
-
+
@@ -798,7 +832,7 @@
-
+
@@ -809,30 +843,28 @@
-
+
-
-
+
-
-
+
-
+
@@ -840,90 +872,78 @@
-
+
-
+
-
-
-
-
+
-
+
-
-
-
-
+
-
-
-
-
+
-
-
+
-
-
+
-
-
+
-
+
-
-
+
+
@@ -933,7 +953,7 @@
-
+
@@ -941,7 +961,7 @@
-
+
@@ -949,7 +969,7 @@
-
+
@@ -957,7 +977,7 @@
-
+
@@ -965,31 +985,39 @@
-
+
-
-
+
+
-
-
+
+
-
-
+
+
+
+
+
+
+
+
+
+
diff --git a/manage/config/config.json b/manage/config/config.json
new file mode 100644
index 0000000..3d4ee02
--- /dev/null
+++ b/manage/config/config.json
@@ -0,0 +1,18 @@
+{
+ "cacheLongTime": 2592000,
+ "cacheShortTime": 7200,
+ "dbHost": "127.0.0.1",
+ "dbName": "test",
+ "dbPort": "3306",
+ "dbPwd": "root",
+ "dbUser": "root",
+ "defFile": [
+ "index.html",
+ "index.htm"
+ ],
+ "error": {},
+ "logLevel": 0,
+ "port": "80",
+ "sessionName": "HOTIME",
+ "tpt": "tpt"
+}
\ No newline at end of file
diff --git a/manage/manage.go b/manage/manage.go
new file mode 100644
index 0000000..ec1503a
--- /dev/null
+++ b/manage/manage.go
@@ -0,0 +1,173 @@
+package manage
+
+import (
+ "fmt"
+ _ "github.com/go-sql-driver/mysql"
+ "go.hoteas.com/hotime"
+ "golang.org/x/net/websocket"
+ "io"
+ "os"
+ "path/filepath"
+ "strings"
+)
+
+var ConfigPath = "config/config_manage.json"
+var TptPath = "manageTpt"
+var PkgDirPath = os.Getenv("GOPATH") + "/src/" + "go.hoteas.com/hotime/manage"
+
+func Run() {
+
+ appIns := hotime.Application{}
+ //手动模式,
+ appIns.SetConfig(ConfigPath)
+
+ if _, e := os.Open(TptPath); e != nil {
+ os.MkdirAll(TptPath, os.ModeDir)
+ copyDir(PkgDirPath+"/"+appIns.Config.GetString("tpt"), TptPath)
+ }
+
+ appIns.Config["tpt"] = TptPath
+ appIns.SetSession(hotime.CacheIns(&hotime.CacheMemory{}), hotime.CacheIns(&hotime.CacheMemory{}))
+ appIns.SetCache(hotime.CacheIns(&hotime.CacheMemory{}))
+
+ //快捷模式
+ //appIns.SetDefault(func(err ...*hotime.Error) *sql.DB {
+ // query := appIns.Config.GetString("dbUser") + ":" + appIns.Config.GetString("dbPwd") +
+ // "@tcp(" + appIns.Config.GetString("dbHost") + ":" + appIns.Config.GetString("dbPort") + ")/" + appIns.Config.GetString("dbName") + "?charset=utf8"
+ // DB, e := sql.Open("mysql", query)
+ // if e != nil && len(err) != 0 {
+ // err[0].SetError(e)
+ // }
+ // return DB
+ //})
+
+ appIns.Run(hotime.Router{
+ "app": hotime.Proj{
+ "index": hotime.Ctr{
+ "test": func(this *hotime.Context) {
+ fmt.Println(this.Db.GetTag())
+ x := this.Db.Action(func(db hotime.HoTimeDB) bool {
+
+ db.Insert("user", hotime.Map{"unickname": "dasdas"})
+
+ return true
+ })
+ this.Display(5, x)
+ },
+ "websocket": func(this *hotime.Context) {
+ hdler := websocket.Handler(func(ws *websocket.Conn) {
+ for true {
+ msg := make([]byte, 5120)
+ n, err := ws.Read(msg)
+
+ if err != nil {
+ return
+ }
+ fmt.Printf("Receive: %s\n", msg[:n])
+
+ send_msg := "[" + string(msg[:n]) + "]"
+ m, err := ws.Write([]byte(send_msg))
+ if err != nil {
+ return
+ }
+ fmt.Printf("Send: %s\n", msg[:m])
+ }
+ })
+ hdler.ServeHTTP(this.Resp, this.Req)
+ },
+ },
+ },
+ })
+}
+
+func copyDir(src string, dest string) {
+ src_original := src
+ err := filepath.Walk(src, func(src string, f os.FileInfo, err error) error {
+ //fmt.Println(err)
+ if f == nil {
+ return err
+ }
+ if f.IsDir() {
+ // fmt.Println(f.Name())
+ // copyDir(f.Name(), dest+"/"+f.Name())
+ } else {
+ //fmt.Println(src)
+ src = strings.Replace(src, "\\", "/", -1)
+ //fmt.Println(src_original)
+ //fmt.Println(dest)
+
+ dest_new := strings.Replace(src, src_original, dest, -1)
+ //fmt.Println(dest_new)
+ //fmt.Println("CopyFile:" + src + " to " + dest_new)
+ CopyFile(src, dest_new)
+ }
+ //println(path)
+ return nil
+ })
+ if err != nil {
+ fmt.Printf("filepath.Walk() returned %v\n", err)
+ }
+}
+
+//egodic directories
+func getFilelist(path string) {
+ err := filepath.Walk(path, func(path string, f os.FileInfo, err error) error {
+ if f == nil {
+ return err
+ }
+ if f.IsDir() {
+ return nil
+ }
+ println(path)
+ return nil
+ })
+ if err != nil {
+ fmt.Printf("filepath.Walk() returned %v\n", err)
+ }
+}
+func PathExists(path string) (bool, error) {
+ _, err := os.Stat(path)
+ if err == nil {
+ return true, nil
+ }
+ if os.IsNotExist(err) {
+ return false, nil
+ }
+ return false, err
+}
+
+//copy file
+func CopyFile(src, dst string) (w int64, err error) {
+ srcFile, err := os.Open(src)
+ if err != nil {
+ fmt.Println(err.Error())
+ return
+ }
+ defer srcFile.Close()
+ fmt.Println("dst:" + dst)
+ dst_slices := strings.Split(dst, "\\")
+ dst_slices_len := len(dst_slices)
+ dest_dir := ""
+ for i := 0; i < dst_slices_len-1; i++ {
+ dest_dir = dest_dir + dst_slices[i] + "\\"
+ }
+ //dest_dir := getParentDirectory(dst)
+ fmt.Println("dest_dir:" + dest_dir)
+ b, err := PathExists(dest_dir)
+ if b == false {
+ err := os.Mkdir(dest_dir, os.ModePerm) //在当前目录下生成md目录
+ if err != nil {
+ fmt.Println(err)
+ }
+ }
+ dstFile, err := os.Create(dst)
+
+ if err != nil {
+ fmt.Println(err.Error())
+ return
+ }
+
+ defer dstFile.Close()
+
+ return io.Copy(dstFile, srcFile)
+}
diff --git a/manage/tpt/index.html b/manage/tpt/index.html
new file mode 100644
index 0000000..e69de29