- log msg refactor, add orderID to all logs.

This commit is contained in:
gazebo
2018-07-22 16:44:44 +08:00
parent 0cb34fe089
commit 7ae0944fc9
14 changed files with 57 additions and 66 deletions

View File

@@ -62,7 +62,7 @@ func (c *WaybillController) onWaybillMsg(msg *mtpsapi.CallbackOrderMsg) (retVal
case mtpsapi.OrderStatusCanceled:
order.Status = model.WaybillStatusCanceled
default:
globals.SugarLogger.Warnf("unknown msg:%v", msg)
globals.SugarLogger.Warnf("onWaybillMsg unknown msg:%v", msg)
return mtpsapi.SuccessResponse
}
return mtpsapi.Err2CallbackResponse(controller.WaybillManager.OnWaybillStatusChanged(order), order.VendorStatus)
@@ -102,7 +102,7 @@ func (c *WaybillController) calculateDeliveryFee(bill *model.Waybill) (retVal in
if err == nil && num == 1 {
delieveryFee = utils.Str2Int64(lists[0][0].(string))
} else {
globals.SugarLogger.Warnf("calculateDeliveryFee can not cal delivery fee for orderid:%s, num:%d, error:%v", order.VendorOrderID, num, err)
globals.SugarLogger.Warnf("calculateDeliveryFee can not calculate delivery fee for orderID:%s, num:%d, error:%v", order.VendorOrderID, num, err)
return 0
}
@@ -139,9 +139,6 @@ func (c *WaybillController) calculateDeliveryFee(bill *model.Waybill) (retVal in
// DeliveryPlatformHandler
func (c *WaybillController) CreateWaybill(order *model.GoodsOrder) (err error) {
globals.SugarLogger.Infof("CreateWaybill bill:%v", order)
return nil
db := orm.NewOrm()
// 忽略坐标转换错误,即使是转换出错,也只能当成转换成功来处理,底层会有错误日志输出
lngFloat, latFloat, _ := jxutils.IntCoordinate2MarsStandard(order.ConsigneeLng, order.ConsigneeLat, order.CoordinateType)
@@ -181,9 +178,6 @@ func (c *WaybillController) CreateWaybill(order *model.GoodsOrder) (err error) {
}
func (c *WaybillController) CancelWaybill(bill *model.Waybill) (err error) {
globals.SugarLogger.Infof("CancelWaybill bill:%v", bill)
return nil
reasonID := mtpsapi.CancelReasonMerchantOther
reasonMsg := "other reason"
if bill.Status < model.WaybillStatusAccepted {
@@ -206,7 +200,7 @@ func (c *WaybillController) getDeliveryID(order *model.GoodsOrder, db orm.Ormer)
err = utils.CallFuncLogError(func() error {
err2 := db.Read(jxorder, "OrderId")
return err2
}, "getDeliveryID")
}, "getDeliveryID, orderID:%s", order.VendorOrderID)
return int64(jxorder.Id), err
}
@@ -218,7 +212,7 @@ func (c *WaybillController) getMTPSShopID(order *model.GoodsOrder, db orm.Ormer)
if err != nil && num == 1 {
retVal = lists[0][0].(string)
} else {
globals.SugarLogger.Errorf("can not find mtps store info for store:%d", JxStoreID)
globals.SugarLogger.Errorf("getMTPSShopID can not find mtps store info for orderID:%s, store:%d", order.VendorOrderID, JxStoreID)
}
return retVal, err
}