✨ Multi-currency
This commit is contained in:
@@ -24,4 +24,5 @@ type Order struct {
|
||||
Transaction *Transaction `json:"transaction"`
|
||||
TransactionID *uint `json:"transaction_id"`
|
||||
ClientID *uint `json:"client_id"`
|
||||
Currency string `json:"currency"`
|
||||
}
|
||||
|
@@ -10,12 +10,13 @@ import (
|
||||
type Transaction struct {
|
||||
cruda.BaseModel
|
||||
|
||||
Remark string `json:"remark"` // The usage of this transaction
|
||||
Amount decimal.Decimal `json:"amount" type:"decimal(30,2);"`
|
||||
Payer *Wallet `json:"payer" foreignKey:"PayerID"` // Who give the money
|
||||
Payee *Wallet `json:"payee" foreignKey:"PayeeID"` // Who get the money
|
||||
PayerID *uint `json:"payer_id"` // Leave this field as nil means pay from the system
|
||||
PayeeID *uint `json:"payee_id"` // Leave this field as nil means pay to the system
|
||||
Remark string `json:"remark"` // The usage of this transaction
|
||||
Amount decimal.Decimal `json:"amount" type:"decimal(30,2);"`
|
||||
Currency string `json:"currency" gorm:"default:'normal'"`
|
||||
Payer *Wallet `json:"payer" foreignKey:"PayerID"` // Who give the money
|
||||
Payee *Wallet `json:"payee" foreignKey:"PayeeID"` // Who get the money
|
||||
PayerID *uint `json:"payer_id"` // Leave this field as nil means pay from the system
|
||||
PayeeID *uint `json:"payee_id"` // Leave this field as nil means pay to the system
|
||||
}
|
||||
|
||||
func (v *Transaction) ToTransactionInfo() *proto.TransactionInfo {
|
||||
|
@@ -9,9 +9,10 @@ import (
|
||||
type Wallet struct {
|
||||
cruda.BaseModel
|
||||
|
||||
Balance decimal.Decimal `json:"balance" sql:"type:decimal(30,2);"`
|
||||
Password string `json:"password"`
|
||||
AccountID uint `json:"account_id"`
|
||||
Balance decimal.Decimal `json:"balance" sql:"type:decimal(30,2);"`
|
||||
GoldenBalance decimal.Decimal `json:"golden_balance" sql:"type:decimal(30,2);"`
|
||||
Password string `json:"password"`
|
||||
AccountID uint `json:"account_id"`
|
||||
}
|
||||
|
||||
func (v *Wallet) ToWalletInfo() *proto.WalletInfo {
|
||||
|
Reference in New Issue
Block a user