- refactor config ReallyCallPlatformAPI, ReallySendWeixinMsg and ReallyReplyComment

This commit is contained in:
gazebo
2019-03-15 11:09:43 +08:00
parent df54ea9478
commit bb01fc422b
9 changed files with 55 additions and 63 deletions

View File

@@ -114,9 +114,7 @@ func (c *OrderManager) OnOrderComments(orderCommentList []*model.OrderComment) (
}
comment2.Userphone = orderComment.ConsigneeMobile
if orderComment.StoreID > 0 && orderComment.Score <= JX_BAD_COMMENTS_MAX_LEVEL && time.Now().Sub(orderComment.CommentCreatedAt) < MAX_REAPLY_TIME {
if globals.ReallyCallPlatformAPI {
weixinmsg.PushJDBadCommentToWeiXin(comment2)
}
weixinmsg.PushJDBadCommentToWeiXin(comment2)
}
}
} else { // 修改评价但是仍然低于或等于JX_BAD_COMMENTS_MAX_LEVEL
@@ -165,15 +163,12 @@ func (c *OrderManager) replyOrderComment(orderComment *model.OrderComment) (err
content := config.comments[rand.Intn(len(config.comments))]
globals.SugarLogger.Debugf("replyOrderComment orderID:%s, delaySeconds:%d, content:%s", orderComment.VendorOrderID, delaySeconds, content)
utils.AfterFuncWithRecover(time.Duration(delaySeconds)*time.Second, func() {
if globals.ReallySendWeixinMsg {
if handler := partner.GetPurchasePlatformFromVendorID(orderComment.VendorID); handler != nil {
err = handler.ReplyOrderComment(jxcontext.AdminCtx, orderComment, content)
if err != nil {
globals.SugarLogger.Debugf("replyOrderComment orderID:%s, error:%v", orderComment.VendorOrderID, err)
}
} else {
globals.SugarLogger.Warnf("replyOrderComment can not find handler orderID:%s", orderComment.VendorOrderID)
if handler := partner.GetPurchasePlatformFromVendorID(orderComment.VendorID); handler != nil {
if err = handler.ReplyOrderComment(jxcontext.AdminCtx, orderComment, content); err != nil {
globals.SugarLogger.Debugf("replyOrderComment orderID:%s, error:%v", orderComment.VendorOrderID, err)
}
} else {
globals.SugarLogger.Warnf("replyOrderComment can not find handler orderID:%s", orderComment.VendorOrderID)
}
})
return err