Jelajahi Sumber

导入爬虫增加site、channel字段

maxiaoshan 3 tahun lalu
induk
melakukan
c270057bce
2 mengubah file dengan 5 tambahan dan 3 penghapusan
  1. 4 2
      src/front/front.go
  2. 1 1
      src/web/templates/spideredit.html

+ 4 - 2
src/front/front.go

@@ -574,7 +574,7 @@ func (f *Front) Importfile() {
 						if len(rs) > 0 {
 							errorinfo[cells[1].Value] = "第" + strconv.Itoa(k) + "行重复,已经过滤"
 						} else {
-							ok, name := pf(o) //保存爬虫
+							ok, name := savelua(o) //保存爬虫
 							if ok == false {
 								errorinfo[cells[1].Value] = "第" + strconv.Itoa(k) + "行找不到作者,已经过滤"
 							} else {
@@ -592,7 +592,7 @@ func (f *Front) Importfile() {
 	}
 }
 
-func pf(o map[string]interface{}) (bool, string) {
+func savelua(o map[string]interface{}) (bool, string) {
 	AutoTpl["Base.SpiderName"] = o["name"]
 	AutoTpl["Base.SpiderCode"] = o["code"]
 	AutoTpl["Base.SpiderChannel"] = o["channel"]
@@ -655,6 +655,8 @@ func pf(o map[string]interface{}) (bool, string) {
 	param["str_content"] = ""
 	param["comeintime"] = time.Now().Unix()
 	param["code"] = o["code"]
+	param["site"] = o["name"]
+	param["channel"] = o["channel"]
 	param["createuser"] = one["s_name"]
 	param["createuserid"] = id
 	param["createuseremail"] = one["s_email"]

+ 1 - 1
src/web/templates/spideredit.html

@@ -104,7 +104,7 @@
     			   				"code":code,
     							},
 			       			success: function(r){
-                    if(r.upresult){
+                    if(r.success){
                       showMsg("更新成功",function(){
                         	window.location.href="/center"
                       })