- add refresh param for api GetStoreOrderInfo to get realtime CurrentConsigneeMobile.

This commit is contained in:
gazebo
2018-08-27 14:31:11 +08:00
parent 9e515aff68
commit f7e655ec6b
5 changed files with 29 additions and 13 deletions

View File

@@ -3,9 +3,9 @@ package orderman
import (
"time"
"git.rosy.net.cn/jx-callback/business/jxcallback/scheduler/basesch"
"git.rosy.net.cn/jx-callback/business/model"
"git.rosy.net.cn/jx-callback/globals"
"github.com/astaxie/beego/orm"
)
@@ -121,7 +121,7 @@ func (c *OrderManager) GetOrderSkuInfo(vendorOrderID string, vendorID int) (skus
return nil, err
}
func (c *OrderManager) GetOrderInfo(vendorOrderID string, vendorID int) (order *model.GoodsOrderExt, err error) {
func (c *OrderManager) GetOrderInfo(vendorOrderID string, vendorID int, isRefresh bool) (order *model.GoodsOrderExt, err error) {
globals.SugarLogger.Debugf("GetOrderInfo orderID:%s", vendorOrderID)
db := orm.NewOrm()
orders := []*model.GoodsOrderExt{}
@@ -135,7 +135,15 @@ func (c *OrderManager) GetOrderInfo(vendorOrderID string, vendorID int) (order *
`, vendorOrderID, vendorID).QueryRows(&orders)
if err == nil && num > 0 {
order = orders[0]
globals.SugarLogger.Debug(order)
if isRefresh && vendorID == model.VendorIDJD {
tmpOrder, err2 := basesch.FixedBaseScheduler.GetPurchasePlatformFromVendorID(vendorID).GetOrder(vendorOrderID)
if err = err2; err == nil {
order.CurrentConsigneeMobile = tmpOrder.ConsigneeMobile
} else {
order.CurrentConsigneeMobile = "Error"
globals.SugarLogger.Infof("GetOrderInfo GetOrder failed with error:%v", err2)
}
}
return order, nil
}
if err == nil {