|
@@ -2,7 +2,6 @@ package crontask
|
|
|
|
|
|
import (
|
|
|
"context"
|
|
|
- "github.com/zeromicro/go-zero/core/logx"
|
|
|
"regexp"
|
|
|
"time"
|
|
|
"wechat-api/ent"
|
|
@@ -92,7 +91,7 @@ func (l *CronTask) sendWxOnTimeout() {
|
|
|
latest, _ := l.svcCtx.DB.MessageRecords.Query().
|
|
|
Where(messagerecords.ContactIDEQ(s.ContactID)).
|
|
|
Where(messagerecords.StatusEQ(3)).
|
|
|
- Order(ent.Desc(messagerecords.FieldID)).
|
|
|
+ Order(ent.Asc(messagerecords.FieldID)).
|
|
|
First(ctx)
|
|
|
if latest.ID == s.ID {
|
|
|
// 创建 MessageRecords 记录
|
|
@@ -183,6 +182,7 @@ func (l *CronTask) sendWxOnTimeout() {
|
|
|
WxWxid: s.BotWxid,
|
|
|
Wxid: s.ContactWxid,
|
|
|
}
|
|
|
+
|
|
|
if node.ActionLabelAdd != nil || node.ActionLabelDel != nil {
|
|
|
visitedStages := make(map[uint64]bool)
|
|
|
_ = l.AddLabelRelationships(stageMap, *contact, currentLabelIds, node.ActionLabelAdd, node.ActionLabelDel, s.OrganizationID, visitedStages)
|
|
@@ -284,7 +284,7 @@ func (l *CronTask) AddLabelRelationships(sopStages map[uint64]*ent.SopStage, con
|
|
|
}
|
|
|
if stage.ConditionType == 1 && isLabelIdListMatchFilter(finalLabelIds, stage.ConditionOperator, stage.ConditionList) {
|
|
|
// 判断是否有 contact_wxid、source_type、source_id、sub_source_id 相同的记录
|
|
|
- x, err := l.svcCtx.DB.MessageRecords.Query().
|
|
|
+ _, err := l.svcCtx.DB.MessageRecords.Query().
|
|
|
Where(
|
|
|
messagerecords.ContactWxid(contact.Wxid),
|
|
|
messagerecords.SourceType(3),
|
|
@@ -292,10 +292,7 @@ func (l *CronTask) AddLabelRelationships(sopStages map[uint64]*ent.SopStage, con
|
|
|
messagerecords.SubSourceID(0),
|
|
|
).
|
|
|
Only(l.ctx)
|
|
|
- logx.Info("x: ", x)
|
|
|
- logx.Info("err: ", err)
|
|
|
if !ent.IsNotFound(err) {
|
|
|
- logx.Info("continue")
|
|
|
continue
|
|
|
}
|
|
|
// 判断ActionMessage是否为空
|