Merge branch 'develop' of gitee.com:fusenpack/fusenapi into develop
This commit is contained in:
commit
28076f2441
|
@ -90,12 +90,13 @@ func (l *defaultImageHandle) LogoInfoSet(ctx context.Context, in *LogoInfoSetReq
|
|||
postMap := make(map[string]string, 2)
|
||||
postMap["logo_url"] = in.LogoUrl
|
||||
postMap["version"] = in.Version
|
||||
postMap["is_all_template"] = "0"
|
||||
|
||||
if in.Debug != nil && in.Debug.IsAllTemplateTag == 1 {
|
||||
postMap["is_all_template"] = "1"
|
||||
} else {
|
||||
postMap["is_all_template"] = "0"
|
||||
}
|
||||
// if in.Debug != nil && in.Debug.IsAllTemplateTag == 1 {
|
||||
// postMap["is_all_template"] = "1"
|
||||
// } else {
|
||||
// postMap["is_all_template"] = "0"
|
||||
// }
|
||||
|
||||
logc.Infof(ctx, "算法请求--LOGO基础信息--开始时间:%v", time.Now().UTC())
|
||||
err := curl.NewClient(ctx, &curl.Config{
|
||||
|
|
|
@ -1677,79 +1677,6 @@ func (d *defaultOrder) Create(ctx context.Context, in *CreateReq) (res *CreateRe
|
|||
func (d *defaultOrder) OrderShoppingCartSnapshotHandler(ctx context.Context, req *string) (res map[string]interface{}, err error) {
|
||||
var snapshot map[string]interface{}
|
||||
json.Unmarshal([]byte(*req), &snapshot)
|
||||
// snapshotFittingInfoData, snapshotFittingInfoEx := snapshot["fitting_info"]
|
||||
// var fittingInfoMap map[string]interface{}
|
||||
// if snapshotFittingInfoEx {
|
||||
// var snapshotFittingInfoJson map[string]interface{}
|
||||
// var fittingName string
|
||||
// snapshotFittingInfo := snapshotFittingInfoData.(map[string]interface{})
|
||||
// snapshotFittingInfoJsonData, snapshotFittingInfoJsonEx := snapshotFittingInfo["fitting_json"]
|
||||
// if snapshotFittingInfoJsonEx {
|
||||
// json.Unmarshal([]byte(snapshotFittingInfoJsonData.(string)), &snapshotFittingInfoJson)
|
||||
// }
|
||||
// fittingNameData, fittingNameEx := snapshotFittingInfo["fitting_name"]
|
||||
// if fittingNameEx {
|
||||
// fittingName = fittingNameData.(string)
|
||||
// }
|
||||
// fittingInfoMap = make(map[string]interface{}, 2)
|
||||
// fittingInfoMap["fitting_json"] = snapshotFittingInfoJson
|
||||
// fittingInfoMap["fitting_name"] = fittingName
|
||||
// }
|
||||
// snapshot["fitting_info"] = fittingInfoMap
|
||||
|
||||
// snapshotModelInfoData, snapshotModelInfoEx := snapshot["model_info"]
|
||||
// var modelInfoMap map[string]interface{}
|
||||
// if snapshotModelInfoEx {
|
||||
// var snapshotModelInfoJson map[string]interface{}
|
||||
// snapshotModelInfo := snapshotModelInfoData.(map[string]interface{})
|
||||
// snapshotModelInfoJsonData, snapshotModelInfoJsonEx := snapshotModelInfo["model_json"]
|
||||
// if snapshotModelInfoJsonEx {
|
||||
// json.Unmarshal([]byte(snapshotModelInfoJsonData.(string)), &snapshotModelInfoJson)
|
||||
// }
|
||||
// modelInfoMap = make(map[string]interface{}, 1)
|
||||
// modelInfoMap["model_json"] = snapshotModelInfoJson
|
||||
// }
|
||||
// snapshot["model_info"] = modelInfoMap
|
||||
|
||||
// snapshotTemplateInfoData, snapshotTemplateInfoEx := snapshot["template_info"]
|
||||
// var templateInfoMap map[string]interface{}
|
||||
// if snapshotTemplateInfoEx {
|
||||
// var snapshotTemplateInfoJson map[string]interface{}
|
||||
// var templateTag string
|
||||
// snapshotTemplateInfo := snapshotTemplateInfoData.(map[string]interface{})
|
||||
// snapshotTemplateInfoJsonData, snapshotTemplateInfoJsonEx := snapshotTemplateInfo["template_json"]
|
||||
// if snapshotTemplateInfoJsonEx {
|
||||
// json.Unmarshal([]byte(snapshotTemplateInfoJsonData.(string)), &snapshotTemplateInfoJson)
|
||||
// }
|
||||
// templateTagData, templateTagEx := snapshotTemplateInfo["template_tag"]
|
||||
// if templateTagEx {
|
||||
// templateTag = templateTagData.(string)
|
||||
// }
|
||||
// templateInfoMap = make(map[string]interface{}, 2)
|
||||
// templateInfoMap["template_json"] = snapshotTemplateInfoJson
|
||||
// templateInfoMap["template_tag"] = templateTag
|
||||
// }
|
||||
// snapshot["template_info"] = templateInfoMap
|
||||
|
||||
// snapshotLightInfoData, snapshotLightInfoEx := snapshot["light_info"]
|
||||
// var lightInfoMap map[string]interface{}
|
||||
// if snapshotLightInfoEx {
|
||||
// var snapshotLightInfoJson map[string]interface{}
|
||||
// var lightTag string
|
||||
// snapshotLightInfo := snapshotLightInfoData.(map[string]interface{})
|
||||
// snapshotLightInfoJsonData, snapshotLightInfoJsonEx := snapshotLightInfo["light_json"]
|
||||
// if snapshotLightInfoJsonEx {
|
||||
// json.Unmarshal([]byte(snapshotLightInfoJsonData.(string)), &snapshotLightInfoJson)
|
||||
// }
|
||||
// lightTagData, lightTagEx := snapshotLightInfo["light_tag"]
|
||||
// if lightTagEx {
|
||||
// lightTag = lightTagData.(string)
|
||||
// }
|
||||
// lightInfoMap = make(map[string]interface{}, 2)
|
||||
// lightInfoMap["light_json"] = snapshotLightInfoJson
|
||||
// lightInfoMap["light_tag"] = lightTag
|
||||
// }
|
||||
// snapshot["light_info"] = lightInfoMap
|
||||
return snapshot, nil
|
||||
}
|
||||
|
||||
|
@ -1824,10 +1751,10 @@ func (d *defaultOrder) OrderDetailHandler(ctx context.Context, orderInfo *gmodel
|
|||
if original == 1 {
|
||||
orderDetail.DeliveryAddress = orderAddress
|
||||
orderDetail.OrderAmount = orderAmount
|
||||
orderDetail.OrderAmount.Deposit.PayAmount = order.GetAmountInfoFormat(&orderAmount.Deposit.PayAmount)
|
||||
orderDetail.OrderAmount.RemainingBalance.PayAmount = order.GetAmountInfoFormat(&orderAmount.RemainingBalance.PayAmount)
|
||||
orderDetail.OrderAmount.Subtotal = order.GetAmountInfoFormat(&orderAmount.Subtotal)
|
||||
orderDetail.OrderAmount.Total = order.GetAmountInfoFormat(&orderAmount.Total)
|
||||
orderDetail.OrderAmount.Deposit.PayAmount = order.GetAmountInfoFormat(&orderAmount.Deposit.PayAmount, true)
|
||||
orderDetail.OrderAmount.RemainingBalance.PayAmount = order.GetAmountInfoFormat(&orderAmount.RemainingBalance.PayAmount, true)
|
||||
orderDetail.OrderAmount.Subtotal = order.GetAmountInfoFormat(&orderAmount.Subtotal, true)
|
||||
orderDetail.OrderAmount.Total = order.GetAmountInfoFormat(&orderAmount.Total, true)
|
||||
orderDetail.PayStatus = constants.OrderPayStatusCode(*orderInfo.PayStatus)
|
||||
orderDetail.PayTimeout = time.Duration(orderInfo.Ctime.Add(30*time.Minute).UTC().Unix() - time.Now().UTC().Unix())
|
||||
orderDetail.OrderInfo = gmodel.OrderInfo{
|
||||
|
@ -1884,8 +1811,8 @@ func (d *defaultOrder) OrderDetailHandler(ctx context.Context, orderInfo *gmodel
|
|||
}
|
||||
|
||||
orderProductItem := gmodel.OrderProduct{
|
||||
TotalPrice: order.GetAmountInfoFormat(&productValue.TotalPrice),
|
||||
ItemPrice: order.GetAmountInfoFormat(&productValue.ItemPrice),
|
||||
TotalPrice: order.GetAmountInfoFormat(&productValue.TotalPrice, true),
|
||||
ItemPrice: order.GetAmountInfoFormat(&productValue.ItemPrice, true),
|
||||
|
||||
ProductId: productValue.ProductId,
|
||||
ProductSn: productValue.ProductSn,
|
||||
|
@ -1894,7 +1821,7 @@ func (d *defaultOrder) OrderDetailHandler(ctx context.Context, orderInfo *gmodel
|
|||
ProductCoverMetadata: productValue.ProductCoverMetadata,
|
||||
ShoppingCartSnapshot: &shoppingCartSnapshotData,
|
||||
ExpectedDeliveryTime: &expectedDeliveryTime,
|
||||
PurchaseQuantity: *productValue.PurchaseQuantity,
|
||||
PurchaseQuantity: order.GetPurchaseQuantity(productValue.PurchaseQuantity, true),
|
||||
|
||||
DiyInformation: productValue.DiyInformation,
|
||||
SizeInfo: productValue.SizeInfo,
|
||||
|
|
|
@ -90,34 +90,50 @@ type GetAmountCurrencyUSDReq struct {
|
|||
}
|
||||
|
||||
// 处理金额(元)
|
||||
func GetAmountCurrencyFormat(req *gmodel.AmountCurrency) (res gmodel.AmountCurrency) {
|
||||
func GetAmountCurrencyFormat(req *gmodel.AmountCurrency, withThousandthPercentile bool) (res gmodel.AmountCurrency) {
|
||||
var currentAmount = format.CentitoDollarStr(req.CurrentAmount.(float64))
|
||||
if withThousandthPercentile {
|
||||
currentAmount = format.NumToStringWithThousandthPercentile(currentAmount)
|
||||
}
|
||||
|
||||
var originalAmount = format.CentitoDollarStr(req.OriginalAmount.(float64))
|
||||
if withThousandthPercentile {
|
||||
originalAmount = format.NumToStringWithThousandthPercentile(originalAmount)
|
||||
}
|
||||
|
||||
return gmodel.AmountCurrency{
|
||||
ExchangeRate: format.CentitoDollarStr(req.ExchangeRate.(float64)),
|
||||
CurrentAmount: format.CentitoDollarStr(req.CurrentAmount.(float64)),
|
||||
OriginalAmount: format.CentitoDollarStr(req.OriginalAmount.(float64)),
|
||||
ExchangeRate: req.ExchangeRate.(float64),
|
||||
CurrentAmount: currentAmount,
|
||||
OriginalAmount: originalAmount,
|
||||
CurrentCurrency: req.CurrentCurrency,
|
||||
OriginalCurrency: req.OriginalCurrency,
|
||||
}
|
||||
}
|
||||
|
||||
// 处理金额(元)
|
||||
func GetAmountInfoFormat(req *gmodel.AmountInfo) gmodel.AmountInfo {
|
||||
Current := GetAmountCurrencyFormat(&req.Current)
|
||||
fmt.Println(Current)
|
||||
func GetAmountInfoFormat(req *gmodel.AmountInfo, withThousandthPercentile bool) gmodel.AmountInfo {
|
||||
return gmodel.AmountInfo{
|
||||
Change: GetAmountCurrencyFormat(&req.Change),
|
||||
Change: GetAmountCurrencyFormat(&req.Change, withThousandthPercentile),
|
||||
ChangeRemark: req.ChangeRemark,
|
||||
Current: GetAmountCurrencyFormat(&req.Current),
|
||||
Initiate: GetAmountCurrencyFormat(&req.Initiate),
|
||||
Current: GetAmountCurrencyFormat(&req.Current, withThousandthPercentile),
|
||||
Initiate: GetAmountCurrencyFormat(&req.Initiate, withThousandthPercentile),
|
||||
Metadata: req.Metadata,
|
||||
}
|
||||
}
|
||||
|
||||
// 处理商品数量
|
||||
func GetPurchaseQuantity(req *gmodel.PurchaseQuantity) gmodel.PurchaseQuantity {
|
||||
func GetPurchaseQuantity(req *gmodel.PurchaseQuantity, withThousandthPercentile bool) gmodel.PurchaseQuantity {
|
||||
var initiate = strconv.FormatInt(int64(req.Initiate.(float64)), 10)
|
||||
if withThousandthPercentile {
|
||||
initiate = format.NumToStringWithThousandthPercentile(initiate)
|
||||
}
|
||||
var current = strconv.FormatInt(int64(req.Current.(float64)), 10)
|
||||
if withThousandthPercentile {
|
||||
current = format.NumToStringWithThousandthPercentile(current)
|
||||
}
|
||||
return gmodel.PurchaseQuantity{
|
||||
Initiate: strconv.FormatInt(int64(req.Initiate.(float64)), 10),
|
||||
Current: strconv.FormatInt(int64(req.Current.(float64)), 10),
|
||||
Initiate: initiate,
|
||||
Current: current,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user