From fffb7a495bac31da2dd320536e0a893b1fab00c8 Mon Sep 17 00:00:00 2001 From: gazebo Date: Thu, 14 Mar 2019 12:07:59 +0800 Subject: [PATCH] - enable new order comment --- business/jxcallback/orderman/oder_comment.go | 5 ++- business/model/legacymodel/jxbadcomments.go | 44 +++++++++---------- .../partner/purchase/ebai/order_comment.go | 4 +- business/partner/purchase/jd/order.go | 4 +- globals/beegodb/beegodb.go | 2 +- main.go | 2 + 6 files changed, 33 insertions(+), 28 deletions(-) diff --git a/business/jxcallback/orderman/oder_comment.go b/business/jxcallback/orderman/oder_comment.go index 4518c89cc..8838e8574 100644 --- a/business/jxcallback/orderman/oder_comment.go +++ b/business/jxcallback/orderman/oder_comment.go @@ -6,6 +6,7 @@ import ( "git.rosy.net.cn/baseapi/utils" "git.rosy.net.cn/jx-callback/business/jxutils" + "git.rosy.net.cn/jx-callback/business/jxutils/weixinmsg" "git.rosy.net.cn/jx-callback/business/model" "git.rosy.net.cn/jx-callback/business/model/dao" "git.rosy.net.cn/jx-callback/business/model/legacymodel" @@ -71,7 +72,7 @@ func (c *OrderManager) OnOrderComments(orderCommentList []*model.OrderComment) ( db := dao.GetDB() for _, orderComment := range orderCommentList { globals.SugarLogger.Debugf("OnOrderComments, orderID:%s", orderComment.VendorOrderID) - comment2 := &legacymodel.JxBadComments2{ + comment2 := &legacymodel.JxBadComments{ OrderId: orderComment.VendorOrderID, } err = dao.GetEntity(db, comment2, "OrderId") @@ -113,7 +114,7 @@ func (c *OrderManager) OnOrderComments(orderCommentList []*model.OrderComment) ( comment2.Userphone = order.ConsigneeMobile if orderComment.StoreID > 0 && orderComment.Score <= JX_BAD_COMMENTS_MAX_LEVEL { if globals.ReallyCallPlatformAPI { - // weixinmsg.PushJDBadCommentToWeiXin(comment) + weixinmsg.PushJDBadCommentToWeiXin(comment2) } } } diff --git a/business/model/legacymodel/jxbadcomments.go b/business/model/legacymodel/jxbadcomments.go index 96e233141..af1800cd0 100644 --- a/business/model/legacymodel/jxbadcomments.go +++ b/business/model/legacymodel/jxbadcomments.go @@ -29,25 +29,25 @@ func (*JxBadComments) TableName() string { return "jx_bad_comments" } -type JxBadComments2 struct { - Id int `json:"id" orm:"column(id)"` - CreatedAt time.Time `orm:"auto_now_add;type(datetime);null" json:"createdAt"` - OrderId string `json:"order_id" orm:"column(order_id);size(25);unique" description:"订单ID"` - Jxstoreid string `json:"jxstoreid" orm:"column(jxstoreid);size(11);index" description:"京西门店ID"` - Userphone string `json:"userPhone" orm:"column(userphone);size(255);null" description:"评价的用户的联系方式"` - Status int `json:"status" orm:"column(status)" description:"当前评论的状态(0:未解决 1:已解决)"` - Createtime string `json:"createTime" orm:"column(createtime);size(255);null" description:"评论的创建时间"` - Maxmodifytime int `json:"maxModifyTime" orm:"column(maxmodifytime);null" description:"评论可修改的最大时间"` - Score int `json:"score4" orm:"column(score)" description:"评论的星级"` - Scorecontent string `json:"score4Content" orm:"column(scorecontent);size(255);null" description:"评论的内容"` - Vendertags string `json:"venderTags" orm:"column(vendertags);size(255);null" description:"评论的标签"` - Updatetime string `json:"updateTime" orm:"column(updatetime);size(255);null" description:"评论的修改时间"` - UpdatedScore int `json:"updatedScore" orm:"column(updated_score);null" description:"更改后的分数"` - UpdatedScorecontent string `json:"updatedScoreContent" orm:"column(updated_scorecontent);size(255);null" description:"更改后的评论信息"` - UpdatedVendertags string `json:"updatedVenderTags" orm:"column(updated_vendertags);size(255);null" description:"更改后的标签信息"` - OrderFlag string `json:"order_flag" orm:"column(order_flag);size(255);null" description:"订单类别(0:京东 1:美团 2:饿了么)"` - Msg string `json:"-" orm:"column(msg);type(text)" description:"未解决差评的原始信息"` - UpdatedMsg string `json:"-" orm:"column(updated_msg);type(text);null" description:"解决后的差评的原始信息"` - LastPushTime string `json:"-" orm:"column(last_push_time);size(255);null" description:"上一次推送的时间"` - PushNo int `json:"-" orm:"column(push_no);null" description:"推送次数"` -} +// type JxBadComments2 struct { +// Id int `json:"id" orm:"column(id)"` +// CreatedAt time.Time `orm:"auto_now_add;type(datetime);null" json:"createdAt"` +// OrderId string `json:"order_id" orm:"column(order_id);size(25);unique" description:"订单ID"` +// Jxstoreid string `json:"jxstoreid" orm:"column(jxstoreid);size(11);index" description:"京西门店ID"` +// Userphone string `json:"userPhone" orm:"column(userphone);size(255);null" description:"评价的用户的联系方式"` +// Status int `json:"status" orm:"column(status)" description:"当前评论的状态(0:未解决 1:已解决)"` +// Createtime string `json:"createTime" orm:"column(createtime);size(255);null" description:"评论的创建时间"` +// Maxmodifytime int `json:"maxModifyTime" orm:"column(maxmodifytime);null" description:"评论可修改的最大时间"` +// Score int `json:"score4" orm:"column(score)" description:"评论的星级"` +// Scorecontent string `json:"score4Content" orm:"column(scorecontent);size(255);null" description:"评论的内容"` +// Vendertags string `json:"venderTags" orm:"column(vendertags);size(255);null" description:"评论的标签"` +// Updatetime string `json:"updateTime" orm:"column(updatetime);size(255);null" description:"评论的修改时间"` +// UpdatedScore int `json:"updatedScore" orm:"column(updated_score);null" description:"更改后的分数"` +// UpdatedScorecontent string `json:"updatedScoreContent" orm:"column(updated_scorecontent);size(255);null" description:"更改后的评论信息"` +// UpdatedVendertags string `json:"updatedVenderTags" orm:"column(updated_vendertags);size(255);null" description:"更改后的标签信息"` +// OrderFlag string `json:"order_flag" orm:"column(order_flag);size(255);null" description:"订单类别(0:京东 1:美团 2:饿了么)"` +// Msg string `json:"-" orm:"column(msg);type(text)" description:"未解决差评的原始信息"` +// UpdatedMsg string `json:"-" orm:"column(updated_msg);type(text);null" description:"解决后的差评的原始信息"` +// LastPushTime string `json:"-" orm:"column(last_push_time);size(255);null" description:"上一次推送的时间"` +// PushNo int `json:"-" orm:"column(push_no);null" description:"推送次数"` +// } diff --git a/business/partner/purchase/ebai/order_comment.go b/business/partner/purchase/ebai/order_comment.go index 491cb23ca..2f75de5c4 100644 --- a/business/partner/purchase/ebai/order_comment.go +++ b/business/partner/purchase/ebai/order_comment.go @@ -55,9 +55,9 @@ func (c *PurchaseHandler) RefreshComment(fromTime, toTime time.Time) (err error) OriginalMsg: string(utils.MustMarshal(result)), } // 直接得到的订单是饿了么的,尝试统一成饿百 - if order, err := partner.CurOrderManager.LoadOrder2(orderComment.VendorOrderID, model.VendorIDELM); err == nil { - orderComment.VendorOrderID2 = orderComment.VendorOrderID + if order, err := partner.CurOrderManager.LoadOrder2(orderComment.VendorOrderID, model.VendorIDEBAI); err == nil { orderComment.VendorOrderID = order.VendorOrderID + orderComment.VendorOrderID2 = order.VendorOrderID2 orderComment.VendorID = model.VendorIDEBAI orderComment.StoreID = jxutils.GetSaleStoreIDFromOrder(order) diff --git a/business/partner/purchase/jd/order.go b/business/partner/purchase/jd/order.go index 8c02f0896..e4425990e 100644 --- a/business/partner/purchase/jd/order.go +++ b/business/partner/purchase/jd/order.go @@ -50,7 +50,9 @@ func (c *PurchaseHandler) onOrderMsg(msg *jdapi.CallbackOrderMsg) (retVal *jdapi status := c.callbackMsg2Status(msg) if msg.StatusID == jdapi.OrderStatusAddComment || msg.StatusID == jdapi.OrderStatusModifyComment { if globals.ReallyCallPlatformAPI { - c.onOrderComment(msg) + utils.CallFuncAsync(func() { + c.onOrderComment2(msg) + }) } } err := partner.CurOrderManager.OnOrderStatusChanged(status) diff --git a/globals/beegodb/beegodb.go b/globals/beegodb/beegodb.go index 434253173..074aaa385 100644 --- a/globals/beegodb/beegodb.go +++ b/globals/beegodb/beegodb.go @@ -37,7 +37,7 @@ func Init() { orm.RegisterModel(&model.Promotion{}, &model.PromotionStore{}, &model.PromotionSku{}) orm.RegisterModel(&model.AuthBind{}, &model.User{}) - orm.RegisterModel(&legacymodel.JxBadComments2{}) + // orm.RegisterModel(&legacymodel.JxBadComments2{}) if globals.EnablePendingChange { orm.RegisterModel(&model.StoreOpRequest{}) diff --git a/main.go b/main.go index e98720874..28f79d340 100644 --- a/main.go +++ b/main.go @@ -13,6 +13,7 @@ import ( "git.rosy.net.cn/jx-callback/business/jxstore/misc" "git.rosy.net.cn/jx-callback/business/jxstore/promotion" "git.rosy.net.cn/jx-callback/business/jxutils/tasks" + "git.rosy.net.cn/jx-callback/business/partner/purchase/ebai" "git.rosy.net.cn/jx-callback/globals" "git.rosy.net.cn/jx-callback/globals/api" "git.rosy.net.cn/jx-callback/globals/beegodb" @@ -37,6 +38,7 @@ func Init() { cms.InitServiceInfo(Version, BuildDate, GitCommit) promotion.Init() misc.Init() + ebai.CurPurchaseHandler.StartRefreshComment() } // 返回true表示非运行服务