Commit 9e643334 authored by wangp's avatar wangp

lakala

parent db77506e
...@@ -60,6 +60,7 @@ func UnifiedOrder(input *models.PlaceAnOrderParamInput, ip string) (interface{}, ...@@ -60,6 +60,7 @@ func UnifiedOrder(input *models.PlaceAnOrderParamInput, ip string) (interface{},
billID, err := InsertPayBill(tx, input, orderID) billID, err := InsertPayBill(tx, input, orderID)
if err != nil { if err != nil {
tx.Rollback()
return nil, err return nil, err
} }
...@@ -214,6 +215,7 @@ func UnifiedOrder(input *models.PlaceAnOrderParamInput, ip string) (interface{}, ...@@ -214,6 +215,7 @@ func UnifiedOrder(input *models.PlaceAnOrderParamInput, ip string) (interface{},
} else if input.SourceCode==9 { } else if input.SourceCode==9 {
//聚合被扫(扫码枪) //聚合被扫(扫码枪)
if input.DynamicID=="" { if input.DynamicID=="" {
tx.Rollback()
return nil, errors.New("输入项「dynamic_id」为空错误") return nil, errors.New("输入项「dynamic_id」为空错误")
} }
...@@ -240,6 +242,7 @@ func UnifiedOrder(input *models.PlaceAnOrderParamInput, ip string) (interface{}, ...@@ -240,6 +242,7 @@ func UnifiedOrder(input *models.PlaceAnOrderParamInput, ip string) (interface{},
data["req_data"] = data2 data["req_data"] = data2
} else { } else {
tx.Rollback()
return nil, errors.New("输入参数「source_code」错误,有效值为[1-6,9,15-17]") return nil, errors.New("输入参数「source_code」错误,有效值为[1-6,9,15-17]")
} }
//数据重组 - end //数据重组 - end
...@@ -251,6 +254,7 @@ func UnifiedOrder(input *models.PlaceAnOrderParamInput, ip string) (interface{}, ...@@ -251,6 +254,7 @@ func UnifiedOrder(input *models.PlaceAnOrderParamInput, ip string) (interface{},
// 插入下单请求参数 // 插入下单请求参数
err = InsertPayBillDetailRequestBody(tx, billID, data) err = InsertPayBillDetailRequestBody(tx, billID, data)
if err != nil { if err != nil {
tx.Rollback()
return nil, err return nil, err
} }
...@@ -258,6 +262,7 @@ func UnifiedOrder(input *models.PlaceAnOrderParamInput, ip string) (interface{}, ...@@ -258,6 +262,7 @@ func UnifiedOrder(input *models.PlaceAnOrderParamInput, ip string) (interface{},
if err != nil { if err != nil {
//this.Data["json"] = utils.CheckError(errors.New("Map转化为byte数组失败"),"异常") //this.Data["json"] = utils.CheckError(errors.New("Map转化为byte数组失败"),"异常")
//this.ServeJSON() //this.ServeJSON()
tx.Rollback()
return nil, err return nil, err
} }
...@@ -277,6 +282,7 @@ func UnifiedOrder(input *models.PlaceAnOrderParamInput, ip string) (interface{}, ...@@ -277,6 +282,7 @@ func UnifiedOrder(input *models.PlaceAnOrderParamInput, ip string) (interface{},
err, response, lakala_rtn := lakala_post(input, url, orderID, data_json) err, response, lakala_rtn := lakala_post(input, url, orderID, data_json)
if err != nil { if err != nil {
InsertPayBillDetailResponseBody(tx, billID, lakala_rtn) //todo InsertPayBillDetailResponseBody(tx, billID, lakala_rtn) //todo
tx.Rollback()
return nil, err return nil, err
} }
...@@ -284,9 +290,11 @@ func UnifiedOrder(input *models.PlaceAnOrderParamInput, ip string) (interface{}, ...@@ -284,9 +290,11 @@ func UnifiedOrder(input *models.PlaceAnOrderParamInput, ip string) (interface{},
err = InsertPayBillDetailResponseBody(tx, billID, lakala_rtn) err = InsertPayBillDetailResponseBody(tx, billID, lakala_rtn)
if err != nil { if err != nil {
//beego.Error("下单请求成功 --- 但插入成功后的参数失败") //beego.Error("下单请求成功 --- 但插入成功后的参数失败")
tx.Rollback()
return nil, err return nil, err
} }
tx.Commit()
return response, nil return response, nil
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment