Browse Source

任务描述保存更新

maxiaoshan 2 years ago
parent
commit
4ac9b7c135
2 changed files with 60 additions and 58 deletions
  1. 58 57
      src/task/flush.go
  2. 2 1
      src/web/templates/taskedit.html

+ 58 - 57
src/task/flush.go

@@ -1,59 +1,60 @@
 package task
 
-import (
-	"fmt"
-	"mongodb"
-	"time"
-	u "util"
-
-	"front"
-)
-
-var timer *time.Ticker
-
-func init() {
-	timer = time.NewTicker(1 * time.Second)
-}
-
-func TimeTask() {
-	for t := range timer.C {
-		hour := t.Hour()
-		second := t.Second()
-		minutes := t.Minute()
-		if hour == 0 && minutes == 0 && second == 0 {
-			FlushAuthor()
-		}
-	}
-}
-
-func FlushAuthor() {
-	query := map[string]interface{}{
-		"flush": map[string]interface{}{"$exists": false},
-		"next":  map[string]interface{}{"$exists": true},
-		"l_uploadtime": map[string]interface{}{
-			"$lte": time.Now().AddDate(0, 0, -30).Unix(),
-		},
-		"$where": "this.createuseremail != this.next",
-	}
-	//rets := *mgdb.Find("luaconfig", query, bson.M{}, bson.M{}, false, -1, -1)
-	rets, _ := u.MgoEB.Find("luaconfig", query, nil, nil, false, -1, -1)
-	for _, v := range *rets {
-		next, ok := v["next"].(string)
-		if ok {
-			one, _ := u.MgoEB.FindOne("user", map[string]interface{}{"s_email": next})
-			if len(*one) > 0 {
-				update := map[string]interface{}{
-					"$set": map[string]interface{}{
-						"createuser":      (*one)["s_name"],
-						"createuserid":    mongodb.BsonIdToSId((*one)["_id"]),
-						"createuseremail": next,
-						"flush":           "ok",
-					},
-				}
-				front.Wlog("转移爬虫给", v["code"].(string), fmt.Sprint((*one)["s_name"]), next, "系统定时任务", nil)
-				//mgdb.Update("luaconfig", bson.M{"_id": v["_id"]}, update, false, false)
-				u.MgoEB.UpdateById("luaconfig", v["_id"], update)
-			}
-		}
-	}
-}
+//
+//import (
+//	"fmt"
+//	"mongodb"
+//	"time"
+//	u "util"
+//
+//	"front"
+//)
+//
+//var timer *time.Ticker
+//
+//func init() {
+//	timer = time.NewTicker(1 * time.Second)
+//}
+//
+//func TimeTask() {
+//	for t := range timer.C {
+//		hour := t.Hour()
+//		second := t.Second()
+//		minutes := t.Minute()
+//		if hour == 0 && minutes == 0 && second == 0 {
+//			FlushAuthor()
+//		}
+//	}
+//}
+//
+//func FlushAuthor() {
+//	query := map[string]interface{}{
+//		"flush": map[string]interface{}{"$exists": false},
+//		"next":  map[string]interface{}{"$exists": true},
+//		"l_uploadtime": map[string]interface{}{
+//			"$lte": time.Now().AddDate(0, 0, -30).Unix(),
+//		},
+//		"$where": "this.createuseremail != this.next",
+//	}
+//	//rets := *mgdb.Find("luaconfig", query, bson.M{}, bson.M{}, false, -1, -1)
+//	rets, _ := u.MgoEB.Find("luaconfig", query, nil, nil, false, -1, -1)
+//	for _, v := range *rets {
+//		next, ok := v["next"].(string)
+//		if ok {
+//			one, _ := u.MgoEB.FindOne("user", map[string]interface{}{"s_email": next})
+//			if len(*one) > 0 {
+//				update := map[string]interface{}{
+//					"$set": map[string]interface{}{
+//						"createuser":      (*one)["s_name"],
+//						"createuserid":    mongodb.BsonIdToSId((*one)["_id"]),
+//						"createuseremail": next,
+//						"flush":           "ok",
+//					},
+//				}
+//				front.Wlog("转移爬虫给", v["code"].(string), fmt.Sprint((*one)["s_name"]), next, "系统定时任务", nil)
+//				//mgdb.Update("luaconfig", bson.M{"_id": v["_id"]}, update, false, false)
+//				u.MgoEB.UpdateById("luaconfig", v["_id"], update)
+//			}
+//		}
+//	}
+//}

+ 2 - 1
src/web/templates/taskedit.html

@@ -343,7 +343,8 @@
 		var urgencyChange = "no"
 		var $urgency = $("input:radio[name='urgency']:checked").val();
 		var $modify = $(".task-edit #modify").val();
-		var $descript = $(".task-edit #descript").val().trim().replace(/\s/g,"");
+		console.log( $(".task-edit #descript").val())
+		var $descript = $(".task-edit #descript").val().trim();
 		var $complete = $(".task-edit #complete").val();
 		//判断最迟完成时间是否改变
 		if($complete != complete){