Jianghan 5 年之前
父節點
當前提交
4b2f5080f3

+ 8 - 1
src/models/rules_es.go

@@ -78,6 +78,8 @@ type PublishtimeMust struct {
 type PublishtimeObject struct {
 	//查询时间
 	Publishtime *Publishtime `json:"publishtime,omitempty"`
+	Publishtime1 *Publishtime1 `json:"publishtime1,omitempty"`
+	Publishtime2 *Publishtime2 `json:"publishtime2,omitempty"`
 }
 
 //查询时间
@@ -85,7 +87,12 @@ type Publishtime struct {
 	Gte int `json:"gte"`
 	Lt  int `json:"lt"`
 }
-
+type Publishtime1 struct {
+	Gte int `json:"gte"`
+}
+type Publishtime2 struct {
+	Lt  int `json:"lt"`
+}
 //字段是或否存在
 type ExistfieldsObjectMust struct {
 	ExistfieldsObject *ExistfieldsObject `json:"constant_score,omitempty"`

+ 11 - 0
src/util/utiltag.go

@@ -95,6 +95,7 @@ func UtilEsFind(tags map[string]interface{}) (error, int64) {
 	searchResult, err := client.Search(EsIndex).Source(esquery).Do()
 	if err == nil && searchResult.Hits != nil {
 		datas := make([]map[string]interface{}, 0)
+		util.Debug("es查询到的数量:", searchResult.Hits.TotalHits)
 		for _, v := range searchResult.Hits.Hits {
 			item := make(map[string]interface{})
 			if json.Unmarshal(*v.Source, &item) == nil {
@@ -230,6 +231,14 @@ func Utiltags(tag map[string]interface{}) string {
 			Gte: tab.Istarttime,
 			Lt:  tab.Iendtime,
 		}}})
+	}else if tab.Istarttime > 0 {
+		ffBoolObject.Must = append(ffBoolObject.Must, models.PublishtimeMust{PublishtimeObject: &models.PublishtimeObject{Publishtime1: &models.Publishtime1{
+			Gte: tab.Istarttime,
+		}}})
+	}else if tab.Iendtime > 0 {
+		ffBoolObject.Must = append(ffBoolObject.Must, models.PublishtimeMust{PublishtimeObject: &models.PublishtimeObject{Publishtime2: &models.Publishtime2{
+			Lt: tab.Iendtime,
+		}}})
 	}
 	if tab.Sbudget != "" {
 		if strings.Contains(tab.Sbudget, "大于") && strings.Contains(tab.Sbudget, "小于") {
@@ -396,6 +405,8 @@ func Utiltags(tag map[string]interface{}) string {
 	rdata["query"] = QueryObjecct
 	esbytes, _ := json.Marshal(rdata)
 	esStr := strings.ReplaceAll(string(esbytes), "regexp1", "regexp")
+	esStr = strings.ReplaceAll(esStr, "publishtime1", "publishtime")
+	esStr = strings.ReplaceAll(esStr, "publishtime2", "publishtime")
 	return strings.ReplaceAll(esStr, "regexp2", "regexp")
 }
 

+ 2 - 1
src/web/templates/private/common_rule_create.html

@@ -162,7 +162,7 @@
                                                 })
                                             </script>
                                         </div>
-                                    </div>S
+                                    </div>
                                     <div class="form-group">
                                         <label class="col-sm-2 control-label ">开始时间</label>
                                         <div class="col-sm-3">
@@ -375,6 +375,7 @@
 
     //表单数据
     var dataMap = {
+        "id": "",
         "s_tagname": "",
         "s_tagfield": "",
         "s_serverperson": "",

+ 6 - 0
src/web/templates/private/common_rule_edit.html

@@ -321,6 +321,11 @@
                             </div>
                             <table id="keywords" class="table table-bordered">
                                 <thead>
+                                <div style="margin: 10px 10px 0px;">
+                                    <a class="btn btn-twitter" onclick="add_Rule()">新增</a>
+                                    <a class="btn btn-twitter" onclick="modify_Rule()">修改</a>
+                                    <a class="btn btn-twitter" onclick="del_Rule()">删除</a>
+                                </div>
                                 <tr>
                                     <th>编号</th>
                                     <th><input type="checkbox" onclick="allSelect(this)" id="allCheckbox"></th>
@@ -1086,6 +1091,7 @@
         }else {
             dataMap["i_globalnotkeytype"] = 0
         }
+        console.log(dataMap)
         dataMap["o_rules"] = JSON.stringify(o_rules);
         $.ajax({
             url: "/service/common_rule/save",

+ 5 - 0
src/web/templates/private/rule_create.html

@@ -330,6 +330,11 @@
                             </div>
                             <table id="keywords" class="table table-bordered">
                                 <thead>
+                                <div style="margin: 10px 10px 0px;">
+                                    <a class="btn btn-twitter" onclick="add_Rule()">新增</a>
+                                    <a class="btn btn-twitter" onclick="modify_Rule()">修改</a>
+                                    <a class="btn btn-twitter" onclick="del_Rule()">删除</a>
+                                </div>
                                 <tr>
                                     <th>编号</th>
                                     <th><input type="checkbox" onclick="allSelect(this)" id="allCheckbox"></th>

+ 5 - 0
src/web/templates/private/rule_edit.html

@@ -339,6 +339,11 @@
                             </div>
                             <table id="keywords" class="table table-bordered">
                                 <thead>
+                                <div style="margin: 10px 10px 0px;">
+                                    <a class="btn btn-twitter" onclick="add_Rule()">新增</a>
+                                    <a class="btn btn-twitter" onclick="modify_Rule()">修改</a>
+                                    <a class="btn btn-twitter" onclick="del_Rule()">删除</a>
+                                </div>
                                 <tr>
                                     <th>编号</th>
                                     <th><input type="checkbox" onclick="allSelect(this)" id="allCheckbox"></th>