diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 81f65c1..4ed696e 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -6,7 +6,10 @@
+
+
+
@@ -18,6 +21,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -55,27 +71,29 @@
-
+
-
+
-
-
-
+
+
+
+
+
-
+
-
-
+
+
@@ -83,6 +101,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -93,38 +131,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -158,20 +164,20 @@
-
-
+
+
@@ -637,7 +643,7 @@
-
+
1500458878821
@@ -751,11 +757,18 @@
1503454064456
-
+
+ 1503454197179
+
+
+
+ 1503454197179
+
+
-
+
@@ -775,11 +788,11 @@
-
+
-
+
@@ -806,15 +819,7 @@
-
-
- file://$PROJECT_DIR$/example/main.go
- 16
-
-
-
-
-
+
@@ -1024,24 +1029,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1068,14 +1055,6 @@
-
-
-
-
-
-
-
-
@@ -1152,14 +1131,6 @@
-
-
-
-
-
-
-
-
@@ -1176,14 +1147,6 @@
-
-
-
-
-
-
-
-
@@ -1195,15 +1158,60 @@
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/config/config.json b/config/config.json
index efbdac0..3d4ee02 100644
--- a/config/config.json
+++ b/config/config.json
@@ -12,7 +12,7 @@
],
"error": {},
"logLevel": 0,
- "port": "8080",
+ "port": "80",
"sessionName": "HOTIME",
"tpt": "tpt"
}
\ No newline at end of file
diff --git a/db.go b/db.go
index d95072d..80f65cc 100644
--- a/db.go
+++ b/db.go
@@ -43,12 +43,12 @@ func (this *HoTimeDB) Action(action func() bool) bool {
if !result {
this.Tx.Rollback()
this.Tx = nil
- return true
+ return result
}
this.Tx.Commit()
this.Tx = nil
- return true
+ return result
}
func (this *HoTimeDB) InitDb(err ...*Error) Error {
diff --git a/example/main.go b/example/main.go
index 1808146..9344ca6 100644
--- a/example/main.go
+++ b/example/main.go
@@ -50,11 +50,13 @@ func main() {
"index": hotime.Ctr{
"test": func(this *hotime.Context) {
fmt.Println(this.Db.GetTag())
- this.Db.Action(func() bool {
+ x:=this.Db.Action(func() bool {
- return true
+ this.Db.Insert("user",hotime.Map{"unickname":"dasdas"})
+
+ return false
})
- this.Display(5, "chenggong")
+ this.Display(5, x)
},
"websocket": func(this *hotime.Context) {
hdler := websocket.Handler(func(ws *websocket.Conn) {
diff --git a/func.go b/func.go
index 23b8b70..bd5884d 100644
--- a/func.go
+++ b/func.go
@@ -304,8 +304,11 @@ func run(a *Application) {
if !IsRun {
http.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) {
- port := Substr(req.Host, IndexLastStr(req.Host, ":")+1, len(req.Host))
- //fmt.Println(port)
+ port:="80"
+ if IndexLastStr(req.Host, ":")!=-1{
+ port = Substr(req.Host, IndexLastStr(req.Host, ":")+1, len(req.Host))
+ }
+
if application[port] != nil {
application[port].handler(w, req)
}