- refactor order comment
This commit is contained in:
@@ -26,7 +26,7 @@ const (
|
|||||||
COMMENTS_SCORE_FOUR_ORFIVE_BEGIN_DELAY_TIME = 2 * 60 //评论回复四星或五星回复延迟开始时间区间
|
COMMENTS_SCORE_FOUR_ORFIVE_BEGIN_DELAY_TIME = 2 * 60 //评论回复四星或五星回复延迟开始时间区间
|
||||||
COMMENTS_SCORE_FOUR_ORFIVE_END_DELAY_TIME = 5 * 60 //评论回复四星或五星回复延迟结束时间区间
|
COMMENTS_SCORE_FOUR_ORFIVE_END_DELAY_TIME = 5 * 60 //评论回复四星或五星回复延迟结束时间区间
|
||||||
|
|
||||||
MAX_REAPLY_TIME = 4 * time.Hour
|
MAX_REAPLY_TIME = 2 * time.Hour
|
||||||
)
|
)
|
||||||
|
|
||||||
type tReplyConfig struct {
|
type tReplyConfig struct {
|
||||||
@@ -71,18 +71,6 @@ func (c *OrderManager) OnOrderComments(orderCommentList []*model.OrderComment) (
|
|||||||
db := dao.GetDB()
|
db := dao.GetDB()
|
||||||
for _, orderComment := range orderCommentList {
|
for _, orderComment := range orderCommentList {
|
||||||
globals.SugarLogger.Debugf("OnOrderComments, orderID:%s", orderComment.VendorOrderID)
|
globals.SugarLogger.Debugf("OnOrderComments, orderID:%s", orderComment.VendorOrderID)
|
||||||
var order *model.GoodsOrder
|
|
||||||
if orderComment.VendorID == model.VendorIDEBAI {
|
|
||||||
if realVendorID := jxutils.GetPossibleVendorIDFromVendorOrderID(orderComment.VendorOrderID); realVendorID == model.VendorIDELM {
|
|
||||||
if order, err = partner.CurOrderManager.LoadOrder2(orderComment.VendorOrderID, model.VendorIDEBAI); err == nil {
|
|
||||||
orderComment.VendorOrderID = order.VendorOrderID
|
|
||||||
} else {
|
|
||||||
globals.SugarLogger.Infof("OnOrderComments, load orderID:%s failed", orderComment.VendorOrderID)
|
|
||||||
err = nil
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
comment2 := &legacymodel.JxBadComments2{
|
comment2 := &legacymodel.JxBadComments2{
|
||||||
OrderId: orderComment.VendorOrderID,
|
OrderId: orderComment.VendorOrderID,
|
||||||
}
|
}
|
||||||
@@ -110,11 +98,15 @@ func (c *OrderManager) OnOrderComments(orderCommentList []*model.OrderComment) (
|
|||||||
comment2.LastPushTime = utils.Time2Str(time.Now())
|
comment2.LastPushTime = utils.Time2Str(time.Now())
|
||||||
comment2.PushNo = 1
|
comment2.PushNo = 1
|
||||||
comment2.Maxmodifytime = int(orderComment.ModifyDuration)
|
comment2.Maxmodifytime = int(orderComment.ModifyDuration)
|
||||||
if order == nil {
|
if orderComment.VendorID != model.VendorIDELM {
|
||||||
|
var order *model.GoodsOrder
|
||||||
|
if orderComment.VendorID != model.VendorIDEBAI {
|
||||||
order, err = partner.CurOrderManager.LoadOrder(orderComment.VendorOrderID, orderComment.VendorID)
|
order, err = partner.CurOrderManager.LoadOrder(orderComment.VendorOrderID, orderComment.VendorID)
|
||||||
}
|
}
|
||||||
if err == nil {
|
if order != nil {
|
||||||
orderComment.StoreID = jxutils.GetSaleStoreIDFromOrder(order)
|
orderComment.StoreID = jxutils.GetSaleStoreIDFromOrder(order)
|
||||||
|
orderComment.ConsigneeMobile = order.ConsigneeMobile
|
||||||
|
}
|
||||||
if orderComment.StoreID > 0 {
|
if orderComment.StoreID > 0 {
|
||||||
comment2.Jxstoreid = utils.Int2Str(orderComment.StoreID)
|
comment2.Jxstoreid = utils.Int2Str(orderComment.StoreID)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -217,9 +217,11 @@ func (o *OrderStatus) GetStatusTime() time.Time {
|
|||||||
type OrderComment struct {
|
type OrderComment struct {
|
||||||
ModelIDCUL
|
ModelIDCUL
|
||||||
VendorOrderID string `orm:"column(vendor_order_id);size(48);unique" json:"vendorOrderID"`
|
VendorOrderID string `orm:"column(vendor_order_id);size(48);unique" json:"vendorOrderID"`
|
||||||
|
VendorOrderID2 string `orm:"column(vendor_order_id2);size(48);unique" json:"vendorOrderID2"`
|
||||||
VendorID int `orm:"column(vendor_id)" json:"vendorID"`
|
VendorID int `orm:"column(vendor_id)" json:"vendorID"`
|
||||||
VendorStoreID string `orm:"column(vendor_store_id);size(48)" json:"vendorStoreID"`
|
VendorStoreID string `orm:"column(vendor_store_id);size(48)" json:"vendorStoreID"`
|
||||||
StoreID int `orm:"column(store_id)" json:"storeID"` // 外部系统里记录的 jxstoreid
|
StoreID int `orm:"column(store_id)" json:"storeID"` // 外部系统里记录的 jxstoreid
|
||||||
|
ConsigneeMobile string `orm:"size(32)" json:"consigneeMobile"`
|
||||||
UserCommentID string `orm:"column(user_comment_id);size(48)" json:"userCommentID"`
|
UserCommentID string `orm:"column(user_comment_id);size(48)" json:"userCommentID"`
|
||||||
IsReplied int8
|
IsReplied int8
|
||||||
Status int8
|
Status int8
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import (
|
|||||||
|
|
||||||
"git.rosy.net.cn/baseapi/platformapi/ebaiapi"
|
"git.rosy.net.cn/baseapi/platformapi/ebaiapi"
|
||||||
"git.rosy.net.cn/baseapi/utils"
|
"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/jxutils/jxcontext"
|
||||||
"git.rosy.net.cn/jx-callback/business/model"
|
"git.rosy.net.cn/jx-callback/business/model"
|
||||||
"git.rosy.net.cn/jx-callback/business/partner"
|
"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 {
|
for _, result := range resultList {
|
||||||
orderComment := &model.OrderComment{
|
orderComment := &model.OrderComment{
|
||||||
VendorOrderID: utils.Interface2String(result["order_id"]),
|
VendorOrderID: utils.Interface2String(result["order_id"]),
|
||||||
VendorID: model.VendorIDEBAI,
|
VendorID: model.VendorIDELM,
|
||||||
UserCommentID: utils.Int64ToStr(utils.MustInterface2Int64(result["comment_id"])),
|
UserCommentID: utils.Int64ToStr(utils.MustInterface2Int64(result["comment_id"])),
|
||||||
VendorStoreID: utils.Int64ToStr(utils.MustInterface2Int64(result["shop_id"])),
|
VendorStoreID: utils.Int64ToStr(utils.MustInterface2Int64(result["shop_id"])),
|
||||||
TagList: "",
|
TagList: "",
|
||||||
@@ -53,6 +54,17 @@ func (c *PurchaseHandler) RefreshComment(fromTime, toTime time.Time) (err error)
|
|||||||
ModifyDuration: 24,
|
ModifyDuration: 24,
|
||||||
OriginalMsg: string(utils.MustMarshal(result)),
|
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)
|
orderCommentList = append(orderCommentList, orderComment)
|
||||||
}
|
}
|
||||||
} else {
|
} 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) {
|
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
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user