fix:订单详情
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
"fusenapi/constants"
|
||||
"fusenapi/model/gmodel"
|
||||
"fusenapi/utils/format"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -87,21 +88,29 @@ type GetAmountCurrencyUSDReq struct {
|
||||
OriginalCurrency string `json:"original_currency"` // 原始货币
|
||||
}
|
||||
|
||||
type GetAmountCurrencyUSDRes struct {
|
||||
ExchangeRate string `json:"exchange_rate"` // 换算汇率
|
||||
CurrentAmount string `json:"current_amount"` // 当前金额
|
||||
OriginalAmount string `json:"original_amount"` // 原始金额
|
||||
CurrentCurrency string `json:"current_currency"` // 当前货币
|
||||
OriginalCurrency string `json:"original_currency"` // 原始货币
|
||||
}
|
||||
|
||||
// 处理金额(美元)
|
||||
func GetAmountCurrencyUSD(req *GetAmountCurrencyUSDReq) (res GetAmountCurrencyUSDRes) {
|
||||
return GetAmountCurrencyUSDRes{
|
||||
ExchangeRate: fmt.Sprintf("%.2f", float64(req.ExchangeRate)/1000),
|
||||
// 处理金额(元)
|
||||
func GetAmountCurrencyFormat(req *gmodel.AmountCurrency) (res gmodel.AmountCurrency) {
|
||||
return gmodel.AmountCurrency{
|
||||
ExchangeRate: format.CentitoDollarStr(req.ExchangeRate.(int64)),
|
||||
CurrentAmount: format.CentitoDollarStr(req.CurrentAmount.(int64)),
|
||||
OriginalAmount: format.CentitoDollarStr(req.OriginalAmount.(int64)),
|
||||
CurrentCurrency: req.CurrentCurrency,
|
||||
OriginalCurrency: req.OriginalCurrency,
|
||||
}
|
||||
}
|
||||
|
||||
// 处理金额(元)
|
||||
func GetAmountInfoFormat(req *gmodel.AmountInfo) gmodel.AmountInfo {
|
||||
return gmodel.AmountInfo{
|
||||
Change: GetAmountCurrencyFormat(&req.Change),
|
||||
ChangeRemark: req.ChangeRemark,
|
||||
Current: GetAmountCurrencyFormat(&req.Current),
|
||||
Initiate: GetAmountCurrencyFormat(&req.Initiate),
|
||||
Metadata: req.Metadata,
|
||||
}
|
||||
}
|
||||
|
||||
// 生成订单编号
|
||||
func GenerateOrderNumber() string {
|
||||
t := time.Now()
|
||||
orderNumber := fmt.Sprintf("%d%02d%02d%08d", t.Year(), t.Month(), t.Day(), t.UnixNano()%100000000)
|
||||
@@ -131,6 +140,26 @@ func GenerateOrderStatusLink(deliveryMethod int64, noTime time.Time, expectedTim
|
||||
return list
|
||||
}
|
||||
|
||||
// 获取订单状态
|
||||
func GetOrderStatusLinkUser(deliveryMethod int64, statusLink []gmodel.OrderStatus) []gmodel.OrderStatus {
|
||||
var list []gmodel.OrderStatus
|
||||
|
||||
var orderStatus []constants.OrderStatusCode
|
||||
if deliveryMethod == constants.DELIVERYMETHODDIRECTMAIL {
|
||||
orderStatus = constants.OrderStatusUserDIRECTMAIL
|
||||
} else {
|
||||
orderStatus = constants.OrderStatusUserCLOUDSTORE
|
||||
}
|
||||
for _, v := range statusLink {
|
||||
for _, orderStatusCode := range orderStatus {
|
||||
if v.StatusCode == orderStatusCode {
|
||||
list = append(list, v)
|
||||
}
|
||||
}
|
||||
}
|
||||
return list
|
||||
}
|
||||
|
||||
// 获取订单当前状态
|
||||
func GenerateOrderStatusCurrent() gmodel.OrderStatus {
|
||||
return gmodel.OrderStatus{}
|
||||
|
||||
Reference in New Issue
Block a user