- GetOrderInfo and GetOrderWaybillInfo added.

This commit is contained in:
gazebo
2018-08-24 15:16:30 +08:00
parent 54063d2f35
commit bc5e4a3449
4 changed files with 80 additions and 3 deletions

View File

@@ -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
}