- fk2.
This commit is contained in:
@@ -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) {
|
func (c *OrderManager) GetOrderInfo(vendorOrderID string, vendorID int) (order *model.GoodsOrderExt, err error) {
|
||||||
globals.SugarLogger.Debugf("GetOrderInfo orderID:%s", vendorOrderID)
|
globals.SugarLogger.Debugf("GetOrderInfo orderID:%s", vendorOrderID)
|
||||||
db := orm.NewOrm()
|
db := orm.NewOrm()
|
||||||
order = &model.GoodsOrderExt{}
|
orders := []*model.GoodsOrderExt{}
|
||||||
err = db.Raw(`
|
num, err := db.Raw(`
|
||||||
SELECT t1.*, t2.status waybill_status, t2.courier_name, t2.courier_mobile
|
SELECT t1.*, t2.status waybill_status, t2.courier_name, t2.courier_mobile
|
||||||
FROM goods_order t1
|
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
|
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 = ?
|
WHERE t1.vendor_order_id = ? AND vendor_id = ?
|
||||||
`, vendorOrderID, vendorID).QueryRow(order)
|
`, vendorOrderID, vendorID).QueryRows(&orders)
|
||||||
if err == nil {
|
if err == nil && num == 1 {
|
||||||
|
order = orders[0]
|
||||||
|
globals.SugarLogger.Debug(order)
|
||||||
return order, nil
|
return order, nil
|
||||||
}
|
}
|
||||||
if err == orm.ErrNoRows {
|
if err == orm.ErrNoRows || num == 0 {
|
||||||
err = ErrCanNotFindOrder
|
err = ErrCanNotFindOrder
|
||||||
}
|
}
|
||||||
globals.SugarLogger.Infof("GetOrderInfo orderID:%s failed with error:%v", vendorOrderID, err)
|
globals.SugarLogger.Infof("GetOrderInfo orderID:%s failed with error:%v", vendorOrderID, err)
|
||||||
|
|||||||
Reference in New Issue
Block a user