fix xa test
This commit is contained in:
parent
ced9d1de56
commit
62d7509ff4
15
README.md
15
README.md
@ -81,9 +81,9 @@ Configure mysql:
|
||||
|
||||
Refer to [examples/quick_start.go](./examples/quick_start.go)
|
||||
|
||||
## [sub-transaction barrier](./doc/barrier-en.md)
|
||||
### [sub-transaction barrier](./doc/barrier-en.md)
|
||||
|
||||
## [protocol](./doc/protocol-en.md)
|
||||
### [protocol](./doc/protocol-en.md)
|
||||
|
||||
### Wechat Group
|
||||
|
||||
@ -98,3 +98,14 @@ If you think this project is good, or helpful to you, please give a star!
|
||||
<img alt='ivydad' height='40' src='https://www.ivydad.com/_nuxt/img/header-logo.2645ad5.png' /img>
|
||||
<img alt='eglass' height='40' src='https://img.epeijing.cn/official-website/assets/logo.png' /img>
|
||||
</div>
|
||||
|
||||
### Following is keyword for SEO
|
||||
|
||||
分布式事务框架
|
||||
|
||||
事务消息
|
||||
|
||||
可靠消息
|
||||
|
||||
微服务
|
||||
|
||||
|
||||
@ -65,7 +65,7 @@ func XaFireRequest() string {
|
||||
func xaTransIn(c *gin.Context) (interface{}, error) {
|
||||
err := XaClient.XaLocalTransaction(c, func(db *common.DB, xa *dtmcli.Xa) (rerr error) {
|
||||
req := reqFrom(c)
|
||||
if req.TransInResult != "SUCCESS" {
|
||||
if req.TransInResult == "FAILURE" {
|
||||
return fmt.Errorf("tranIn FAILURE")
|
||||
}
|
||||
dbr := db.Exec("update user_account set balance=balance+? where user_id=?", req.Amount, 2)
|
||||
@ -81,7 +81,7 @@ func xaTransIn(c *gin.Context) (interface{}, error) {
|
||||
func xaTransOut(c *gin.Context) (interface{}, error) {
|
||||
err := XaClient.XaLocalTransaction(c, func(db *common.DB, xa *dtmcli.Xa) (rerr error) {
|
||||
req := reqFrom(c)
|
||||
if req.TransOutResult != "SUCCESS" {
|
||||
if req.TransOutResult == "FAILURE" {
|
||||
return fmt.Errorf("tranOut failed")
|
||||
}
|
||||
dbr := db.Exec("update user_account set balance=balance-? where user_id=?", req.Amount, 1)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user