Jianghan 3 years ago
parent
commit
894f66dc4b

+ 1 - 1
src/lua/spiderwarn.go

@@ -211,7 +211,7 @@ func (l *Lua) SpiderSave() {
 				if IsModifyPro(modifyinfo) {            //修改了影响项目合并的字段 进行项目合并
 					udptask.ProjectSetUdp(bid, "bidding")
 				}
-				delName1 := RedisDelKey1 + bid + "_*"
+				delName1 := RedisDelKey1 + "*_" + bid
 				redis.DelByCodePattern(RedisJYName, delName1)
 				delete(update, "modifyinfo")
 				l.SaveUpdateLog(2, reasons, bid, *old_data, update, modifyinfo) //标签日志

+ 1 - 0
src/main.go

@@ -33,6 +33,7 @@ func init() {
 	xweb.AddAction(&front.Front{})
 	xweb.AddAction(&service.RepairRule{})
 	xweb.AddAction(&service.OprdData{})
+	xweb.AddAction(&service.JyData{})
 	xweb.AddAction(&lua.Lua{})
 	xweb.RootApp().AppConfig.SessionTimeout = 1 * time.Hour
 	xweb.RootApp().Logger.SetOutputLevel(1)

+ 67 - 0
src/service/jy_service.go

@@ -0,0 +1,67 @@
+package service
+
+import (
+	"github.com/go-xweb/xweb"
+	"mongodb"
+	qu "qfw/util"
+	"util"
+)
+
+var (
+	FieldMap = map[string]interface{}{"site": 1, "spidercode": 1, "href": 1, "competehref": 1}
+)
+
+type JyData struct {
+	*xweb.Action
+	findData xweb.Mapper `xweb:"/service/jy/find"`
+	findInfo xweb.Mapper `xweb:"/service/jy/find/info"`
+}
+
+func (jy *JyData) FindData() {
+	defer qu.Catch()
+	_ = jy.Render("jy/jy_data.html")
+}
+
+func (jy *JyData) FindInfo() {
+	defer qu.Catch()
+	if jy.Method() == "POST" {
+		user := jy.GetSession("user").(map[string]interface{})
+		identity := jy.GetString("identity")
+		var id string
+		if len(identity) == 24 {
+			id = identity
+		} else {
+			identity = rpre.ReplaceAllString(identity, "")
+			identity = rsuf.ReplaceAllString(identity, "")
+			id = qu.CommonDecodeArticle("content", identity)[0]
+		}
+		qu.Debug("findInfo --- url/id ---", id)
+		if !mongodb.IsObjectIdHex(id) {
+			jy.ServeJson(map[string]interface{}{
+				"rep": false,
+				"msg": "id验证失败, " + identity,
+			})
+			return
+		}
+		info, _ := util.JYMgo.FindById("bidding", id, FieldMap)
+		if len(*info) > 0 {
+			site := qu.ObjToString((*info)["site"])
+			if site == "中国招标与采购网" || site == "元博网(采购与招标网)" {
+				(*info)["jp"] = true
+			} else {
+				(*info)["jp"] = false
+			}
+			util.Mgo.Save("jy_find_log", map[string]interface{}{"type": "查询信息", "infoid": id, "login_user": user["name"]})
+			jy.ServeJson(map[string]interface{}{
+				"rep":  true,
+				"data": *info,
+			})
+		} else {
+			jy.ServeJson(map[string]interface{}{
+				"rep": false,
+				"msg": "id查询失败, " + id,
+			})
+			return
+		}
+	}
+}

+ 4 - 4
src/service/repair_service.go

@@ -332,7 +332,7 @@ func (jy *RepairRule) RepairDelete() {
 		}
 
 		//删除redis 指定key
-		delName1 := RedisDelKey1 + id + "_*"
+		delName1 := RedisDelKey1 + "*_" + id
 		redis.DelByCodePattern(RedisJYName, delName1)
 		//jyredis := redis.RedisPool[RedisJYName].Get()
 		//defer jyredis.Close()
@@ -528,7 +528,7 @@ func (jy *RepairRule) RepairSave() {
 			}
 
 			//删除redis 指定key
-			delName1 := RedisDelKey1 + id + "_*"
+			delName1 := RedisDelKey1 + "*_" + id
 			redis.DelByCodePattern(RedisJYName, delName1)
 			//jyredis := redis.RedisPool[RedisJYName].Get()
 			//defer jyredis.Close()
@@ -916,7 +916,7 @@ func ModifyData(tmp map[string]interface{}, user map[string]interface{}) (err ma
 	}
 
 	//删除redis 指定key
-	delName1 := RedisDelKey1 + id + "_*"
+	delName1 := RedisDelKey1 + "*_" + id
 	redis.DelByCodePattern(RedisJYName, delName1)
 	//jyredis := redis.RedisPool[RedisJYName].Get()
 	//defer jyredis.Close()
@@ -1030,7 +1030,7 @@ func ModifyData1(tmp map[string]interface{}, user map[string]interface{}) (err m
 	udptask.Udpclient.WriteUdp(by, mu.OP_TYPE_DATA, addr)
 
 	//删除redis 指定key
-	delName1 := RedisDelKey1 + id + "_*"
+	delName1 := RedisDelKey1 + "*_" + id
 	redis.DelByCodePattern(RedisJYName, delName1)
 	//jyredis := redis.RedisPool[RedisJYName].Get()
 	//defer jyredis.Close()

+ 91 - 0
src/web/templates/jy/jy_data.html

@@ -0,0 +1,91 @@
+{{include "com/inc.html"}}
+<!-- Main Header -->
+{{include "com/header.html"}}
+<!-- Left side column. 权限菜单 -->
+{{include "com/menu.html"}}
+
+<div class="content-wrapper">
+    <section class="content-header">
+        <h1>查看数据</h1>
+        <ol class="breadcrumb">
+            <li><a href="#"><i class="fa fa-dashboard"></i> 首页</a></li>
+            <li><a href="#"> 查看数据</a></li>
+        </ol>
+    </section>
+    <!-- Main content -->
+    <section class="content">
+        <div class="nav-tabs-custom">
+            <form class="form-horizontal">
+                <br>
+                <div class="box-body">
+                    <div class="form-group">
+                        <label class="col-sm-2 control-label">剑鱼链接/数据ID</label>
+                        <div class="col-sm-3">
+                            <input type="text" class="form-control" id="identity" placeholder="剑鱼链接/数据ID" value="">
+                        </div>
+                        <button type="button" class="btn btn-primary" onclick="find()">查询</button>
+                    </div>
+                    <hr>
+                    <div class="form-group">
+                        <div class="form-group">
+                            <label class="col-sm-2 control-label">站点名称</label>
+                            <div class="col-sm-3">
+                                <input type="text" class="form-control" id="site" readonly>
+                            </div>
+                            <label class="control-label" id="jp_tag"></label>
+                        </div>
+                    </div>
+                    <div class="form-group">
+                        <div class="form-group">
+                            <label class="col-sm-2 control-label">爬虫代码</label>
+                            <div class="col-sm-3">
+                                <input type="text" class="form-control" id="spidercode" value="" readonly>
+                            </div>
+                        </div>
+                    </div>
+                    <div class="form-group">
+                        <div class="form-group">
+                            <label class="col-sm-2 control-label">原文链接</label>
+                            <div class="col-sm-7">
+                                <a type="text" class="form-control" id="href" target="_blank"></a>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </form>
+        </div>
+    </section>
+</div>
+
+{{include "com/footer.html"}}
+<script>
+    menuActive("/service/jy/find");
+
+    function find() {
+        let identity = $('#identity').val()
+        if (identity === "") {
+            showMsg("请填写剑鱼url或者数据id")
+            return;
+        }
+        $.ajax({
+            url: "/service/jy/find/info",
+            type: 'POST',
+            data: {"identity": identity},
+            success: function (r) {
+                hideLoading()
+                if (r.rep) {
+                    $('#site').val(r.data.site)
+                    $('#spidercode').val(r.data.spidercode)
+                    $('#href').attr("href", r.data.href).html(r.data.href)
+                    if (r.data.jp) {
+                        $('#jp_tag').html("竞品网站数据").css("color", "red")
+                    }else {
+                        $('#jp_tag').html("非竞品网站数据")
+                    }
+                } else {
+                    showMsg(r.msg);
+                }
+            }
+        })
+    }
+</script>

+ 2 - 2
src/web/templates/repair/jy_file_upload.html

@@ -6,10 +6,10 @@
 
 <div class="content-wrapper">
     <section class="content-header">
-        <h1>es数据删除</h1>
+        <h1>附件上传</h1>
         <ol class="breadcrumb">
             <li><a href="#"><i class="fa fa-dashboard"></i> 首页</a></li>
-            <li><a href="/service/jy/repair/es/del"> es数据删除</a></li>
+            <li><a href="#"> 附件上传</a></li>
         </ol>
     </section>
     <!-- Main content -->