- refactor

- load pending orders, fixed bug.
This commit is contained in:
gazebo
2018-07-22 00:19:38 +08:00
parent b9e59e1197
commit 77c1dd07b5
18 changed files with 168 additions and 145 deletions

View File

@@ -140,7 +140,7 @@ func (c *OrderController) getOrderInfo(orderID string) (order *model.GoodsOrder,
ExpectedDeliveredTime: utils.Str2TimeWithDefault(utils.Interface2String(result["deliverTime"]), utils.DefaultTimeValue),
VendorStatus: utils.Interface2String(result["status"]), // 取订单的原始status不合并消息类型因为当前消息类型没有意义
OrderSeq: int(utils.MustInterface2Int64(result["daySn"])),
OrderCreatedAt: utils.Str2Time(result["createdAt"].(string)),
StatusTime: utils.Str2Time(result["createdAt"].(string)),
OriginalData: utils.FilterMb4(string(utils.MustMarshal(result))),
ActualPayPrice: jxutils.StandardPrice2Int(utils.MustInterface2Float64(result["totalPrice"])),
Skus: []*model.OrderSku{},
@@ -157,15 +157,14 @@ func (c *OrderController) getOrderInfo(orderID string) (order *model.GoodsOrder,
for _, product2 := range group["items"].([]interface{}) {
product := product2.(map[string]interface{})
sku := &model.OrderSku{
VendorOrderID: orderID,
VendorID: model.VendorIDELM,
Count: int(utils.MustInterface2Int64(product["quantity"])),
SkuID: int(utils.Str2Int64WithDefault(utils.Interface2String(product["extendCode"]), 0)),
VendorSkuID: utils.Int64ToStr(utils.MustInterface2Int64(product["skuId"])),
SkuName: product["name"].(string),
SalePrice: jxutils.StandardPrice2Int(utils.MustInterface2Float64(product["userPrice"])),
Weight: int(math.Round(utils.Interface2FloatWithDefault(product["weight"], 0.0))),
OrderCreatedAt: order.OrderCreatedAt,
VendorOrderID: orderID,
VendorID: model.VendorIDELM,
Count: int(utils.MustInterface2Int64(product["quantity"])),
SkuID: int(utils.Str2Int64WithDefault(utils.Interface2String(product["extendCode"]), 0)),
VendorSkuID: utils.Int64ToStr(utils.MustInterface2Int64(product["skuId"])),
SkuName: product["name"].(string),
SalePrice: jxutils.StandardPrice2Int(utils.MustInterface2Float64(product["userPrice"])),
Weight: int(math.Round(utils.Interface2FloatWithDefault(product["weight"], 0.0))),
}
order.Skus = append(order.Skus, sku)
order.SkuCount++