This commit is contained in:
suyl
2021-08-23 11:26:05 +08:00
parent acc1ef1b61
commit 28a3fb75b1

View File

@@ -34,9 +34,9 @@ const (
) )
type tReplyConfig struct { type tReplyConfig struct {
delayGapBegin int `json:"delayGapBegin"` DelayGapBegin int `json:"delayGapBegin"`
delayGapEnd int `json:"delayGapEnd"` DelayGapEnd int `json:"delayGapEnd"`
comments []string `json:"comments"` Comments []string `json:"comments"`
} }
var ( var (
@@ -187,12 +187,13 @@ func (c *OrderManager) replyOrderComment(vendorOrgCode string, orderComment *mod
if configs, err := dao.QueryConfigs(dao.GetDB(), utils.Int2Str(score), model.ConfigTypeReply, ""); err == nil { if configs, err := dao.QueryConfigs(dao.GetDB(), utils.Int2Str(score), model.ConfigTypeReply, ""); err == nil {
json.Unmarshal([]byte(configs[0].Value), &config) json.Unmarshal([]byte(configs[0].Value), &config)
} }
globals.SugarLogger.Debugf("replyOrderComment config: %v", utils.Format4Output(config, true))
if config == nil { if config == nil {
return return
} }
//config := replyConfig[score] //config := replyConfig[score]
delaySeconds := config.delayGapBegin + rand.Intn(config.delayGapEnd-config.delayGapBegin) delaySeconds := config.DelayGapBegin + rand.Intn(config.DelayGapEnd-config.DelayGapBegin)
content := config.comments[rand.Intn(len(config.comments))] content := config.Comments[rand.Intn(len(config.Comments))]
globals.SugarLogger.Debugf("replyOrderComment orderID:%s, delaySeconds:%d, content:%s", orderComment.VendorOrderID, delaySeconds, content) globals.SugarLogger.Debugf("replyOrderComment orderID:%s, delaySeconds:%d, content:%s", orderComment.VendorOrderID, delaySeconds, content)
utils.AfterFuncWithRecover(time.Duration(delaySeconds)*time.Second, func() { utils.AfterFuncWithRecover(time.Duration(delaySeconds)*time.Second, func() {
if handler := partner.GetPurchaseOrderHandlerFromVendorID(orderComment.VendorID); handler != nil { if handler := partner.GetPurchaseOrderHandlerFromVendorID(orderComment.VendorID); handler != nil {