- add refresh param for api GetStoreOrderInfo to get realtime CurrentConsigneeMobile.
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -10,6 +10,10 @@ import (
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
)
|
||||
|
||||
var (
|
||||
FixedBaseScheduler *BaseScheduler
|
||||
)
|
||||
|
||||
type BaseScheduler struct {
|
||||
PurchasePlatformHandlers map[int]partner.IPurchasePlatformHandler
|
||||
DeliveryPlatformHandlers map[int]*scheduler.DeliveryPlatformHandlerInfo
|
||||
|
||||
@@ -148,6 +148,7 @@ func (s *WatchOrderInfo) updateOrderStoreFeature(order *model.GoodsOrder) (err e
|
||||
|
||||
func init() {
|
||||
sch := &DefScheduler{}
|
||||
basesch.FixedBaseScheduler = &sch.BaseScheduler
|
||||
FixedScheduler = sch
|
||||
sch.IsReallyCallPlatformAPI = globals.ReallyCallPlatformAPI
|
||||
sch.Init()
|
||||
|
||||
@@ -8,9 +8,10 @@ type CallResult struct {
|
||||
|
||||
type GoodsOrderExt struct {
|
||||
GoodsOrder
|
||||
WaybillStatus int `json:"waybillStatus"`
|
||||
CourierName string `orm:"size(32)" json:"courierName"`
|
||||
CourierMobile string `orm:"size(32)" json:"courierMobile"`
|
||||
WaybillStatus int `json:"waybillStatus"`
|
||||
CourierName string `orm:"size(32)" json:"courierName"`
|
||||
CourierMobile string `orm:"size(32)" json:"courierMobile"`
|
||||
CurrentConsigneeMobile string `orm:"-" json:"currentConsigneeMobile"`
|
||||
}
|
||||
|
||||
type OrderSkuExt struct {
|
||||
|
||||
@@ -126,7 +126,7 @@ func (c *OrderController) CreateWaybillOnProviders() {
|
||||
|
||||
// @Title 得到门店订单信息
|
||||
// @Description 得到门店订单信息
|
||||
// @Param token header string true "认证toke"
|
||||
// @Param token header string true "认证toke"
|
||||
// @Param storeID query string true "京西门店ID"
|
||||
// @Param lastHours query int false "最近多少小时的信息(缺省为两天)"
|
||||
// @Success 200 {object} business.model.CallResult
|
||||
@@ -168,7 +168,7 @@ func (c *OrderController) GetStoreOrderCountInfo() {
|
||||
|
||||
// @Title 得到门店订单状态信息
|
||||
// @Description 得到门店订单状态信息
|
||||
// @Param token header string true "认证toke"
|
||||
// @Param token header string true "认证toke"
|
||||
// @Param storeID query string true "京西门店ID"
|
||||
// @Param lastHours query int false "最近多少小时的信息(缺省为两天)"
|
||||
// @Param fromStatus query int true "起始状态(包括)"
|
||||
@@ -219,12 +219,12 @@ func (c *OrderController) GetStoreOrderInfo() {
|
||||
|
||||
// @Title 得到订单SKU信息
|
||||
// @Description 得到订单SKU信息
|
||||
// @Param token header string true "认证toke"
|
||||
// @Param token header string true "认证toke"
|
||||
// @Param vendorOrderID query string true "订单ID"
|
||||
// @Param vendorID query int true "订单所属的厂商ID"
|
||||
// @Success 200 {object} business.model.CallResult
|
||||
// @Failure 200 {object} business.model.CallResult
|
||||
// @router /GetOrderSkuInfo [get]
|
||||
// @router /GetOrderSkuInfo [get
|
||||
func (c *OrderController) GetOrderSkuInfo() {
|
||||
c.orderOperate(func(vendorOrderID string, vendorID int, userName string) (interface{}, error) {
|
||||
// globals.SugarLogger.Debugf("userName:%s", userName)
|
||||
@@ -234,22 +234,24 @@ func (c *OrderController) GetOrderSkuInfo() {
|
||||
|
||||
// @Title 得到订单详情
|
||||
// @Description 得到订单详情
|
||||
// @Param token header string true "认证toke"
|
||||
// @Param token header string true "认证toke"
|
||||
// @Param vendorOrderID query string true "订单ID"
|
||||
// @Param vendorID query int true "订单所属的厂商ID"
|
||||
// @Param refresh query bool false "是否从购物平台刷新数据"
|
||||
// @Success 200 {object} business.model.CallResult
|
||||
// @Failure 200 {object} business.model.CallResult
|
||||
// @router /GetOrderInfo [get]
|
||||
func (c *OrderController) GetOrderInfo() {
|
||||
c.orderOperate(func(vendorOrderID string, vendorID int, userName string) (interface{}, error) {
|
||||
isRefresh, _ := c.GetBool("refresh", false)
|
||||
// globals.SugarLogger.Debugf("userName:%s", userName)
|
||||
return orderman.FixedOrderManager.GetOrderInfo(vendorOrderID, vendorID)
|
||||
return orderman.FixedOrderManager.GetOrderInfo(vendorOrderID, vendorID, isRefresh)
|
||||
})
|
||||
}
|
||||
|
||||
// @Title 得到订单运单信息
|
||||
// @Description 得到订单运单信息
|
||||
// @Param token header string true "认证toke"
|
||||
// @Param token header string true "认证toke"
|
||||
// @Param vendorOrderID query string true "订单ID"
|
||||
// @Param vendorID query int true "订单所属的厂商ID"
|
||||
// @Success 200 {object} business.model.CallResult
|
||||
|
||||
Reference in New Issue
Block a user