- enable new order comment

This commit is contained in:
gazebo
2019-03-14 12:07:59 +08:00
parent 227f485691
commit fffb7a495b
6 changed files with 33 additions and 28 deletions

View File

@@ -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)
}
}
}

View File

@@ -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:"推送次数"`
// }

View File

@@ -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)

View File

@@ -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)

View File

@@ -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{})

View File

@@ -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表示非运行服务