框架基本完成

This commit is contained in:
hoteas 2017-08-17 02:14:22 +00:00
parent f97dd2752b
commit b15004b86b
4 changed files with 4 additions and 20 deletions

View File

@ -1,30 +1,14 @@
<component name="libraryTable"> <component name="libraryTable">
<library name="GOPATH &lt;hotime&gt;"> <library name="GOPATH &lt;hotime&gt;">
<CLASSES> <CLASSES>
<root url="file://E:/gopath/src/hblog" />
<root url="file://$PROJECT_DIR$/../../golang.org" /> <root url="file://$PROJECT_DIR$/../../golang.org" />
<root url="file://E:/gopath/src/test" />
<root url="file://$PROJECT_DIR$/../../github.com" /> <root url="file://$PROJECT_DIR$/../../github.com" />
<root url="file://E:/gopath/src/github.com" />
<root url="file://$PROJECT_DIR$/.." /> <root url="file://$PROJECT_DIR$/.." />
<root url="file://E:/gopath/src/timpen" />
<root url="file://E:/gopath/src/golang.org" />
<root url="file://E:/gopath/src/bitbucket.org" />
<root url="file://E:/gopath/src/gopkg.in" />
<root url="file://E:/gopath/src/hotime" />
</CLASSES> </CLASSES>
<SOURCES> <SOURCES>
<root url="file://E:/gopath/src/hblog" />
<root url="file://$PROJECT_DIR$/../../golang.org" /> <root url="file://$PROJECT_DIR$/../../golang.org" />
<root url="file://E:/gopath/src/test" />
<root url="file://$PROJECT_DIR$/../../github.com" /> <root url="file://$PROJECT_DIR$/../../github.com" />
<root url="file://E:/gopath/src/github.com" />
<root url="file://$PROJECT_DIR$/.." /> <root url="file://$PROJECT_DIR$/.." />
<root url="file://E:/gopath/src/timpen" />
<root url="file://E:/gopath/src/golang.org" />
<root url="file://E:/gopath/src/bitbucket.org" />
<root url="file://E:/gopath/src/gopkg.in" />
<root url="file://E:/gopath/src/hotime" />
</SOURCES> </SOURCES>
<excluded> <excluded>
<root url="file://$PROJECT_DIR$" /> <root url="file://$PROJECT_DIR$" />

View File

@ -12,7 +12,7 @@ type Context struct {
tag int64 tag int64
Resp http.ResponseWriter Resp http.ResponseWriter
Req *http.Request Req *http.Request
App *App Application *Application
RouterString []string RouterString []string
Config Map Config Map
Db *HoTimeDB Db *HoTimeDB
@ -32,7 +32,7 @@ func (this *Context) GetTag() int64 {
//唯一标志 //唯一标志
func (this *Context) Mtd(router [3]string) Map { func (this *Context) Mtd(router [3]string) Map {
this.App.Router[router[0]][router[1]][router[2]](this) this.Application.Router[router[0]][router[1]][router[2]](this)
d := this.resp d := this.resp
this.resp = nil this.resp = nil
return d return d

View File

@ -300,7 +300,7 @@ func Round(f float64, n int) float64 {
// CacheMemIns.Init(Config["cacheConfig"].(Map)["memory"].(CacheConfg).Time) // CacheMemIns.Init(Config["cacheConfig"].(Map)["memory"].(CacheConfg).Time)
// CacheDBIns.Init(Config["cacheConfig"].(Map)["db"].(CacheConfg).Time) // CacheDBIns.Init(Config["cacheConfig"].(Map)["db"].(CacheConfg).Time)
//} //}
func run(a *App) { func run(a *Application) {
if !IsRun { if !IsRun {
http.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) { http.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) {

2
var.go
View File

@ -10,7 +10,7 @@ import "sync"
var mutex = map[interface{}]*sync.RWMutex{} //安全锁 var mutex = map[interface{}]*sync.RWMutex{} //安全锁
var mutexer = sync.RWMutex{} //读写锁 var mutexer = sync.RWMutex{} //读写锁
var IsRun = false //当前状态 var IsRun = false //当前状态
var application = map[string]*App{} //整个项目 var application = map[string]*Application{} //整个项目
//var Db = HoTimeDB{} //数据库实例 //var Db = HoTimeDB{} //数据库实例