- GetOrderInfo and GetOrderWaybillInfo added.
This commit is contained in:
@@ -122,3 +122,34 @@ 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) {
|
||||
globals.SugarLogger.Debugf("GetOrderInfo orderID:%s", vendorOrderID)
|
||||
db := orm.NewOrm()
|
||||
err = db.Raw(`
|
||||
SELECT t1.*, t2.status waybill_status, t2.courier_name, t2.courier_mobile
|
||||
FROM goods_order t1
|
||||
LEFT JOIN waybill t2 ON t1.vendor_waybill_id = t2.vendor_waybill_id AND t1.waybill_vendor_id = t2.waybill_vendor_id
|
||||
WHERE t1.vendor_order_id = ? AND vendor_id = ?
|
||||
`, vendorOrderID, vendorID).QueryRow(&order)
|
||||
if err == nil {
|
||||
return order, nil
|
||||
}
|
||||
globals.SugarLogger.Infof("GetOrderInfo orderID:%s failed with error:%v", vendorOrderID, err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
func (c *OrderManager) GetOrderWaybillInfo(vendorOrderID string, vendorID int) (bills *[]model.Waybill, err error) {
|
||||
globals.SugarLogger.Debugf("GetOrderWaybillInfo orderID:%s", vendorOrderID)
|
||||
db := orm.NewOrm()
|
||||
_, err = db.Raw(`
|
||||
SELECT t1.*
|
||||
FROM waybill t1
|
||||
WHERE t1.vendor_order_id = ? AND order_vendor_id = ?
|
||||
`, vendorOrderID, vendorID).QueryRows(&bills)
|
||||
if err == nil {
|
||||
return bills, nil
|
||||
}
|
||||
globals.SugarLogger.Infof("GetOrderWaybillInfo orderID:%s failed with error:%v", vendorOrderID, err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -98,13 +98,13 @@ type Waybill struct {
|
||||
OrderVendorID int `orm:"column(order_vendor_id)" json:"orderVendorID"`
|
||||
CourierName string `orm:"size(32)" json:"-"`
|
||||
CourierMobile string `orm:"size(32)" json:"-"`
|
||||
Status int `json:"-"` // 参见WaybillStatus*相关的常量定义
|
||||
Status int `json:"status"` // 参见WaybillStatus*相关的常量定义
|
||||
VendorStatus string `orm:"size(255)" json:"-"`
|
||||
ActualFee int64 `json:"actualFee"` // 实际要支付给快递公司的费用
|
||||
DesiredFee int64 `json:"desiredFee"` // 运单总费用
|
||||
DuplicatedCount int `json:"-"` // 重复新订单消息数,这个一般不是由于消息重发造成的(消息重发由OrderStatus过滤),一般是业务逻辑造成的
|
||||
WaybillCreatedAt time.Time `orm:"type(datetime);index" json:"-"`
|
||||
WaybillFinishedAt time.Time `orm:"type(datetime)" json:"-"`
|
||||
WaybillCreatedAt time.Time `orm:"type(datetime);index" json:"waybillCreatedAt"`
|
||||
WaybillFinishedAt time.Time `orm:"type(datetime)" json:"waybillFinishedAt"`
|
||||
StatusTime time.Time `orm:"type(datetime)" json:"-"` // last status time
|
||||
ModelTimeInfo `json:"-"`
|
||||
OriginalData string `orm:"type(text)" json:"-"`
|
||||
|
||||
Reference in New Issue
Block a user