fengweiqiang 5 rokov pred
rodič
commit
32315e82b0

+ 11 - 14
udp_ocr_conter/main.go

@@ -13,7 +13,6 @@ import (
 	mu "mfw/util"
 	"net"
 	"net/http"
-	"qfw/common/src/qfw/util"
 	qu "qfw/util"
 	"qfw/util/mongodb"
 	"regexp"
@@ -50,7 +49,7 @@ func main() {
 		writer.WriteHeader(http.StatusOK)
 	})
 	mux.HandleFunc("/login", func(writer http.ResponseWriter, request *http.Request) {
-		tp, err := template.ParseFiles("web/login.html")
+		tp, err := template.ParseFiles("src/web/login.html")
 		if err != nil {
 			log.Println(err)
 			writer.Write([]byte( "页面找不到了~"))
@@ -70,7 +69,7 @@ func main() {
 			email := request.Form.Get("username")
 			pwd := request.Form.Get("pwd")
 			if email == "ocr_task" && pwd == "ocr_task_pwd" {
-				http.SetCookie(writer, &http.Cookie{Name: "username", Value: util.GetMd5String("email")})
+				http.SetCookie(writer, &http.Cookie{Name: "username", Value: qu.GetMd5String("email")})
 				http.Redirect(writer, request, "/query", http.StatusFound)
 			} else {
 				writer.WriteHeader(http.StatusUnauthorized)
@@ -80,10 +79,10 @@ func main() {
 		}
 
 	})
-	res := http.FileServer(http.Dir("res"))
+	res := http.FileServer(http.Dir("src/res"))
 	mux.Handle("/res/", http.StripPrefix("/res/", res))
 	mux.HandleFunc("/query", func(writer http.ResponseWriter, request *http.Request) {
-		tplogin, err := template.ParseFiles("web/login.html")
+		tplogin, err := template.ParseFiles("src/web/login.html")
 		if err != nil {
 			log.Println(err)
 			writer.Write([]byte( "页面找不到了~"))
@@ -100,7 +99,7 @@ func main() {
 			tplogin.Execute(writer, "密钥错误")
 			return
 		}
-		tp, err := template.ParseFiles("web/index.html", "public/header.html")
+		tp, err := template.ParseFiles("src/web/index.html", "src/public/header.html")
 		if err != nil {
 			log.Println(err)
 			writer.Write([]byte( "页面找不到了~"))
@@ -110,7 +109,7 @@ func main() {
 		tp.Execute(writer, task)
 	})
 	mux.HandleFunc("/reload", func(writer http.ResponseWriter, request *http.Request) {
-		tplogin, err := template.ParseFiles("web/login.html")
+		tplogin, err := template.ParseFiles("src/web/login.html")
 		if err != nil {
 			log.Println(err)
 			writer.Write([]byte( "页面找不到了~"))
@@ -122,7 +121,7 @@ func main() {
 			tplogin.Execute(writer, "请先登录")
 			return
 		}
-		tpReload, err := template.ParseFiles("web/reload.html")
+		tpReload, err := template.ParseFiles("src/web/reload.html")
 		if err != nil {
 			log.Println(err)
 			writer.Write([]byte( "页面找不到了~"))
@@ -335,11 +334,10 @@ func DynamicTask(auto *bool) {
 				DynamicTask(auto)
 			} else {
 				if DoCMD(tmpip) {
-					var isok bool
 					var tmpstr string
-					isok2, udpstr := cluster.SshPgrep(tmpip, "pgrep udp2019", isok)
+					isok2, udpstr := cluster.SshPgrep(tmpip, "pgrep udp2019")
 					tmpstr += udpstr + ";  "
-					isok3, fil2textstr := cluster.SshPgrep(tmpip, "pgrep file2text", isok2)
+					isok3, fil2textstr := cluster.SshPgrep(tmpip, "pgrep file2text")
 					tmpstr += fil2textstr
 					if isok2 && isok3 {
 						(*escObject)[i]["OcrTaskStatus"] = "successful"
@@ -389,11 +387,10 @@ func reload(ip string) string {
 			tmpip = qu.ObjToString((*escObject)[0]["ip_nw"])
 		}
 		if DoCMD(tmpip) {
-			var isok bool
 			var tmpstr string
-			isok2, udpstr := cluster.SshPgrep(tmpip, "pgrep udp2019", isok)
+			isok2, udpstr := cluster.SshPgrep(tmpip, "pgrep udp2019")
 			tmpstr += udpstr + ";  "
-			isok3, fil2textstr := cluster.SshPgrep(tmpip, "pgrep file2text", isok2)
+			isok3, fil2textstr := cluster.SshPgrep(tmpip, "pgrep file2text")
 			tmpstr += fil2textstr
 			if isok2 && isok3 {
 				(*escObject)[0]["OcrTaskStatus"] = "successful"

+ 2 - 1
udp_ocr_conter/src/cluster/ssh.go

@@ -115,10 +115,11 @@ nohup ./udp2019 >/home/udp/log.out 2>&1 &
 	}
 	return b
 }
-func SshPgrep(ip, cmd string, b bool) (bool, string ){
+func SshPgrep(ip, cmd string) (bool, string ){
 	var bStdout bytes.Buffer
 	session, err := ssHConnect("root", Password, ip, 22)
 	defer session.Close()
+	var b bool
 	if err != nil {
 		log.Println(err)
 		return b,cmd+" ssh err"+err.Error()

+ 0 - 0
udp_ocr_conter/public/header.html → udp_ocr_conter/src/public/header.html


+ 0 - 0
udp_ocr_conter/res/css/table.css → udp_ocr_conter/src/res/css/table.css


+ 0 - 0
udp_ocr_conter/res/js/jquery.js → udp_ocr_conter/src/res/js/jquery.js


+ 0 - 0
udp_ocr_conter/web/index.html → udp_ocr_conter/src/web/index.html


+ 0 - 0
udp_ocr_conter/web/login.html → udp_ocr_conter/src/web/login.html


+ 0 - 0
udp_ocr_conter/web/reload.html → udp_ocr_conter/src/web/reload.html