This commit is contained in:
gazebo
2018-08-24 16:04:06 +08:00
parent 538c2dddd1
commit 4dcd8b0fb8

View File

@@ -126,17 +126,19 @@ func (c *OrderManager) GetOrderSkuInfo(vendorOrderID string, vendorID int) (skus
func (c *OrderManager) GetOrderInfo(vendorOrderID string, vendorID int) (order *model.GoodsOrderExt, err error) {
globals.SugarLogger.Debugf("GetOrderInfo orderID:%s", vendorOrderID)
db := orm.NewOrm()
order = &model.GoodsOrderExt{}
err = db.Raw(`
orders := []*model.GoodsOrderExt{}
num, 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 {
`, vendorOrderID, vendorID).QueryRows(&orders)
if err == nil && num == 1 {
order = orders[0]
globals.SugarLogger.Debug(order)
return order, nil
}
if err == orm.ErrNoRows {
if err == orm.ErrNoRows || num == 0 {
err = ErrCanNotFindOrder
}
globals.SugarLogger.Infof("GetOrderInfo orderID:%s failed with error:%v", vendorOrderID, err)