Browse Source

解决回滚逻辑

wangfei 6 years ago
parent
commit
71656d84ca
1 changed files with 2 additions and 2 deletions
  1. 2
    2
      controllers/context.go

+ 2
- 2
controllers/context.go View File

@@ -25,9 +25,9 @@ func (c *BaseController) initContext() {
25 25
 // initContext 销毁 Context
26 26
 func (c *BaseController) destroyContext(ok ...bool) {
27 27
 	if len(ok) == 0 || ok[0] {
28
-		c.Context.DB.Rollback()
29
-	} else {
30 28
 		c.Context.DB.Commit()
29
+	} else {
30
+		c.Context.DB.Rollback()
31 31
 	}
32 32
 
33 33
 	c.Context.Destroy()