|
@@ -41,21 +41,8 @@ func CancalUserIntegralExchange(queue md.MqQueue) { |
|
|
err = handleCancalUserIntegralExchange(res.Body) |
|
|
err = handleCancalUserIntegralExchange(res.Body) |
|
|
//_ = res.Reject(false) |
|
|
//_ = res.Reject(false) |
|
|
fmt.Println(err) |
|
|
fmt.Println(err) |
|
|
if err == nil { |
|
|
|
|
|
_ = res.Ack(true) |
|
|
|
|
|
} else { |
|
|
|
|
|
var canalMsg *md.ZhiosAcquisition |
|
|
|
|
|
var tmpString string |
|
|
|
|
|
err := json.Unmarshal(res.Body, &tmpString) |
|
|
|
|
|
if err == nil { |
|
|
|
|
|
fmt.Println(tmpString) |
|
|
|
|
|
err = json.Unmarshal([]byte(tmpString), &canalMsg) |
|
|
|
|
|
if err == nil { |
|
|
|
|
|
ch.Publish(queue.ExchangeName, utils.SerializeStr(canalMsg), queue.RoutKey) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
_ = res.Ack(true) |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
} else { |
|
|
panic(errors.New("error getting message")) |
|
|
panic(errors.New("error getting message")) |
|
|
} |
|
|
} |
|
@@ -96,7 +83,7 @@ func handleCancalUserIntegralExchange(msg []byte) error { |
|
|
err := CoinExchange(eg, sess, utils.StrToInt(uid), utils.IntToStr(base.CoinId), "cny", amount.Amount, mid) |
|
|
err := CoinExchange(eg, sess, utils.StrToInt(uid), utils.IntToStr(base.CoinId), "cny", amount.Amount, mid) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
sess.Rollback() |
|
|
sess.Rollback() |
|
|
return err |
|
|
|
|
|
|
|
|
return nil |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
sess.Commit() |
|
|
sess.Commit() |
|
|