- refactor order comment

This commit is contained in:
gazebo
2019-03-14 09:37:48 +08:00
parent 7234520503
commit 227f485691
3 changed files with 37 additions and 28 deletions

View File

@@ -5,6 +5,7 @@ import (
"git.rosy.net.cn/baseapi/platformapi/ebaiapi"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/jxutils"
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
"git.rosy.net.cn/jx-callback/business/model"
"git.rosy.net.cn/jx-callback/business/partner"
@@ -42,7 +43,7 @@ func (c *PurchaseHandler) RefreshComment(fromTime, toTime time.Time) (err error)
for _, result := range resultList {
orderComment := &model.OrderComment{
VendorOrderID: utils.Interface2String(result["order_id"]),
VendorID: model.VendorIDEBAI,
VendorID: model.VendorIDELM,
UserCommentID: utils.Int64ToStr(utils.MustInterface2Int64(result["comment_id"])),
VendorStoreID: utils.Int64ToStr(utils.MustInterface2Int64(result["shop_id"])),
TagList: "",
@@ -53,6 +54,17 @@ func (c *PurchaseHandler) RefreshComment(fromTime, toTime time.Time) (err error)
ModifyDuration: 24,
OriginalMsg: string(utils.MustMarshal(result)),
}
// 直接得到的订单是饿了么的,尝试统一成饿百
if order, err := partner.CurOrderManager.LoadOrder2(orderComment.VendorOrderID, model.VendorIDELM); err == nil {
orderComment.VendorOrderID2 = orderComment.VendorOrderID
orderComment.VendorOrderID = order.VendorOrderID
orderComment.VendorID = model.VendorIDEBAI
orderComment.StoreID = jxutils.GetSaleStoreIDFromOrder(order)
orderComment.ConsigneeMobile = order.ConsigneeMobile
} else {
globals.SugarLogger.Infof("RefreshComment, load orderID:%s failed", orderComment.VendorOrderID)
}
orderCommentList = append(orderCommentList, orderComment)
}
} else {
@@ -71,5 +83,8 @@ func (c *PurchaseHandler) RefreshComment(fromTime, toTime time.Time) (err error)
}
func (c *PurchaseHandler) ReplyOrderComment(ctx *jxcontext.Context, orderComment *model.OrderComment, replyComment string) (err error) {
return api.EbaiAPI.OrderRatesReply("", utils.Str2Int64(orderComment.VendorStoreID), orderComment.UserCommentID, replyComment)
if orderComment.VendorStoreID != "" && orderComment.UserCommentID != "" {
err = api.EbaiAPI.OrderRatesReply("", utils.Str2Int64(orderComment.VendorStoreID), orderComment.UserCommentID, replyComment)
}
return err
}