陈德本 8 yıl önce
ebeveyn
işleme
99402795a8
2 değiştirilmiş dosya ile 32 ekleme ve 14 silme
  1. 24 10
      .idea/workspace.xml
  2. 8 4
      App/Script/Controller/Server.php

+ 24 - 10
.idea/workspace.xml

@@ -3,6 +3,7 @@
   <component name="ChangeListManager">
     <list default="true" id="d417c7e2-9370-4a4d-828f-09be06adcd69" name="Default" comment="dns">
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/App/Script/Controller/Server.php" beforeDir="false" afterPath="$PROJECT_DIR$/App/Script/Controller/Server.php" afterDir="false" />
     </list>
     <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
     <option name="SHOW_DIALOG" value="false" />
@@ -37,14 +38,14 @@
       <usages-collector id="statistics.file.extensions.edit">
         <counts>
           <entry key="json" value="44" />
-          <entry key="php" value="1649" />
+          <entry key="php" value="1804" />
           <entry key="txt" value="6" />
         </counts>
       </usages-collector>
       <usages-collector id="statistics.file.types.edit">
         <counts>
           <entry key="JSON" value="44" />
-          <entry key="PHP" value="1649" />
+          <entry key="PHP" value="1804" />
           <entry key="PLAIN_TEXT" value="6" />
         </counts>
       </usages-collector>
@@ -66,8 +67,8 @@
       <file pinned="false" current-in-tab="true">
         <entry file="file://$PROJECT_DIR$/App/Script/Controller/Server.php">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="366">
-              <caret line="50" lean-forward="true" selection-start-line="50" selection-end-line="50" />
+            <state relative-caret-position="350">
+              <caret line="85" column="53" selection-start-line="85" selection-start-column="53" selection-end-line="85" selection-end-column="53" />
               <folding>
                 <element signature="e#136#155#0#PHP" expanded="true" />
               </folding>
@@ -475,7 +476,7 @@
       <workItem from="1526268446293" duration="12711000" />
       <workItem from="1528527970342" duration="845000" />
       <workItem from="1529074202261" duration="35000" />
-      <workItem from="1535705721105" duration="11338000" />
+      <workItem from="1535705721105" duration="12420000" />
     </task>
     <task id="LOCAL-00001" summary="telegram">
       <created>1519284784104</created>
@@ -645,7 +646,21 @@
       <option name="project" value="LOCAL" />
       <updated>1535756829445</updated>
     </task>
-    <option name="localTasksCounter" value="25" />
+    <task id="LOCAL-00025" summary="dns">
+      <created>1535756951408</created>
+      <option name="number" value="00025" />
+      <option name="presentableId" value="LOCAL-00025" />
+      <option name="project" value="LOCAL" />
+      <updated>1535756951408</updated>
+    </task>
+    <task id="LOCAL-00026" summary="dns">
+      <created>1535757538965</created>
+      <option name="number" value="00026" />
+      <option name="presentableId" value="LOCAL-00026" />
+      <option name="project" value="LOCAL" />
+      <updated>1535757538965</updated>
+    </task>
+    <option name="localTasksCounter" value="27" />
     <servers />
   </component>
   <component name="TestHistory">
@@ -663,7 +678,7 @@
     </history-entry>
   </component>
   <component name="TimeTrackingManager">
-    <option name="totallyTimeSpent" value="163499000" />
+    <option name="totallyTimeSpent" value="164581000" />
   </component>
   <component name="TodoView">
     <todo-panel id="selected-file">
@@ -676,7 +691,6 @@
   </component>
   <component name="ToolWindowManager">
     <frame x="22" y="35" width="1440" height="825" extended-state="0" />
-    <editor active="true" />
     <layout>
       <window_info content_ui="combo" id="Project" order="0" weight="0.25035766" />
       <window_info id="Structure" order="1" weight="0.25" />
@@ -1105,8 +1119,8 @@
     </entry>
     <entry file="file://$PROJECT_DIR$/App/Script/Controller/Server.php">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="366">
-          <caret line="50" lean-forward="true" selection-start-line="50" selection-end-line="50" />
+        <state relative-caret-position="350">
+          <caret line="85" column="53" selection-start-line="85" selection-start-column="53" selection-end-line="85" selection-end-column="53" />
           <folding>
             <element signature="e#136#155#0#PHP" expanded="true" />
           </folding>

+ 8 - 4
App/Script/Controller/Server.php

@@ -38,15 +38,16 @@ class Server extends Controller
 //        die();
 
         while (true) {
-            $data = ServerTable::select([],[],"",null,0,['sort'=>false]);
+            $data = ServerTable::select([], [], "", null, 0, ['sort' => false]);
             $str = [];
-            $ips = [];
+            $ips = $update_node = [];
             foreach ($data as $val) {
                 $ip = $val['ip'];
                 $port = $val['port'];
                 $status = $this->check($ip, $port);
                 if ($status == 1) {
-                    $ips[] = date("Y-m-d H:i:s")."\t【" . $val['domain'] . "】" . $ip . "可用";
+                    $ips[] = date("Y-m-d H:i:s") . "\t【" . $val['domain'] . "】" . $ip . "可用";
+                    $update_node[] = $val['domain'];
                     $str[] = date("Y-m-d H:i:s") . "\t\t" . $ip . "\t可用\r\n";
 
                 }
@@ -82,10 +83,13 @@ class Server extends Controller
                 }
 //                }
             }
+            $sql=implode("','", $update_node);
+            ServerTable::getConnection()->write("update ss_node set node_status='可用' where node_server in ('".$sql."')", []);
+            ServerTable::getConnection()->write("update ss_node set node_status='不可用' where node_server not in ('".$sql."')", []);
             $str[] = "第" . $i . "次执行完毕\r\n\r\n";
             echo implode("\r\n", $str);
 
-            Curl::post("https://www.phplife.net/ping.php", ['str' => "节点检查结果:\r\n".implode("\r\n", $ips)]);
+            Curl::post("https://www.phplife.net/ping.php", ['str' => "节点检查结果:\r\n" . implode("\r\n", $ips)]);
 //            file_put_contents("/root/update.txt", implode("\r\n", $str),FILE_APPEND);
 //            file_put_contents("/root/dns.txt", var_export($recode_data));
             $i++;