Browse Source

同步增加新表

visuddhinanda 4 years ago
parent
commit
7e73f4c9bd
3 changed files with 14 additions and 5 deletions
  1. 3 3
      app/sync/sync.js
  2. 10 1
      app/sync/table_article_collect.php
  3. 1 1
      app/sync/table_channel.php

+ 3 - 3
app/sync/sync.js

@@ -1,9 +1,9 @@
 var sync_db_list = [
+	{ script: "sync/table_channel.php", count: -1, finished: 0, enable: false },
 	{ script: "sync/table_article.php", count: -1, finished: 0, enable: false },
+	{ script: "sync/table_article_collect.php", count: -1, finished: 0, enable: false },
 	{ script: "sync/table_term_channel.php", count: -1, finished: 0, enable: false },
 	{ script: "sync/table_term_editor.php", count: -1, finished: 0, enable: false },
-	{ script: "sync/table_article_collect.php", count: -1, finished: 0, enable: false },
-	{ script: "sync/table_channel.php", count: -1, finished: 0, enable: false },
 	{ script: "sync/table_sentence.php", count: -1, finished: 0, enable: true },
 ];
 var isStop = false;
@@ -88,7 +88,7 @@ function sync_do_db(src, dest, time = 1) {
 					return;
 				}
 				let myDate = new Date();
-				myDate.setTime(result.time);
+				myDate.setTime(time);
 
 				$("#sync_log").html(
 					$("#sync_log").html() +

+ 10 - 1
app/sync/table_article_collect.php

@@ -59,6 +59,10 @@ if (isset($_GET["op"])) {
 }
 
 switch ($op) {
+	case "sync_count":
+		$result = do_sync($input);
+		echo json_encode($result, JSON_UNESCAPED_UNICODE);
+		break;
 	case "sync":
 		$result = do_sync($input);
 		echo json_encode($result, JSON_UNESCAPED_UNICODE);
@@ -106,7 +110,12 @@ switch ($op) {
 			$output["message"]=$collection->getError();
 		}
 		echo json_encode($result, JSON_UNESCAPED_UNICODE);
-	break;	
+	break;
+	default:
+		$output["error"]=1;
+		$output["message"]="错误的操作码";	
+		echo json_encode($result, JSON_UNESCAPED_UNICODE);
+	break;
 }
 
 

+ 1 - 1
app/sync/table_channel.php

@@ -30,7 +30,7 @@ $input = (object) [
 		'status',
 		'lang',
 		'modify_time'
-    ]    
+    ]
 ];
 
 $result = do_sync($input);