瀏覽代碼

Merge branch 'raccount' into rchannel

xiaoyu 3 年之前
父節點
當前提交
e259826727

+ 13 - 0
admin/config/config.ini.php

@@ -24,4 +24,17 @@ $config['test_mchid'] = [
     1092, 10165, 10112
 ];
 
+$config['server'] = [
+    '39.99.250.4' => 'worker服务器',
+    '121.89.196.45' => 'worker服务器',
+    '121.89.201.55' => 'worker服务器',
+    '121.89.223.81' => 'worker服务器',
+    '39.101.140.116' => 'worker服务器',
+
+    '39.99.250.165' => '主数据库服务器',
+    '39.103.201.41' => '备份数据库服务器',
+    '39.103.141.163' => '后台服务器',
+
+];
+
 return $config;

+ 49 - 17
admin/control/arw_monitor.php

@@ -9,31 +9,63 @@ class arw_monitorControl extends SystemControl
 
     public function indexOp()
     {
+        global $config;
+        $servers = $config['server'];
         $ins = Cache::getInstance('cacheredis');
         $name = 'disk_monitor';
         $hash_data = $ins->hget($name, '');
         $result = [];
-        foreach ($hash_data as $ip => $str)
-        {
-            $str = str_replace('\t', "", $str);
-            $str = ltrim($str,'#');
-            $arrs = explode('#', $str);
-            foreach ($arrs as $arr) {
-                $data = explode(':', $arr);
-                $key = ltrim($data[0],'_');
-                $value = $data[1];
-                if($key == 'cur_time') {
-                    $cur_time = explode('-',$value);
-                    $value = "$cur_time[0]-$cur_time[1]-$cur_time[2] $cur_time[3]:$cur_time[4]:$cur_time[5]";
-                }else{
-                    $key = str_replace('_', "/", $key);
-                    $value = rtrim($value, '.');
+        $cur_time = time();
+        $ago_time = 0;
+
+        $time_check = function($stat_str, $cur_time) {
+            $value = explode('-', $stat_str);
+            $value = "$value[0]-$value[1]-$value[2] $value[3]:$value[4]:$value[5]";
+            $stat_time = strtotime($value);
+            if($stat_time == false) return false;
+
+            $check_seconds = 1800;
+            $diff_time = $cur_time - $stat_time;
+            if($diff_time > $check_seconds) {
+                return false;
+            }else{
+                return $diff_time;
+            }
+        };
+        foreach ($servers as $ip => $server_name) {
+            $hash_str = $hash_data[$ip];
+            $item = [];
+            if (!empty($hash_str)) {
+                $hash_str = str_replace('\t', "", $hash_str);
+                $hash_str = ltrim($hash_str, '#');
+                $arrs = explode('#', $hash_str);
+                foreach ($arrs as $arr) {
+                    $data = explode(':', $arr);
+                    $key = ltrim($data[0], '_');
+                    $value = $data[1];
+                    if ($key == 'cur_time') {
+                        $diff_time = $time_check($value, $cur_time);
+                        if ($diff_time == false) {
+                            $value = '定时更新未正常工作';
+                        } else {
+                            $ago_time = $diff_time;
+                        }
+                    } elseif (strpos($key, 'dev') !== false) {
+                        $key = str_replace('_', "/", $key);
+                        $value = explode(',', $value);
+                        $value = "{$value[1]}/{$value[0]}";
+                    } else {
+                        $key = str_replace('_', "/", $key);
+                        $value = rtrim($value, '.');
+                    }
+                    $item[$key] = $value;
+                    ksort($item);
                 }
-                $item[$key] = $value;
             }
-            $result[$ip] = $item;
+            $result[$ip . "({$server_name})"] = $item;
         }
         Tpl::output('data', $result);
+        Tpl::output('ago_time', $this->elapse_time($ago_time));
         Tpl::showpage('arw.monitor');
     }
 }

+ 24 - 37
admin/templates/default/arw.monitor.php

@@ -1,32 +1,8 @@
 <style>
     th label { display: inline-block;width: 60px; }
-    .lineLi {
-        min-width: 150px;
-        font-size: 12px;
-        color:#000;
-    }
-    #prompt ul .noLineLi {
-        background:none;
-    }
-    #prompt div {
-        display:inline-block;
-        background:none
-    }
-    #prompt ul .lineLi {
-        color:#000;
-    }
     th {
         width: 10px;
     }
-    .txt2 {
-        position: relative;
-    }
-    .btn-search {
-        position: absolute;
-        left: 332px;
-        margin-top: 3px;
-    }
-
 </style>
 
 <?php defined('InShopNC') or exit('Access Invalid!'); ?>
@@ -44,10 +20,14 @@
             <tbody>
             <tr>
                 <td class="tip_info">
-                    _dev_开头:总量,可用 <br/>
-                    _mnt_开头:总占用 <br/>
+                    dev开头:可用/总量 <br/>
+                    mnt开头:总占用 <br/>
                     cur_time:信息更新日期
                 </td>
+                <td>
+                    距上次更新时间:<span style="color: red; font-size: 16px"><?php echo $output['ago_time'];?></span>
+
+                </td>
             </tr>
             </tbody>
         </table>
@@ -61,19 +41,26 @@
         <?php if (count($output['data']) > 0) { ?>
             <?php
             foreach ($output['data'] as $key => $value) { ?>
-                <tr class="hover trFlex">
-                    <td class="align-center"><?php echo $key; ?></td>
+                <tr class="hover trFlex" style="height: 150px;">
+                    <td class="align-center"><span style="color: red; font-size: 16px"><?php echo $key; ?></span></td>
                     <td class="align-left">
-                    <?php foreach ($value as $k => $v){ ?>
-                        <span style="color: red; font-size: 16px">
-                                <?php echo $k;?>:
-                        </span>
-                        <span style="color: green; font-size: 16px">
-                                <?php echo $v;?>
-                        </span>
-                        <br/>
-                    <?php }?>
+                    <?php
+                        if(!empty($value)) {
+                            foreach ($value as $k => $v){
+                    ?>
+                            <span style="color: red; font-size: 16px">
+                                    <?php echo $k;?>:
+                            </span>
+                            <span style="color: green; font-size: 16px">
+                                    <?php echo $v;?>
+                            </span>
+                            <br/>
+                    <?php   }
+                        }else{
+                    ?>
+                        <span style="color: red; font-size: 16px">无统计数据</span>
                     </td>
+                    <?php } ?>
                 </tr>
             <?php } ?>
         <?php } else { ?>

+ 47 - 47
data/config/xyz/refill.ini.php

@@ -670,22 +670,22 @@ $zhongst_phone = ['name' => 'zhongst', 'store_id' => 39, 'qualitys' => '2',
         100 => [
             ['goods_id' => 6468, 'price' => 100.2, 'quality' => 2, 'card_type' => 'chinamobile'],
             ['goods_id' => 6468, 'price' => 100.2, 'quality' => 2, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 6468, 'price' => 100.4, 'quality' => 2, 'card_type' => 'chinatelecom']
+            ['goods_id' => 6468, 'price' => 99.9, 'quality' => 2, 'card_type' => 'chinatelecom']
         ],
         200 => [
             ['goods_id' => 6469, 'price' => 200.4, 'quality' => 2, 'card_type' => 'chinamobile'],
             ['goods_id' => 6469, 'price' => 200.4, 'quality' => 2, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 6469, 'price' => 200.8, 'quality' => 2, 'card_type' => 'chinatelecom']
+            ['goods_id' => 6469, 'price' => 199.8, 'quality' => 2, 'card_type' => 'chinatelecom']
         ],
         300 => [
             ['goods_id' => 6470, 'price' => 300.6, 'quality' => 2, 'card_type' => 'chinamobile'],
             ['goods_id' => 6470, 'price' => 300.6, 'quality' => 2, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 6470, 'price' => 301.2, 'quality' => 2, 'card_type' => 'chinatelecom']
+            ['goods_id' => 6470, 'price' => 299.7, 'quality' => 2, 'card_type' => 'chinatelecom']
         ],
         500 => [
             ['goods_id' => 6471, 'price' => 501, 'quality' => 2, 'card_type' => 'chinamobile'],
             ['goods_id' => 6471, 'price' => 501, 'quality' => 2, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 6471, 'price' => 502, 'quality' => 2, 'card_type' => 'chinatelecom']
+            ['goods_id' => 6471, 'price' => 499.5, 'quality' => 2, 'card_type' => 'chinatelecom']
         ]
     ],
     'official_sn' => true, 'refill_type' => 'api'];
@@ -2585,7 +2585,7 @@ $guochuang_nation_phone = ['name' => 'guochuang_nation', 'store_id' => 121, 'qua
             ['goods_id' => 7061, 'price' => 20.19, 'quality' => 2, 'card_type' => 'chinatelecom']
         ],
         30 => [
-            ['goods_id' => 7062, 'price' => 30.24, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7062, 'price' => 30.27, 'quality' => 2, 'card_type' => 'chinamobile'],
             ['goods_id' => 7062, 'price' => 30.024, 'quality' => 2, 'card_type' => 'chinaunicom'],
             ['goods_id' => 7062, 'price' => 30.18, 'quality' => 2, 'card_type' => 'chinatelecom']
         ],
@@ -2597,22 +2597,22 @@ $guochuang_nation_phone = ['name' => 'guochuang_nation', 'store_id' => 121, 'qua
         100 => [
             ['goods_id' => 7064, 'price' => 100.2, 'quality' => 2, 'card_type' => 'chinamobile'],
             ['goods_id' => 7064, 'price' => 100.08, 'quality' => 2, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 7064, 'price' => 100.2, 'quality' => 2, 'card_type' => 'chinatelecom']
+            ['goods_id' => 7064, 'price' => 100.1, 'quality' => 2, 'card_type' => 'chinatelecom']
         ],
         200 => [
             ['goods_id' => 7065, 'price' => 200.4, 'quality' => 2, 'card_type' => 'chinamobile'],
             ['goods_id' => 7065, 'price' => 200.16, 'quality' => 2, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 7065, 'price' => 200.4, 'quality' => 2, 'card_type' => 'chinatelecom']
+            ['goods_id' => 7065, 'price' => 200.2, 'quality' => 2, 'card_type' => 'chinatelecom']
         ],
         300 => [
             ['goods_id' => 7066, 'price' => 300.6, 'quality' => 2, 'card_type' => 'chinamobile'],
             ['goods_id' => 7066, 'price' => 300.24, 'quality' => 2, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 7066, 'price' => 300.6, 'quality' => 2, 'card_type' => 'chinatelecom']
+            ['goods_id' => 7066, 'price' => 300.3, 'quality' => 2, 'card_type' => 'chinatelecom']
         ],
         500 => [
             ['goods_id' => 7067, 'price' => 501, 'quality' => 2, 'card_type' => 'chinamobile'],
             ['goods_id' => 7067, 'price' => 500.5, 'quality' => 2, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 7067, 'price' => 501, 'quality' => 2, 'card_type' => 'chinatelecom']
+            ['goods_id' => 7067, 'price' => 500.5, 'quality' => 2, 'card_type' => 'chinatelecom']
         ]
     ],
     'official_sn' => true, 'refill_type' => 'api'];
@@ -2755,35 +2755,35 @@ $dashang_phone = ['name' => 'dashang', 'store_id' => 127, 'qualitys' => '2',
 //            ['goods_id' => 7109, 'price' => 20.16, 'quality' => 2, 'card_type' => 'chinaunicom'],
 //            ['goods_id' => 7109, 'price' => 20.46, 'quality' => 2, 'card_type' => 'chinatelecom']
 //        ],
-//        30 => [
+        30 => [
 //            ['goods_id' => 7110, 'price' => 30.36, 'quality' => 2, 'card_type' => 'chinamobile'],
-//            ['goods_id' => 7110, 'price' => 30.24, 'quality' => 2, 'card_type' => 'chinaunicom'],
-//            ['goods_id' => 7110, 'price' => 30.66, 'quality' => 2, 'card_type' => 'chinatelecom']
-//        ],
-//        50 => [
+            ['goods_id' => 7110, 'price' => 29.985, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7110, 'price' => 29.97, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        50 => [
 //            ['goods_id' => 7111, 'price' => 50.2, 'quality' => 2, 'card_type' => 'chinamobile'],
-//            ['goods_id' => 7111, 'price' => 49.875, 'quality' => 2, 'card_type' => 'chinaunicom'],
-//            ['goods_id' => 7111, 'price' => 49.9, 'quality' => 2, 'card_type' => 'chinatelecom']
-//        ],
+            ['goods_id' => 7111, 'price' => 49.975, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7111, 'price' => 49.95, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
         100 => [
             ['goods_id' => 7112, 'price' => 100.1, 'quality' => 2, 'card_type' => 'chinamobile'],
-//            ['goods_id' => 7112, 'price' => 99.75, 'quality' => 2, 'card_type' => 'chinaunicom'],
-//            ['goods_id' => 7112, 'price' => 99.8, 'quality' => 2, 'card_type' => 'chinatelecom']
+            ['goods_id' => 7112, 'price' => 99.95, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7112, 'price' => 99.9, 'quality' => 2, 'card_type' => 'chinatelecom']
         ],
         200 => [
             ['goods_id' => 7113, 'price' => 200.2, 'quality' => 2, 'card_type' => 'chinamobile'],
-//            ['goods_id' => 7113, 'price' => 199.5, 'quality' => 2, 'card_type' => 'chinaunicom'],
-//            ['goods_id' => 7113, 'price' => 199.6, 'quality' => 2, 'card_type' => 'chinatelecom']
+            ['goods_id' => 7113, 'price' => 199.9, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7113, 'price' => 199.8, 'quality' => 2, 'card_type' => 'chinatelecom']
         ],
         300 => [
             ['goods_id' => 7114, 'price' => 300.3, 'quality' => 2, 'card_type' => 'chinamobile'],
-//            ['goods_id' => 7114, 'price' => 299.25, 'quality' => 2, 'card_type' => 'chinaunicom'],
-//            ['goods_id' => 7114, 'price' => 299.4, 'quality' => 2, 'card_type' => 'chinatelecom']
+            ['goods_id' => 7114, 'price' => 299.85, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7114, 'price' => 299.7, 'quality' => 2, 'card_type' => 'chinatelecom']
         ],
         500 => [
             ['goods_id' => 7115, 'price' => 500.5, 'quality' => 2, 'card_type' => 'chinamobile'],
 //            ['goods_id' => 7115, 'price' => 498.75, 'quality' => 2, 'card_type' => 'chinaunicom'],
-//            ['goods_id' => 7115, 'price' => 499, 'quality' => 2, 'card_type' => 'chinatelecom']
+            ['goods_id' => 7115, 'price' => 499.5, 'quality' => 2, 'card_type' => 'chinatelecom']
         ]
     ],
     'official_sn' => true, 'refill_type' => 'api'];
@@ -2807,8 +2807,8 @@ $yuanta_phone = ['name' => 'yuanta', 'store_id' => 128, 'qualitys' => '5',
 //        ],
         50 => [
             ['goods_id' => 7119, 'price' => 47.25, 'quality' => 5, 'card_type' => 'chinamobile'],
-//            ['goods_id' => 7119, 'price' => 45.75, 'quality' => 5, 'card_type' => 'chinaunicom'],
-//            ['goods_id' => 7119, 'price' => 47.8, 'quality' => 5, 'card_type' => 'chinatelecom']
+            ['goods_id' => 7119, 'price' => 45, 'quality' => 5, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7119, 'price' => 45.75, 'quality' => 5, 'card_type' => 'chinatelecom']
         ],
         100 => [
             ['goods_id' => 7120, 'price' => 94.5, 'quality' => 5, 'card_type' => 'chinamobile'],
@@ -3117,22 +3117,22 @@ $linzhu_phone = ['name' => 'linzhu', 'store_id' => 144,'qualitys' => '1',
         30 => [
 //            ['goods_id' => 7237, 'price' => 28.59, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 7237, 'price' => 28.56, 'quality' => 1, 'card_type' => 'chinaunicom'],
-//            ['goods_id' => 7237, 'price' => 28.71, 'quality' => 1, 'card_type' => 'chinatelecom']
+            ['goods_id' => 7237, 'price' => 28.59, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         50 => [
             ['goods_id' => 7238, 'price' => 47.65, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 7238, 'price' => 47.6, 'quality' => 1, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 7238, 'price' => 47.85, 'quality' => 1, 'card_type' => 'chinatelecom']
+            ['goods_id' => 7238, 'price' => 47.65, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         100 => [
             ['goods_id' => 7239, 'price' => 95.3, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 7239, 'price' => 95.2, 'quality' => 1, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 7239, 'price' => 95.7, 'quality' => 1, 'card_type' => 'chinatelecom']
+            ['goods_id' => 7239, 'price' => 95.3, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         200 => [
             ['goods_id' => 7240, 'price' => 190.6, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 7240, 'price' => 190.4, 'quality' => 1, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 7240, 'price' => 191.4, 'quality' => 1, 'card_type' => 'chinatelecom']
+            ['goods_id' => 7240, 'price' => 190.6, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
 //        300 => [
 //            ['goods_id' => 7241, 'price' => 285.9, 'quality' => 1, 'card_type' => 'chinamobile'],
@@ -3943,32 +3943,32 @@ $ruixunda_phone = ['name' => 'ruixunda', 'store_id' => 169, 'qualitys' => '1',
 //        ],
         30 => [
 //            ['goods_id' => 7441, 'price' => 28.86, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 7441, 'price' => 28.35, 'quality' => 1, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 7441, 'price' => 28.38, 'quality' => 1, 'card_type' => 'chinatelecom']
+            ['goods_id' => 7441, 'price' => 28.17, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7441, 'price' => 28.35, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         50 => [
 //            ['goods_id' => 7442, 'price' => 48.1, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 7442, 'price' => 47.25, 'quality' => 1, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 7442, 'price' => 47.3, 'quality' => 1, 'card_type' => 'chinatelecom']
+            ['goods_id' => 7442, 'price' => 46.95, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7442, 'price' => 47.25, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         100 => [
 //            ['goods_id' => 7443, 'price' => 96.2, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 7443, 'price' => 94.5, 'quality' => 1, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 7443, 'price' => 94.6, 'quality' => 1, 'card_type' => 'chinatelecom']
+            ['goods_id' => 7443, 'price' => 93.9, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7443, 'price' => 94.5, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         200 => [
 //            ['goods_id' => 7444, 'price' => 192.4, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 7444, 'price' => 189, 'quality' => 1, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 7444, 'price' => 189.2, 'quality' => 1, 'card_type' => 'chinatelecom']
+            ['goods_id' => 7444, 'price' => 187.8, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7444, 'price' => 189, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         300 => [
 //            ['goods_id' => 7445, 'price' => 286.5, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 7445, 'price' => 283.5, 'quality' => 1, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 7445, 'price' => 285.6, 'quality' => 1, 'card_type' => 'chinatelecom']
+            ['goods_id' => 7445, 'price' => 281.7, 'quality' => 1, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 7445, 'price' => 283.5, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         500 => [
 //            ['goods_id' => 7446, 'price' => 477.5, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 7446, 'price' => 472.5, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7446, 'price' => 469.5, 'quality' => 1, 'card_type' => 'chinaunicom'],
 //            ['goods_id' => 7446, 'price' => 476, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
     ],
@@ -4567,25 +4567,25 @@ $ruixunda_lt_phone = ['name' => 'ruixunda_lt', 'store_id' => 187,'qualitys' => '
         30 => [
             ['goods_id' => 7587, 'price' => 28.71, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 7587, 'price' => 28.17, 'quality' => 1, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 7587, 'price' => 28.44, 'quality' => 1, 'card_type' => 'chinatelecom']
+            ['goods_id' => 7587, 'price' => 28.35, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         50 => [
             ['goods_id' => 7588, 'price' => 47.85, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 7588, 'price' => 46.95, 'quality' => 1, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 7588, 'price' => 47.4, 'quality' => 1, 'card_type' => 'chinatelecom']
+            ['goods_id' => 7588, 'price' => 47.25, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         100 => [
             ['goods_id' => 7589, 'price' => 95.7, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 7589, 'price' => 93.9, 'quality' => 1, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 7589, 'price' => 94.8, 'quality' => 1, 'card_type' => 'chinatelecom']
+            ['goods_id' => 7589, 'price' => 94.5, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         200 => [
             ['goods_id' => 7590, 'price' => 191.4, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 7590, 'price' => 187.8, 'quality' => 1, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 7590, 'price' => 189.6, 'quality' => 1, 'card_type' => 'chinatelecom']
+            ['goods_id' => 7590, 'price' => 189, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
-        300 => [['goods_id' => 7591, 'price' => 282.6, 'quality' => 1, 'card_type' => 'chinaunicom']],
-        500 => [['goods_id' => 7592, 'price' => 471, 'quality' => 1, 'card_type' => 'chinaunicom']]
+        300 => [['goods_id' => 7591, 'price' => 281.7, 'quality' => 1, 'card_type' => 'chinaunicom']],
+        500 => [['goods_id' => 7592, 'price' => 469.5, 'quality' => 1, 'card_type' => 'chinaunicom']]
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 

+ 8 - 1
helper/refill/api/xyz/yuanta/api.txt

@@ -19,4 +19,11 @@ appSecret:qXRRTTqrtAwwwtXp
 2022.3.18增加移动商品编码
 50  100033
 100 100034
-200 100035
+200 100035
+
+2022.3.24增加联通电信50
+联通50       100039
+电信50       100060
+
+2022.3.25修改电信50编码
+电信50面值     商品编码 100045

+ 2 - 0
helper/refill/api/xyz/yuanta/config.php

@@ -20,10 +20,12 @@ class config
             200 => 100035
         ],
         mtopcard\ChinaUnicomCard => [
+            50  => 100039,
             100 => 100040,
             200 => 100041
         ],
         mtopcard\ChinaTelecomCard => [
+            50  => 100045,
             100 => 100046,
             200 => 100047
         ],

+ 44 - 30
util/purge.sh

@@ -28,42 +28,54 @@ else
 fi
 
 function slave_running() {
-    ra=`mysql -uroot -pXTZ@shop@951688 --host=$1 -e "show slave status\G; " | grep Slave_IO_Running:`
-    rb=`mysql -uroot -pXTZ@shop@951688 --host=$1 -e "show slave status\G; " | grep Slave_SQL_Running:`
-
-    a=${ra#*:}
-    b=${rb#*:}
-    a=`echo $a | xargs`
-    b=`echo $b | xargs`
-
-    if [[ $a == 'Yes' &&  $b == 'Yes' ]];then
-        return 1
-    else
-      echo a,b
-      return 0
-    fi
+    ra=`mysql -uroot -pXTZ@shop@951688 --host=$1 -e "show slave status\G; " | grep Slave_IO_Running:  | awk '{print $2}'`
+    rb=`mysql -uroot -pXTZ@shop@951688 --host=$1 -e "show slave status\G; " | grep Slave_SQL_Running: | awk '{print $2}'`
+
+    # shellcheck disable=SC2068
+    for a in ${ra[@]}
+    do
+        if [[ $a != 'Yes' ]];then
+            return 0
+        fi
+    done
+
+    # shellcheck disable=SC2068
+    for b in ${rb[@]}
+    do
+        if [[ $b != 'Yes' ]];then
+            return 0
+        fi
+    done
+
+    return 1
 }
 
 function slave_behind_match() {
-    r=`mysql -uroot -pXTZ@shop@951688 --host=$host -e "show slave status\G; " | grep Seconds_Behind_Master:`
-    ssecs=${r#*:}
-    secs=`echo $ssecs | xargs`
-    echo Seconds_Behind_Master = $secs
-
-    diff=`expr $cur_diff - 3600`
-
-    if [[ $secs < $diff ]];then
-        return 1
-    else
-      return 0
-    fi
+    behinds=`mysql -uroot -pXTZ@shop@951688 --host=$host -e "show slave status\G; " | grep Seconds_Behind_Master: | awk '{print $2}'`
+
+    # shellcheck disable=SC2068
+    for ssecs in ${behinds[@]}
+    do
+      secs=`echo $ssecs | xargs`
+      echo Seconds_Behind_Master=$secs
+      echo cur_diff=$cur_diff
+      diff=`expr $cur_diff - 3600`
+
+      if [[ $secs -gt $diff || $secs -gt 1800 ]];then
+          echo behind_master=$secs
+          return 0
+      fi
+    done
+
+    return 1
 }
 
+#ra=`mysql -uroot -pXTZ@shop@951688 --host=172.26.80.10 -e "show slave status\G; " | grep Slave_IO_Running: | awk '{print $2}'`
+#mysql -uroot -pXTZ@shop@951688 --host=172.26.80.8 -e "show slave status\G; " | grep Seconds_Behind_Master:  | awk '{print $2}'
+
 #master = '172.26.80.10'
 slave_hosts=(${XYZ_SLAVE_HOSTS//:/ })
 #(172.26.80.8 172.26.80.6)
-allhosts=(${XYZ_ALL_HOSTS//:/ })
-#(172.26.80.10 172.26.80.8 172.26.80.6)
 
 # shellcheck disable=SC2068
 for host in ${slave_hosts[@]}
@@ -89,11 +101,13 @@ done
 
 today=$(date "+%Y-%m-%d")
 command="PURGE master LOGS BEFORE '${today} 00:00:00';"
+echo $command
 
 # shellcheck disable=SC2068
-for host in ${allhosts[@]}
+for host in ${slave_hosts[@]}
 do
-  mysql -uroot -pXTZ@shop@951688 --host=$host -e "$command"
+  echo $host:$command
+#  mysql -uroot -pXTZ@shop@951688 --host=$host -e "$command"
 done