|
@@ -11,6 +11,7 @@ import (
|
|
|
"encoding/json"
|
|
|
"fmt"
|
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
|
+ "log"
|
|
|
"time"
|
|
|
)
|
|
|
|
|
@@ -32,7 +33,7 @@ func (l *SubscribeUpdateLogic) SubscribeUpdate(req *types.SubscribeUpdateReq) (r
|
|
|
resp = &types.CommonResp{}
|
|
|
if req.UserId == "" {
|
|
|
return
|
|
|
- } else if KeyWordsRepeat(req.Items) {
|
|
|
+ } else if KeyWordsRepeat(req.MgoUserId, req.Items) {
|
|
|
resp.Data = map[string]interface{}{
|
|
|
"status": -1,
|
|
|
}
|
|
@@ -86,7 +87,7 @@ func (l *SubscribeUpdateLogic) SubscribeUpdate(req *types.SubscribeUpdateReq) (r
|
|
|
}
|
|
|
|
|
|
// 判断关键词是否异常,
|
|
|
-func KeyWordsRepeat(aitems []map[string]interface{}) bool {
|
|
|
+func KeyWordsRepeat(mgoUserId string, aitems []map[string]interface{}) bool {
|
|
|
m := map[string]bool{} //去重的数组
|
|
|
// 录入的关键词
|
|
|
i := 0
|
|
@@ -116,6 +117,7 @@ func KeyWordsRepeat(aitems []map[string]interface{}) bool {
|
|
|
}
|
|
|
key := fmt.Sprintf("%v%v%v%d", db_key, db_append, db_not, matchway)
|
|
|
if m[key] {
|
|
|
+ log.Println(mgoUserId, "--关键词有重复的--", key)
|
|
|
return true //有重复 不可以提交
|
|
|
}
|
|
|
i++
|
|
@@ -126,6 +128,7 @@ func KeyWordsRepeat(aitems []map[string]interface{}) bool {
|
|
|
}
|
|
|
if i > 300 {
|
|
|
//关键词大于300异常
|
|
|
+ log.Println(mgoUserId, "--关键词数据大于300组--")
|
|
|
return true
|
|
|
}
|
|
|
return false
|