- refactor bad comment
This commit is contained in:
43
business/partner/purchase/jd/order_comment.go
Normal file
43
business/partner/purchase/jd/order_comment.go
Normal file
@@ -0,0 +1,43 @@
|
||||
package jd
|
||||
|
||||
import (
|
||||
"git.rosy.net.cn/baseapi/platformapi/jdapi"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"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"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
"git.rosy.net.cn/jx-callback/globals/api"
|
||||
)
|
||||
|
||||
func (c *PurchaseHandler) onOrderComment2(msg *jdapi.CallbackOrderMsg) (err error) {
|
||||
intOrderID := utils.Str2Int64(msg.BillID)
|
||||
result, err := api.JdAPI.GetCommentByOrderId(intOrderID)
|
||||
if err == nil {
|
||||
globals.SugarLogger.Debugf("onOrderComment comment:%s", utils.Format4Output(result, true))
|
||||
orderCommend := &model.OrderComment{
|
||||
VendorOrderID: utils.Int64ToStr(utils.MustInterface2Int64(result["orderId"])),
|
||||
VendorID: model.VendorIDJD,
|
||||
UserCommentID: "",
|
||||
VendorStoreID: utils.Int64ToStr(utils.MustInterface2Int64(result["storeId"])),
|
||||
TagList: string(utils.MustMarshal(result["venderTags"])),
|
||||
Score: int8(utils.MustInterface2Int64(result["score4"])),
|
||||
Content: utils.Interface2String(result["score4Content"]),
|
||||
CommentCreatedAt: utils.Timestamp2Time(utils.MustInterface2Int64(result["createTime"].(map[string]interface{})["time"]) / 1000),
|
||||
ModifyDuration: JDDJ_BAD_COMMENTS_MAX_MODIFY_TIME,
|
||||
OriginalMsg: string(utils.MustMarshal(result)),
|
||||
}
|
||||
if result["orgCommentContent"] != nil {
|
||||
orderCommend.IsReplied = 1
|
||||
}
|
||||
err = partner.CurOrderManager.OnOrderComments([]*model.OrderComment{orderCommend})
|
||||
}
|
||||
if err != nil {
|
||||
globals.SugarLogger.Warnf("onOrderComment orderID:%s failed with error:%v", msg.BillID, err)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
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())
|
||||
}
|
||||
Reference in New Issue
Block a user