walkor преди 11 години
родител
ревизия
58020a47a6
променени са 2 файла, в които са добавени 16 реда и са изтрити 3 реда
  1. 9 1
      applications/Statistics/Modules/main.php
  2. 7 2
      applications/Statistics/Views/main.tpl.php

+ 9 - 1
applications/Statistics/Modules/main.php

@@ -2,7 +2,7 @@
 namespace Statistics\Modules;
 function main($module, $interface, $date, $start_time, $offset)
 {
-    $err_msg = '';
+    $err_msg = $notice_msg=  '';
     $module = 'WorkerMan';
     $interface = 'Statistics';
     $today = date('Y-m-d');
@@ -140,6 +140,14 @@ function main($module, $interface, $date, $start_time, $offset)
     {
         $err_msg = '<strong>无法从以下节点获取数据:</strong>'.implode(',',  \Statistics\Lib\Cache::$lastFailedIpArray);
     }
+    
+    if(empty(\Statistics\Lib\Cache::$ServerIpList))
+    {
+        $notice_msg = <<<EOT
+<h4>数据源为空</h4>
+您可以 <a href="/?fn=admin&act=detect_server" class="btn" type="button">探测数据源</a> 或者 <a href="/?fn=admin" class="btn" type="button">添加数据源</a>
+EOT;
+    }
 
     include ST_ROOT . '/Views/header.tpl.php';
     include ST_ROOT . '/Views/main.tpl.php';

+ 7 - 2
applications/Statistics/Views/main.tpl.php

@@ -30,12 +30,17 @@
 	</div>
 	<div class="row clearfix">
 		<div class="col-md-12 column">
-		<?php if($err_msg){?>
+			<?php if($err_msg){?>
 			<div class="alert alert-dismissable alert-danger">
 				 <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
 				<strong><?php echo $err_msg;?></strong> 
 			</div>
-		<?php }?>
+			<?php }elseif($notice_msg){?>
+			<div class="alert alert-dismissable alert-info">
+				 <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
+				<strong><?php echo $notice_msg;?></strong>
+			</div>
+			<?php }?>
 			<div class="row clearfix">
 				<div class="col-md-12 column text-center">
 					<?php echo $date_btn_str;?>