Jianghan 6 месяцев назад
Родитель
Сommit
2538da42a3

+ 88 - 88
CMPlatform/history/task.go

@@ -365,8 +365,8 @@ func processedData_A(c *Customer, data *tempData) {
 			EntInfo(findwinner, tmp)
 		}
 	}
-	//matchKey := map[string]bool{}     //记录所有匹配上的关键词
-	//matchKeyType := map[string]bool{} //记录关键词对应的匹配方式
+	matchKey := map[string]bool{}     //记录所有匹配上的关键词
+	matchKeyType := map[string]bool{} //记录关键词对应的匹配方式
 	//先获取用到的所有字段值
 	fieldText := map[string]interface{}{}
 	for field, _ := range sr.Fields {
@@ -389,99 +389,99 @@ func processedData_A(c *Customer, data *tempData) {
 		因为要记录所有匹配上的关键词,所有优先匹配附加词,在匹配关键词
 	*/
 	//1.附加词匹配
-	//IsMatch := false
-	//// common.Debug("sr.AW---", len(sr.AW))
-	//for i, aw := range sr.AW {
-	//	// common.Debug("-------------------------开始附加词匹配--------------------------")
-	//	IsMatchAddKey := RegMatch(fieldText, aw.MatchType, aw.KeyReg, nil, nil, false, true)
-	//	// common.Debug(IsMatchAddKey, "------------------------------------------------------------")
-	//
-	//	//2.关键词匹配
-	//	if IsMatchAddKey {
-	//		kw := sr.KW[i]
-	//		// common.Debug("-------------------------开始关键词匹配--------------------------")
-	//		IsMatchKey := RegMatch(fieldText, kw.MatchType, kw.KeyReg, matchKey, matchKeyType, true, false)
-	//		// common.Debug(IsMatchKey, "------------------------------------------------------------")
-	//		if IsMatchKey {
-	//			IsMatch = true
-	//		}
-	//	}
-	//}
-	//if len(sr.AW) == 0 {
-	//	IsMatch = true
-	//}
-	///*
-	//	到此已经匹配完数据
-	//*/
-	//if !IsMatch {
-	//	log.Debug("---------------------", zap.String("id", id), zap.Any("IsMatch", IsMatch))
-	//}
-	//if IsMatch {
-	//匹配成功,数据上新增规则id,matchKey,item并临时保存数据
-	// tmpMatchKey := MapDataToArr(matchKey)
-	//tmpMatchKeyType := MapDataToArr(matchKeyType)
-	tmp["matchkey"], tmp["matchtype"] = GetMactchKeys(sr.Maths, tmp)
-	//tmp["matchtype"] = strings.Join(tmpMatchKeyType, ",")
-	tmp["ruleid"] = sr.ID
-	tmp["rulename"] = sr.Name
+	IsMatch := false
+	// common.Debug("sr.AW---", len(sr.AW))
+	for i, aw := range sr.AW {
+		// common.Debug("-------------------------开始附加词匹配--------------------------")
+		IsMatchAddKey := RegMatch(fieldText, aw.MatchType, aw.KeyReg, nil, nil, false, true)
+		// common.Debug(IsMatchAddKey, "------------------------------------------------------------")
 
-	//开始打标签
-	//common.Debug("c.IsTagRule+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++")
-	if c.IsTagRule {
-		TagRuleFuc(c.AppId, c.PushModel, 1, c.TagRules, sr, tmp, fieldText)
-	}
-	if c.IsTagRule2 {
-		TagRuleFuc(c.AppId, c.PushModel, 2, c.TagRules2, sr, tmp, fieldText)
+		//2.关键词匹配
+		if IsMatchAddKey {
+			kw := sr.KW[i]
+			// common.Debug("-------------------------开始关键词匹配--------------------------")
+			IsMatchKey := RegMatch(fieldText, kw.MatchType, kw.KeyReg, matchKey, matchKeyType, true, false)
+			// common.Debug(IsMatchKey, "------------------------------------------------------------")
+			if IsMatchKey {
+				IsMatch = true
+			}
+		}
 	}
-	if c.IsTagRule3 {
-		TagRuleFuc(c.AppId, c.PushModel, 3, c.TagRules3, sr, tmp, fieldText)
+	if len(sr.AW) == 0 {
+		IsMatch = true
 	}
-	//item
-	switch c.PushModel {
-	case 0:
-		tmp["item"] = "数据"
-	case 1:
-		tmp["item"] = dm.Name
-	case 2:
-		//tmp["item"] = sr.Name
-	case 3:
-		tmp["item"] = dm.Name + "_" + sr.Name
-	case 4:
-		tmp["item"] = sr.Name
+	/*
+		到此已经匹配完数据
+	*/
+	if !IsMatch {
+		log.Debug("---------------------", zap.String("id", id), zap.Any("IsMatch", IsMatch))
 	}
-	//appid
-	tmp["appid"] = c.AppId
-	//部门名称
-	tmp["departname"] = dm.Name
-	tmp["departid"] = dm.ID
-	//存储数据
-	//dm.DataLock.Lock()
-	//tmpMap := map[string]interface{}{id: tmp}
-	//dm.SaveDataMap[sr.ID] = append(dm.SaveDataMap[sr.ID], tmpMap)
-	//dm.DataLock.Unlock()
-	//c.saveBeforeChan <- &tempData{dm: dm, rule: sr, data: tmp}
+	if IsMatch {
+		//匹配成功,数据上新增规则id,matchKey,item并临时保存数据
+		// tmpMatchKey := MapDataToArr(matchKey)
+		//tmpMatchKeyType := MapDataToArr(matchKeyType)
+		tmp["matchkey"], tmp["matchtype"] = GetMactchKeys(sr.Maths, tmp)
+		//tmp["matchtype"] = strings.Join(tmpMatchKeyType, ",")
+		tmp["ruleid"] = sr.ID
+		tmp["rulename"] = sr.Name
 
-	m1 := c.RemoveRepeatData(tmp)
-	c.saveTempLock.Lock()
-	if m1 != nil {
-		c.saveTempArr = append(c.saveTempArr, []map[string]interface{}{
-			{"_id": mongodb.StringTOBsonId(id)},
-			{"$set": m1},
-		})
+		//开始打标签
+		//common.Debug("c.IsTagRule+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++")
+		if c.IsTagRule {
+			TagRuleFuc(c.AppId, c.PushModel, 1, c.TagRules, sr, tmp, fieldText)
+		}
+		if c.IsTagRule2 {
+			TagRuleFuc(c.AppId, c.PushModel, 2, c.TagRules2, sr, tmp, fieldText)
+		}
+		if c.IsTagRule3 {
+			TagRuleFuc(c.AppId, c.PushModel, 3, c.TagRules3, sr, tmp, fieldText)
+		}
+		//item
+		switch c.PushModel {
+		case 0:
+			tmp["item"] = "数据"
+		case 1:
+			tmp["item"] = dm.Name
+		case 2:
+			//tmp["item"] = sr.Name
+		case 3:
+			tmp["item"] = dm.Name + "_" + sr.Name
+		case 4:
+			tmp["item"] = sr.Name
+		}
+		//appid
+		tmp["appid"] = c.AppId
+		//部门名称
+		tmp["departname"] = dm.Name
+		tmp["departid"] = dm.ID
+		//存储数据
+		//dm.DataLock.Lock()
+		//tmpMap := map[string]interface{}{id: tmp}
+		//dm.SaveDataMap[sr.ID] = append(dm.SaveDataMap[sr.ID], tmpMap)
+		//dm.DataLock.Unlock()
+		//c.saveBeforeChan <- &tempData{dm: dm, rule: sr, data: tmp}
+
+		m1 := c.RemoveRepeatData(tmp)
+		c.saveTempLock.Lock()
+		if m1 != nil {
+			c.saveTempArr = append(c.saveTempArr, []map[string]interface{}{
+				{"_id": mongodb.StringTOBsonId(id)},
+				{"$set": m1},
+			})
+		} else {
+			c.saveTempArr = append(c.saveTempArr, []map[string]interface{}{
+				{"_id": mongodb.StringTOBsonId(id)},
+				{"$set": tmp},
+			})
+		}
+		if len(c.saveTempArr) > 200 {
+			util.MgoSave.UpSertBulk(c.saveTempColl, c.saveTempArr...)
+			c.saveTempArr = [][]map[string]interface{}{}
+		}
+		c.saveTempLock.Unlock()
 	} else {
-		c.saveTempArr = append(c.saveTempArr, []map[string]interface{}{
-			{"_id": mongodb.StringTOBsonId(id)},
-			{"$set": tmp},
-		})
-	}
-	if len(c.saveTempArr) > 200 {
-		util.MgoSave.UpSertBulk(c.saveTempColl, c.saveTempArr...)
-		c.saveTempArr = [][]map[string]interface{}{}
+		//common.Debug("------------", id, IsMatch)
 	}
-	c.saveTempLock.Unlock()
-	//} else {
-	// common.Debug("------------", id, IsMatch)
-	//}
 }
 
 // legal_person,company_email,company_phone

+ 1 - 1
JySEPlatform/web/templates/client/adminIndex.html

@@ -129,7 +129,7 @@
                     "data": "_id", width: "20%", render: function (val, a, row, pos) {
                         tmp = '<div>' +
                             '<a class="btn btn-sm btn-primary" href="/seplatform/personnel/index?id='+ row.id +'">规则列表</a>&nbsp&nbsp'+
-                            '<a class="btn btn-sm btn-primary" href="/seplatform/client/exportLog?id='+ row.id +'">导出日志</a>&nbsp&nbsp'+
+                            // '<a class="btn btn-sm btn-primary" href="/seplatform/client/exportLog?id='+ row.id +'">导出日志</a>&nbsp&nbsp'+
                             '</div>';
                         return tmp
                     }

+ 2 - 2
JySEPlatform/web/templates/client/cuser_rule_edit.html

@@ -48,8 +48,8 @@
                 <form style="display:none" id='uploadform' method='post'>
                     <input type='file' name='xlsx' id='file'/>
                 </form>
-                <a class="btn btn-sm btn-instagram previewDatass" onclick="previewData1()"><i class="fa fa-fw fa-database fa-lg"></i>快速预览</a>
-                <button class="btn btn-warning btn-sm previewDatass" onclick="previewData()"><i class="fa fa-fw fa-eye fa-lg"></i>数据导出</button>
+                <a class="btn btn-sm btn-instagram" onclick="previewData1()"><i class="fa fa-fw fa-database fa-lg"></i>快速预览</a>
+                <button class="btn btn-warning btn-sm" onclick="previewData()"><i class="fa fa-fw fa-eye fa-lg"></i>数据导出</button>
                 <button class="btn btn-warning btn-sm" onclick="exportPreview()"><i class="fa fa-fw fa-eye fa-lg"></i>导出预览</button>
             </small>
             <a class="btn btn-primary btn-sm" id="back" style="float: right"> 返回</a>

+ 3 - 3
JySEPlatform/web/templates/client/personnelIndex.html

@@ -6,8 +6,8 @@
     <section class="content-header">
         <h1>
             <small><a id="addTag" class="btn btn-primary opr">新增规则</a></small>
-            <small style="color: #0a001f">数据量余额:</small><small><h4 id="left" style="color: red;"></h4></small>
-            <small style="color: #0a001f">条</small>
+<!--            <small style="color: #0a001f">数据量余额:</small><small><h4 id="left" style="color: red;"></h4></small>-->
+<!--            <small style="color: #0a001f">条</small>-->
             <a class="btn btn-primary opr" id="back" style="float: right" href="javascript:history.go(-1)"> 返回</a>
         </h1>
     </section>
@@ -118,7 +118,7 @@
                     "data": "_id", width: "10%", render: function (val, a, row, pos) {
                         tmp = '<div>' +
                             '<a class="btn btn-sm btn-primary" href="/seplatform/client/rule/edit?id='+ row._id +'">编辑</a>&nbsp;&nbsp;' +
-                            '<a class="btn btn-sm btn-danger" onclick="del(\'' + val + '\',\'' + row.i_isuse + '\')">删除</a>' +
+                            '<a class="btn btn-sm btn-danger"  onclick="del(\'' + val + '\',\'' + row.i_isuse + '\')">删除</a>' +
                             '</div>';
                         return tmp
                     }

+ 68 - 0
JySEPlatform/web/templates/com/header.html

@@ -0,0 +1,68 @@
+
+<!-- common modal -->
+<div id="com-alert" class="modal" style="z-index:9999;display: none;" >
+    <div class="modal-dialog modal-sm" >
+        <div  class="modal-content" >
+            <div class="modal-header" >
+                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
+                <h5 class="modal-title"><i class="fa fa-exclamation-circle"></i> [Title]</h5>
+            </div>
+            <div class="modal-body small " >
+                <p style="font-size: 14px">[Message]</p>
+            </div>
+            <div class="modal-footer" >
+                <button type="button" class="btn btn-default cancel" data-dismiss="modal">[BtnCancel]</button>
+                <button type="button" class="btn btn-primary ok" data-dismiss="modal">[BtnOk]</button>
+            </div>
+        </div>
+    </div>
+</div>
+
+<div id="modal-topuserinfo" class="modal fade">
+    <div class="modal-dialog">
+        <form id="topuserform" class="form-horizontal" role="form">
+            <div class="modal-content">
+                <div class="modal-header">
+                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
+                        <span aria-hidden="true">&times;</span></button>
+                    <h4 class="modal-title">用户信息</h4>
+                </div>
+                <div class="modal-body">
+
+
+                    <div class="form-group">
+                        <label for="site" class="col-sm-2 control-label">姓名:</label>
+                        <div class="col-sm-8">
+                            <input id="t_name" type="text" value={{(session "user").name}} class="form-control" disabled>
+                        </div>
+                    </div>
+                    <div class="form-group">
+                        <label for="modify" class="col-sm-2 control-label">角色:</label>
+                        <div class="col-sm-8">
+                            <select id="t_role" class="form-control" disabled>
+                                <option value={{(session "user").role}}>
+                                <script>
+                                    role={{(session "user").role}};
+                                    if(role=="1"){
+                                        document.write("管理员")
+                                    }else if (role=="3"){
+                                        document.write("用户")
+                                    }
+                                </script>
+                                </option>
+                            </select>
+                        </div>
+                    </div>
+                    <div class="modal-footer">
+                        <!--			        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>-->
+                        <!--			        <button type="button" class="btn btn-primary" onclick="t_save()">保存</button>-->
+                    </div>
+                </div>
+            </div>
+            <!-- /.modal-content -->
+        </form>
+    </div>
+    <!-- /.modal-dialog -->
+</div>
+
+<!-- /.modal -->