- 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

@@ -49,11 +49,9 @@ func (c *PurchaseHandler) onOrderMsg(msg *jdapi.CallbackOrderMsg) (retVal *jdapi
} else {
status := c.callbackMsg2Status(msg)
if msg.StatusID == jdapi.OrderStatusAddComment || msg.StatusID == jdapi.OrderStatusModifyComment {
if globals.ReallyCallPlatformAPI {
utils.CallFuncAsync(func() {
c.onOrderComment2(msg)
})
}
utils.CallFuncAsync(func() {
c.onOrderComment2(msg)
})
}
err := partner.CurOrderManager.OnOrderStatusChanged(status)
// if globals.HandleLegacyJxOrder && err == nil {

View File

@@ -39,5 +39,8 @@ func (c *PurchaseHandler) onOrderComment2(msg *jdapi.CallbackOrderMsg) (err erro
}
func (c *PurchaseHandler) ReplyOrderComment(ctx *jxcontext.Context, orderComment *model.OrderComment, replyComment string) (err error) {
return api.JdAPI.OrgReplyComment(utils.Str2Int64(orderComment.VendorOrderID), orderComment.VendorStoreID, replyComment, ctx.GetUserName())
if globals.ReallyReplyComment {
err = api.JdAPI.OrgReplyComment(utils.Str2Int64(orderComment.VendorOrderID), orderComment.VendorStoreID, replyComment, ctx.GetUserName())
}
return err
}

View File

@@ -125,9 +125,7 @@ func (c *PurchaseHandler) onOrderComment(msg *jdapi.CallbackOrderMsg) (err error
comment.Status = COMMENT_RESOLVED
}
if score <= JX_BAD_COMMENTS_MAX_LEVEL && comment.Jxstoreid != "" {
if globals.ReallyCallPlatformAPI {
weixinmsg.PushJDBadCommentToWeiXin(comment)
}
weixinmsg.PushJDBadCommentToWeiXin(comment)
}
if err == nil {
if isNewComment {
@@ -157,13 +155,7 @@ func (c *PurchaseHandler) replyOrderComment(intOrderID int64, jdStoreNo string,
content := config.comments[rand.Intn(len(config.comments))]
globals.SugarLogger.Debugf("replyOrderComment orderID:%d, delaySeconds:%d, content:%s", intOrderID, delaySeconds, content)
utils.AfterFuncWithRecover(time.Duration(delaySeconds)*time.Second, func() {
// err2 := utils.CallFuncLogError(func() error {
// if globals.ReallyCallPlatformAPI {
// return api.JdAPI.OrgReplyComment(intOrderID, jdStoreNo, content, utils.GetAPIOperator(""))
// }
// return nil
// }, "replyOrderComment %d", intOrderID)
if globals.ReallySendWeixinMsg {
if globals.ReallyReplyComment {
err2 := api.JdAPI.OrgReplyComment(intOrderID, jdStoreNo, content, utils.GetAPIOperator(""))
globals.SugarLogger.Debugf("replyOrderComment orderID:%d, error:%v", intOrderID, err2)
}