刷新京东商城订单

This commit is contained in:
苏尹岚
2020-09-14 15:09:02 +08:00
parent f21fadc377
commit b9f6a0ba29
2 changed files with 28 additions and 5 deletions

View File

@@ -1803,14 +1803,28 @@ func GenOrderNo(ctx *jxcontext.Context) (orderNo int64) {
}
func RefreshJdsOrderConsigneeInfo(ctx *jxcontext.Context, vendorOrderID string) (err error) {
var (
// db = dao.GetDB()
)
order, err := partner.CurOrderManager.LoadOrder(vendorOrderID, model.VendorIDJDShop)
waybill, err := partner.CurOrderManager.LoadWaybill(order.VendorWaybillID, order.WaybillVendorID)
if waybill != nil {
return fmt.Errorf("已经创建了三方运单不允许修改联系人信息!")
}
jdsOrder, err := jdshop.GetJdsOrder(order.VendorOrderID2)
if err != nil {
return err
}
if jdsOrder == nil {
return fmt.Errorf("未查询到对应的京东商城订单!")
}
order.ConsigneeAddress = jdshop.Decrypt(jdsOrder.ConsigneeInfo.FullAddress)
order.ConsigneeName = jdshop.Decrypt(jdsOrder.ConsigneeInfo.Fullname)
order.ConsigneeMobile = jdshop.Decrypt(jdsOrder.ConsigneeInfo.Mobile)
order.ConsigneeMobile2 = jdshop.Decrypt(jdsOrder.ConsigneeInfo.Telephone)
order.BuyerComment = jdsOrder.OrderRemark
if order.ConsigneeAddress != "" {
lng, lat, _ := api.AutonaviAPI.GetCoordinateFromAddress(order.ConsigneeAddress, "")
order.ConsigneeLng = jxutils.StandardCoordinate2Int(lng)
order.ConsigneeLat = jxutils.StandardCoordinate2Int(lat)
}
partner.CurOrderManager.UpdateOrderFields(order, []string{"ConsigneeAddress", "ConsigneeName", "ConsigneeMobile", "ConsigneeMobile2", "BuyerComment", "ConsigneeLng", "ConsigneeLat"})
return err
}

View File

@@ -65,7 +65,7 @@ func init() {
beego.ControllerComments{
Method: "GetActStoreSkuInfo",
Router: `/GetActStoreSkuInfo`,
AllowHTTPMethods: []string{"get"},
AllowHTTPMethods: []string{"get","post"},
MethodParams: param.Make(),
Filters: nil,
Params: nil})
@@ -1278,6 +1278,15 @@ func init() {
Filters: nil,
Params: nil})
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:OrderController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:OrderController"],
beego.ControllerComments{
Method: "RefreshJdsOrderConsigneeInfo",
Router: `/RefreshJdsOrderConsigneeInfo`,
AllowHTTPMethods: []string{"put"},
MethodParams: param.Make(),
Filters: nil,
Params: nil})
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:OrderController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:OrderController"],
beego.ControllerComments{
Method: "RefreshOrderFinancial",