优化OnOrderComments

This commit is contained in:
gazebo
2019-10-10 16:22:58 +08:00
parent 90bffc3757
commit fe35951287
2 changed files with 31 additions and 35 deletions

View File

@@ -86,43 +86,39 @@ func (c *OrderManager) OnOrderComments(orderCommentList []*model.OrderComment) (
c.replyOrderComment(orderComment) c.replyOrderComment(orderComment)
} }
} }
if orderComment.Score <= JX_BAD_COMMENTS_MAX_LEVEL || !isNewComment { // 如果是直接非差评,忽略 if isNewComment && orderComment.Score <= JX_BAD_COMMENTS_MAX_LEVEL || !isNewComment && orderComment.Score > JX_BAD_COMMENTS_MAX_LEVEL { // 如果是直接非差评,或补评仍然是差评,忽略
if isNewComment || orderComment.Score <= JX_BAD_COMMENTS_MAX_LEVEL { if isNewComment {
if isNewComment { comment2.Createtime = utils.Time2Str(orderComment.CommentCreatedAt)
comment2.Createtime = utils.Time2Str(orderComment.CommentCreatedAt) comment2.Msg = orderComment.OriginalMsg
comment2.Msg = orderComment.OriginalMsg comment2.Score = int(orderComment.Score)
comment2.Score = int(orderComment.Score) comment2.Scorecontent = orderComment.Content
comment2.Scorecontent = orderComment.Content comment2.Vendertags = orderComment.TagList
comment2.Vendertags = orderComment.TagList comment2.Status = COMMENT_NOT_RESOLVED
comment2.Status = COMMENT_NOT_RESOLVED comment2.OrderFlag = utils.Int2Str(orderComment.VendorID)
comment2.OrderFlag = utils.Int2Str(orderComment.VendorID)
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 orderComment.VendorID != model.VendorIDELM { if orderComment.VendorID != model.VendorIDELM {
var order *model.GoodsOrder var order *model.GoodsOrder
if true /*orderComment.VendorID != model.VendorIDEBAI*/ { if true /*orderComment.VendorID != model.VendorIDEBAI*/ {
order, _ = partner.CurOrderManager.LoadOrder(orderComment.VendorOrderID, orderComment.VendorID) order, _ = partner.CurOrderManager.LoadOrder(orderComment.VendorOrderID, orderComment.VendorID)
} }
if order != nil { if order != nil {
orderComment.StoreID = jxutils.GetSaleStoreIDFromOrder(order) orderComment.StoreID = jxutils.GetSaleStoreIDFromOrder(order)
if order.ConsigneeMobile2 != "" { if order.ConsigneeMobile2 != "" {
orderComment.ConsigneeMobile = order.ConsigneeMobile2 orderComment.ConsigneeMobile = order.ConsigneeMobile2
} else { } else {
orderComment.ConsigneeMobile = order.ConsigneeMobile orderComment.ConsigneeMobile = order.ConsigneeMobile
}
}
if orderComment.StoreID > 0 {
comment2.Jxstoreid = utils.Int2Str(orderComment.StoreID)
}
comment2.Userphone = orderComment.ConsigneeMobile
if orderComment.StoreID > 0 && orderComment.Score <= JX_BAD_COMMENTS_MAX_LEVEL && time.Now().Sub(orderComment.CommentCreatedAt) < MAX_REAPLY_TIME {
weixinmsg.PushJDBadCommentToWeiXin(comment2)
} }
} }
} else { // 修改评价但是仍然低于或等于JX_BAD_COMMENTS_MAX_LEVEL if orderComment.StoreID > 0 {
comment2 = nil comment2.Jxstoreid = utils.Int2Str(orderComment.StoreID)
}
comment2.Userphone = orderComment.ConsigneeMobile
if orderComment.StoreID > 0 && orderComment.Score <= JX_BAD_COMMENTS_MAX_LEVEL && time.Now().Sub(orderComment.CommentCreatedAt) < MAX_REAPLY_TIME {
weixinmsg.PushJDBadCommentToWeiXin(comment2)
}
} }
} else { // 修改评价高于JX_BAD_COMMENTS_MAX_LEVEL } else { // 修改评价高于JX_BAD_COMMENTS_MAX_LEVEL
if orderComment.CommentCreatedAt.Sub(str2Time(comment2.Createtime)) == 0 || if orderComment.CommentCreatedAt.Sub(str2Time(comment2.Createtime)) == 0 ||

View File

@@ -16,7 +16,7 @@ import (
// 饿百的评价不是一点一点出来的,而是一下把前一天的全部崩出来。。。 // 饿百的评价不是一点一点出来的,而是一下把前一天的全部崩出来。。。
const ( const (
RefreshCommentTime = 36 * time.Hour RefreshCommentTime = 84 * time.Hour
RefreshCommentTimeInterval = 60 * time.Minute RefreshCommentTimeInterval = 60 * time.Minute
EBAI_BAD_COMMENTS_MAX_MODIFY_TIME = 24 // 小时 EBAI_BAD_COMMENTS_MAX_MODIFY_TIME = 24 // 小时
) )