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 {
delayGapBegin int `json:"delayGapBegin"`
delayGapEnd int `json:"delayGapEnd"`
comments []string `json:"comments"`
DelayGapBegin int `json:"delayGapBegin"`
DelayGapEnd int `json:"delayGapEnd"`
Comments []string `json:"comments"`
}
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 {
json.Unmarshal([]byte(configs[0].Value), &config)
}
globals.SugarLogger.Debugf("replyOrderComment config: %v", utils.Format4Output(config, true))
if config == nil {
return
}
//config := replyConfig[score]
delaySeconds := config.delayGapBegin + rand.Intn(config.delayGapEnd-config.delayGapBegin)
content := config.comments[rand.Intn(len(config.comments))]
delaySeconds := config.DelayGapBegin + rand.Intn(config.DelayGapEnd-config.DelayGapBegin)
content := config.Comments[rand.Intn(len(config.Comments))]
globals.SugarLogger.Debugf("replyOrderComment orderID:%s, delaySeconds:%d, content:%s", orderComment.VendorOrderID, delaySeconds, content)
utils.AfterFuncWithRecover(time.Duration(delaySeconds)*time.Second, func() {
if handler := partner.GetPurchaseOrderHandlerFromVendorID(orderComment.VendorID); handler != nil {