- don't call FilterMb4 when saving order, instead call FilterMb4 when create waybill.

This commit is contained in:
gazebo
2018-10-31 11:53:35 +08:00
parent f0cd9aee08
commit 0e09f42468
6 changed files with 19 additions and 20 deletions

View File

@@ -101,8 +101,8 @@ func (c *DeliveryHandler) CreateWaybill(order *model.GoodsOrder, policy func(del
OriginID: jxutils.ComposeUniversalOrderID(order.VendorOrderID, order.VendorID), OriginID: jxutils.ComposeUniversalOrderID(order.VendorOrderID, order.VendorID),
CargoPrice: jxutils.IntPrice2Standard(order.ActualPayPrice), CargoPrice: jxutils.IntPrice2Standard(order.ActualPayPrice),
IsPrepay: 0, IsPrepay: 0,
ReceiverName: order.ConsigneeName, ReceiverName: utils.FilterMb4(order.ConsigneeName),
ReceiverAddress: order.ConsigneeAddress, ReceiverAddress: utils.FilterMb4(order.ConsigneeAddress),
ReceiverPhone: order.ConsigneeMobile, ReceiverPhone: order.ConsigneeMobile,
} }
if billParams.CargoPrice > maxCargoPrice { if billParams.CargoPrice > maxCargoPrice {
@@ -112,7 +112,7 @@ func (c *DeliveryHandler) CreateWaybill(order *model.GoodsOrder, policy func(del
if billParams.CityCode, err = c.getDataCityCodeFromOrder(order, db); err == nil { if billParams.CityCode, err = c.getDataCityCodeFromOrder(order, db); err == nil {
billParams.ReceiverLng, billParams.ReceiverLat, _ = jxutils.IntCoordinate2MarsStandard(order.ConsigneeLng, order.ConsigneeLat, order.CoordinateType) billParams.ReceiverLng, billParams.ReceiverLat, _ = jxutils.IntCoordinate2MarsStandard(order.ConsigneeLng, order.ConsigneeLat, order.CoordinateType)
addParams := map[string]interface{}{ addParams := map[string]interface{}{
"info": order.BuyerComment, "info": utils.FilterMb4(order.BuyerComment),
// "origin_mark": model.VendorNames[order.VendorID], // "origin_mark": model.VendorNames[order.VendorID],
"origin_mark_no": fmt.Sprintf("%d", order.OrderSeq), "origin_mark_no": fmt.Sprintf("%d", order.OrderSeq),
"cargo_type": 13, "cargo_type": 13,

View File

@@ -211,8 +211,8 @@ func (c *DeliveryHandler) CreateWaybill(order *model.GoodsOrder, policy func(del
billParams := &mtpsapi.CreateOrderByShopParam{ billParams := &mtpsapi.CreateOrderByShopParam{
OrderID: jxutils.ComposeUniversalOrderID(order.VendorOrderID, order.VendorID), OrderID: jxutils.ComposeUniversalOrderID(order.VendorOrderID, order.VendorID),
DeliveryServiceCode: mtpsapi.DeliveryServiceCodeRapid, DeliveryServiceCode: mtpsapi.DeliveryServiceCodeRapid,
ReceiverName: order.ConsigneeName, ReceiverName: utils.FilterMb4(order.ConsigneeName),
ReceiverAddress: order.ConsigneeAddress, ReceiverAddress: utils.FilterMb4(order.ConsigneeAddress),
ReceiverPhone: order.ConsigneeMobile, ReceiverPhone: order.ConsigneeMobile,
CoordinateType: model.CoordinateTypeMars, CoordinateType: model.CoordinateTypeMars,
ReceiverLng: jxutils.StandardCoordinate2Int(lngFloat), ReceiverLng: jxutils.StandardCoordinate2Int(lngFloat),
@@ -243,7 +243,7 @@ func (c *DeliveryHandler) CreateWaybill(order *model.GoodsOrder, policy func(del
item.GoodCount += goodItem.GoodCount item.GoodCount += goodItem.GoodCount
} }
} }
addParams := utils.Params2Map("note", order.BuyerComment, "goods_detail", string(utils.MustMarshal(goods)), "poi_seq", fmt.Sprintf("#%d", order.OrderSeq)) addParams := utils.Params2Map("note", utils.FilterMb4(order.BuyerComment), "goods_detail", string(utils.MustMarshal(goods)), "poi_seq", fmt.Sprintf("#%d", order.OrderSeq))
result, err2 := api.MtpsAPI.CreateOrderByShop(billParams, addParams) result, err2 := api.MtpsAPI.CreateOrderByShop(billParams, addParams)
if err = err2; err != nil { if err = err2; err != nil {
globals.SugarLogger.Debugf("CreateWaybill failed, orderID:%s, billParams:%v, addParams:%v, error:%v", order.VendorOrderID, billParams, addParams, err) globals.SugarLogger.Debugf("CreateWaybill failed, orderID:%s, billParams:%v, addParams:%v, error:%v", order.VendorOrderID, billParams, addParams, err)

View File

@@ -1,7 +1,6 @@
package ebai package ebai
import ( import (
"strings"
"time" "time"
"git.rosy.net.cn/baseapi/platformapi/autonavi" "git.rosy.net.cn/baseapi/platformapi/autonavi"
@@ -44,16 +43,16 @@ func (p *PurchaseHandler) GetOrder(vendorOrderID string) (order *model.GoodsOrde
VendorStoreID: shopMap["baidu_shop_id"].(string), VendorStoreID: shopMap["baidu_shop_id"].(string),
StoreID: int(utils.Str2Int64WithDefault(utils.Interface2String(shopMap["id"]), 0)), StoreID: int(utils.Str2Int64WithDefault(utils.Interface2String(shopMap["id"]), 0)),
StoreName: shopMap["name"].(string), StoreName: shopMap["name"].(string),
ConsigneeName: utils.FilterMb4(userMap["name"].(string)), ConsigneeName: userMap["name"].(string),
ConsigneeMobile: userMap["phone"].(string), ConsigneeMobile: userMap["phone"].(string),
ConsigneeAddress: utils.FilterMb4(userMap["address"].(string)), ConsigneeAddress: userMap["address"].(string),
CoordinateType: model.CoordinateTypeBaiDu, CoordinateType: model.CoordinateTypeBaiDu,
BuyerComment: utils.FilterMb4(strings.Trim(utils.Interface2String(orderMap["remark"]), "\n\r\t ")), BuyerComment: utils.TrimBlanChar(utils.Interface2String(orderMap["remark"])),
ExpectedDeliveredTime: getTimeFromTimestampStr(utils.Interface2String(orderMap["send_time"])), ExpectedDeliveredTime: getTimeFromTimestampStr(utils.Interface2String(orderMap["send_time"])),
VendorStatus: utils.Int64ToStr(utils.MustInterface2Int64(orderMap["status"])), VendorStatus: utils.Int64ToStr(utils.MustInterface2Int64(orderMap["status"])),
OrderSeq: int(utils.Str2Int64(utils.Interface2String(orderMap["order_index"]))), OrderSeq: int(utils.Str2Int64(utils.Interface2String(orderMap["order_index"]))),
StatusTime: getTimeFromTimestampStr(utils.Interface2String(orderMap["create_time"])), StatusTime: getTimeFromTimestampStr(utils.Interface2String(orderMap["create_time"])),
OriginalData: utils.FilterMb4(string(utils.MustMarshal(result))), OriginalData: string(utils.MustMarshal(result)),
ActualPayPrice: utils.MustInterface2Int64(orderMap["user_fee"]), ActualPayPrice: utils.MustInterface2Int64(orderMap["user_fee"]),
Skus: []*model.OrderSku{}, Skus: []*model.OrderSku{},
} }

View File

@@ -477,7 +477,7 @@ func (p *PurchaseHandler) updateLocalCatAsNew(db *dao.DaoDB, localCatMap map[str
} }
func formatName(name string) string { func formatName(name string) string {
return strings.Trim(utils.FilterMb4(name), "\n\r\t ") return utils.TrimBlanChar(utils.FilterMb4(name))
} }
// 饿百的排序是从大到小 // 饿百的排序是从大到小

View File

@@ -136,15 +136,15 @@ func (c *PurchaseHandler) GetOrder(orderID string) (order *model.GoodsOrder, err
VendorStoreID: utils.Int64ToStr(utils.MustInterface2Int64(result["shopId"])), VendorStoreID: utils.Int64ToStr(utils.MustInterface2Int64(result["shopId"])),
StoreID: int(utils.Str2Int64WithDefault(utils.Interface2String(result["openId"]), 0)), StoreID: int(utils.Str2Int64WithDefault(utils.Interface2String(result["openId"]), 0)),
StoreName: result["shopName"].(string), StoreName: result["shopName"].(string),
ConsigneeName: utils.FilterMb4(result["consignee"].(string)), ConsigneeName: result["consignee"].(string),
ConsigneeMobile: consigneeMobile, ConsigneeMobile: consigneeMobile,
ConsigneeAddress: utils.FilterMb4(result["address"].(string)), ConsigneeAddress: result["address"].(string),
BuyerComment: strings.Trim(utils.FilterMb4(utils.Interface2String(result["description"])), "\n\r\t "), BuyerComment: utils.TrimBlanChar(utils.Interface2String(result["description"])),
ExpectedDeliveredTime: utils.Str2TimeWithDefault(utils.Interface2String(result["deliverTime"]), utils.DefaultTimeValue), ExpectedDeliveredTime: utils.Str2TimeWithDefault(utils.Interface2String(result["deliverTime"]), utils.DefaultTimeValue),
VendorStatus: utils.Interface2String(result["status"]), // 取订单的原始status不合并消息类型因为当前消息类型没有意义 VendorStatus: utils.Interface2String(result["status"]), // 取订单的原始status不合并消息类型因为当前消息类型没有意义
OrderSeq: int(utils.MustInterface2Int64(result["daySn"])), OrderSeq: int(utils.MustInterface2Int64(result["daySn"])),
StatusTime: utils.Str2Time(result["activeAt"].(string)), StatusTime: utils.Str2Time(result["activeAt"].(string)),
OriginalData: utils.FilterMb4(string(utils.MustMarshal(result))), OriginalData: string(utils.MustMarshal(result)),
ActualPayPrice: jxutils.StandardPrice2Int(utils.MustInterface2Float64(result["totalPrice"])), ActualPayPrice: jxutils.StandardPrice2Int(utils.MustInterface2Float64(result["totalPrice"])),
Skus: []*model.OrderSku{}, Skus: []*model.OrderSku{},
} }

View File

@@ -68,16 +68,16 @@ func (c *PurchaseHandler) GetOrder(orderID string) (order *model.GoodsOrder, err
VendorStoreID: result["produceStationNo"].(string), VendorStoreID: result["produceStationNo"].(string),
StoreID: int(utils.Str2Int64WithDefault(utils.Interface2String(result["produceStationNoIsv"]), 0)), StoreID: int(utils.Str2Int64WithDefault(utils.Interface2String(result["produceStationNoIsv"]), 0)),
StoreName: result["produceStationName"].(string), StoreName: result["produceStationName"].(string),
ConsigneeName: utils.FilterMb4(result["buyerFullName"].(string)), ConsigneeName: result["buyerFullName"].(string),
ConsigneeMobile: result["buyerMobile"].(string), ConsigneeMobile: result["buyerMobile"].(string),
ConsigneeAddress: utils.FilterMb4(result["buyerFullAddress"].(string)), ConsigneeAddress: result["buyerFullAddress"].(string),
CoordinateType: model.CoordinateTypeMars, CoordinateType: model.CoordinateTypeMars,
BuyerComment: strings.Trim(utils.FilterMb4(utils.Interface2String(result["orderBuyerRemark"])), "\n\r\t "), BuyerComment: utils.TrimBlanChar(utils.Interface2String(result["orderBuyerRemark"])),
ExpectedDeliveredTime: utils.Str2TimeWithDefault(utils.Interface2String(result["orderPreEndDeliveryTime"]), utils.DefaultTimeValue), ExpectedDeliveredTime: utils.Str2TimeWithDefault(utils.Interface2String(result["orderPreEndDeliveryTime"]), utils.DefaultTimeValue),
VendorStatus: utils.Int64ToStr(utils.MustInterface2Int64(result["orderStatus"])), VendorStatus: utils.Int64ToStr(utils.MustInterface2Int64(result["orderStatus"])),
OrderSeq: int(utils.MustInterface2Int64(result["orderNum"])), OrderSeq: int(utils.MustInterface2Int64(result["orderNum"])),
StatusTime: utils.Str2Time(result["orderPurchaseTime"].(string)), StatusTime: utils.Str2Time(result["orderPurchaseTime"].(string)),
OriginalData: utils.FilterMb4(string(utils.MustMarshal(result))), OriginalData: string(utils.MustMarshal(result)),
ActualPayPrice: utils.MustInterface2Int64(result["orderBuyerPayableMoney"]), ActualPayPrice: utils.MustInterface2Int64(result["orderBuyerPayableMoney"]),
Skus: []*model.OrderSku{}, Skus: []*model.OrderSku{},
} }