mirror of
https://github.com/netcccyun/dnsmgr.git
synced 2024-11-15 19:22:22 +08:00
1.6
This commit is contained in:
parent
bf6a091c8d
commit
57a237f898
|
@ -10,6 +10,7 @@ use think\console\input\Argument;
|
|||
use think\console\input\Option;
|
||||
use think\console\Output;
|
||||
use think\facade\Db;
|
||||
use think\facade\Config;
|
||||
use app\lib\TaskRunner;
|
||||
|
||||
class Dmtask extends Command
|
||||
|
@ -23,6 +24,9 @@ class Dmtask extends Command
|
|||
|
||||
protected function execute(Input $input, Output $output)
|
||||
{
|
||||
$res = Db::name('config')->cache('configs',0)->column('value','key');
|
||||
Config::set($res, 'sys');
|
||||
|
||||
config_set('run_error', '');
|
||||
if(!extension_loaded('swoole')){
|
||||
$output->writeln('[Error] 未安装Swoole扩展');
|
||||
|
|
|
@ -10,6 +10,7 @@ use think\console\input\Argument;
|
|||
use think\console\input\Option;
|
||||
use think\console\Output;
|
||||
use think\facade\Db;
|
||||
use think\facade\Config;
|
||||
use app\lib\OptimizeService;
|
||||
|
||||
class Opiptask extends Command
|
||||
|
@ -23,6 +24,9 @@ class Opiptask extends Command
|
|||
|
||||
protected function execute(Input $input, Output $output)
|
||||
{
|
||||
$res = Db::name('config')->cache('configs',0)->column('value','key');
|
||||
Config::set($res, 'sys');
|
||||
|
||||
(new OptimizeService())->execute();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -86,6 +86,7 @@ class Dmonitor extends BaseController
|
|||
'frequency' => input('post.frequency/d'),
|
||||
'cycle' => input('post.cycle/d'),
|
||||
'timeout' => input('post.timeout/d'),
|
||||
'proxy' => input('post.proxy/d'),
|
||||
'remark' => input('post.remark', null, 'trim'),
|
||||
'recordinfo' => input('post.recordinfo', null, 'trim'),
|
||||
'addtime' => time(),
|
||||
|
@ -121,6 +122,7 @@ class Dmonitor extends BaseController
|
|||
'frequency' => input('post.frequency/d'),
|
||||
'cycle' => input('post.cycle/d'),
|
||||
'timeout' => input('post.timeout/d'),
|
||||
'proxy' => input('post.proxy/d'),
|
||||
'remark' => input('post.remark', null, 'trim'),
|
||||
'recordinfo' => input('post.recordinfo', null, 'trim'),
|
||||
];
|
||||
|
@ -233,6 +235,23 @@ class Dmonitor extends BaseController
|
|||
return View::fetch();
|
||||
}
|
||||
|
||||
public function proxyset()
|
||||
{
|
||||
if(!checkPermission(2)) return $this->alert('error', '无权限');
|
||||
if(request()->isPost()){
|
||||
$params = input('post.');
|
||||
foreach ($params as $key=>$value){
|
||||
if (empty($key)) {
|
||||
continue;
|
||||
}
|
||||
config_set($key, $value);
|
||||
Cache::delete('configs');
|
||||
}
|
||||
return json(['code'=>0, 'msg'=>'succ']);
|
||||
}
|
||||
return View::fetch();
|
||||
}
|
||||
|
||||
public function mailtest()
|
||||
{
|
||||
if(!checkPermission(2)) return $this->alert('error', '无权限');
|
||||
|
@ -246,6 +265,21 @@ class Dmonitor extends BaseController
|
|||
}
|
||||
}
|
||||
|
||||
public function tgbottest()
|
||||
{
|
||||
if(!checkPermission(2)) return $this->alert('error', '无权限');
|
||||
$tgbot_token = config_get('tgbot_token');
|
||||
$tgbot_chatid = config_get('tgbot_chatid');
|
||||
if(empty($tgbot_token) || empty($tgbot_chatid)) return json(['code'=>-1, 'msg'=>'请先保存设置']);
|
||||
$content = "<strong>消息发送测试</strong>\n\n这是一封测试消息!\n\n来自:".request()->root(true);
|
||||
$result = \app\lib\MsgNotice::send_telegram_bot($content);
|
||||
if($result === true){
|
||||
return json(['code'=>0, 'msg'=>'消息发送成功!']);
|
||||
}else{
|
||||
return json(['code'=>-1, 'msg'=>'消息发送失败!'.$result]);
|
||||
}
|
||||
}
|
||||
|
||||
public function clean()
|
||||
{
|
||||
if(!checkPermission(2)) return $this->alert('error', '无权限');
|
||||
|
|
|
@ -4,7 +4,7 @@ namespace app\lib;
|
|||
|
||||
class CheckUtils
|
||||
{
|
||||
public static function curl($url, $timeout, $ip = null)
|
||||
public static function curl($url, $timeout, $ip = null, $proxy = false)
|
||||
{
|
||||
$status = true;
|
||||
$errmsg = null;
|
||||
|
@ -19,6 +19,28 @@ class CheckUtils
|
|||
}
|
||||
}
|
||||
$ch = curl_init();
|
||||
if($proxy){
|
||||
$proxy_server = config_get('proxy_server');
|
||||
$proxy_port = intval(config_get('proxy_port'));
|
||||
$proxy_userpwd = config_get('proxy_user').':'.config_get('proxy_pwd');
|
||||
$proxy_type = config_get('proxy_type');
|
||||
if($proxy_type == 'https'){
|
||||
$proxy_type = CURLPROXY_HTTPS;
|
||||
}elseif($proxy_type == 'sock4'){
|
||||
$proxy_type = CURLPROXY_SOCKS4;
|
||||
}elseif($proxy_type == 'sock5'){
|
||||
$proxy_type = CURLPROXY_SOCKS5;
|
||||
}else{
|
||||
$proxy_type = CURLPROXY_HTTP;
|
||||
}
|
||||
curl_setopt($ch, CURLOPT_PROXYAUTH, CURLAUTH_BASIC);
|
||||
curl_setopt($ch, CURLOPT_PROXY, $proxy_server);
|
||||
curl_setopt($ch, CURLOPT_PROXYPORT, $proxy_port);
|
||||
if($proxy_userpwd != ':'){
|
||||
curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxy_userpwd);
|
||||
}
|
||||
curl_setopt($ch, CURLOPT_PROXYTYPE, $proxy_type);
|
||||
}
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
||||
|
|
|
@ -65,7 +65,7 @@ class DnsHelper
|
|||
'name' => 'Cloudflare',
|
||||
'config' => [
|
||||
'ak' => '邮箱地址',
|
||||
'sk' => 'API密钥'
|
||||
'sk' => 'API密钥/令牌'
|
||||
],
|
||||
'remark' => 2,
|
||||
'status' => false,
|
||||
|
|
|
@ -41,8 +41,13 @@ class MsgNotice
|
|||
self::send_mail($mail_name, $mail_title, $mail_content);
|
||||
}
|
||||
if(config_get('notice_wxtpl') == 1){
|
||||
$mail_content = str_replace(['<br/>', '<b>', '</b>'], ["\n\n", '**', '**'], $mail_content);
|
||||
self::send_wechat_tplmsg($mail_title, $mail_content);
|
||||
$content = str_replace(['<br/>', '<b>', '</b>'], ["\n\n", '**', '**'], $mail_content);
|
||||
self::send_wechat_tplmsg($mail_title, $content);
|
||||
}
|
||||
if(config_get('notice_tgbot') == 1){
|
||||
$content = str_replace('<br/>', "\n", $mail_content);
|
||||
$content = "<strong>".$mail_title."</strong>\n".$content;
|
||||
self::send_telegram_bot($content);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -102,4 +107,61 @@ class MsgNotice
|
|||
return $arr['msg'];
|
||||
}
|
||||
}
|
||||
|
||||
public static function send_telegram_bot($content){
|
||||
$tgbot_token = config_get('tgbot_token');
|
||||
$tgbot_chatid = config_get('tgbot_chatid');
|
||||
if(!$tgbot_token||!$tgbot_chatid)return false;
|
||||
$url = 'https://api.telegram.org/bot'.$tgbot_token.'/sendMessage';
|
||||
$post = ['chat_id'=>$tgbot_chatid, 'text'=>$content, 'parse_mode'=>'HTML'];
|
||||
$result = self::telegram_curl($url, http_build_query($post));
|
||||
$arr = json_decode($result, true);
|
||||
if(isset($arr['ok']) && $arr['ok']==true){
|
||||
return true;
|
||||
}else{
|
||||
return $arr['description'];
|
||||
}
|
||||
}
|
||||
|
||||
private static function telegram_curl($url, $post){
|
||||
$ch = curl_init();
|
||||
if(config_get('tgbot_proxy') == 1){
|
||||
$proxy_server = config_get('proxy_server');
|
||||
$proxy_port = intval(config_get('proxy_port'));
|
||||
$proxy_userpwd = config_get('proxy_user').':'.config_get('proxy_pwd');
|
||||
$proxy_type = config_get('proxy_type');
|
||||
if($proxy_type == 'https'){
|
||||
$proxy_type = CURLPROXY_HTTPS;
|
||||
}elseif($proxy_type == 'sock4'){
|
||||
$proxy_type = CURLPROXY_SOCKS4;
|
||||
}elseif($proxy_type == 'sock5'){
|
||||
$proxy_type = CURLPROXY_SOCKS5;
|
||||
}else{
|
||||
$proxy_type = CURLPROXY_HTTP;
|
||||
}
|
||||
curl_setopt($ch, CURLOPT_PROXYAUTH, CURLAUTH_BASIC);
|
||||
curl_setopt($ch, CURLOPT_PROXY, $proxy_server);
|
||||
curl_setopt($ch, CURLOPT_PROXYPORT, $proxy_port);
|
||||
if($proxy_userpwd != ':'){
|
||||
curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxy_userpwd);
|
||||
}
|
||||
curl_setopt($ch, CURLOPT_PROXYTYPE, $proxy_type);
|
||||
}
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
||||
$httpheader[] = "Accept: */*";
|
||||
$httpheader[] = "Accept-Encoding: gzip,deflate,sdch";
|
||||
$httpheader[] = "Accept-Language: zh-CN,zh;q=0.8";
|
||||
$httpheader[] = "Connection: close";
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, $httpheader);
|
||||
curl_setopt($ch, CURLOPT_POST, 1);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
|
||||
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Linux; U; Android 4.0.4; es-mx; HTC_One_X Build/IMM76D) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0");
|
||||
curl_setopt($ch, CURLOPT_ENCODING, "gzip");
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
$ret = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
return $ret;
|
||||
}
|
||||
}
|
|
@ -39,7 +39,7 @@ class TaskRunner
|
|||
}
|
||||
}else{
|
||||
if($row['checktype'] == 2){
|
||||
$result = CheckUtils::curl($row['checkurl'], $row['timeout'], $row['main_value']);
|
||||
$result = CheckUtils::curl($row['checkurl'], $row['timeout'], $row['main_value'], $row['proxy'] == 1);
|
||||
}else if($row['checktype'] == 1){
|
||||
$result = CheckUtils::tcp($row['main_value'], $row['tcpport'], $row['timeout']);
|
||||
}else{
|
||||
|
|
|
@ -178,10 +178,16 @@ class cloudflare implements DnsInterface {
|
|||
private function send_reuqest($method, $path, $params = null){
|
||||
$url = $this->baseUrl . $path;
|
||||
|
||||
$headers = [
|
||||
'X-Auth-Email: '.$this->Email,
|
||||
'X-Auth-Key: '.$this->ApiKey,
|
||||
];
|
||||
if(preg_match('/^[0-9a-z]+$/i',$this->ApiKey)){
|
||||
$headers = [
|
||||
'X-Auth-Email: '.$this->Email,
|
||||
'X-Auth-Key: '.$this->ApiKey,
|
||||
];
|
||||
}else{
|
||||
$headers = [
|
||||
'Authorization: Bearer '.$this->ApiKey,
|
||||
];
|
||||
}
|
||||
|
||||
$body = '';
|
||||
if ($method == 'GET' || $method == 'DELETE') {
|
||||
|
|
|
@ -5,7 +5,7 @@ CREATE TABLE `dnsmgr_config` (
|
|||
PRIMARY KEY (`key`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
INSERT INTO `dnsmgr_config` VALUES ('version', '1007');
|
||||
INSERT INTO `dnsmgr_config` VALUES ('version', '1011');
|
||||
INSERT INTO `dnsmgr_config` VALUES ('notice_mail', '0');
|
||||
INSERT INTO `dnsmgr_config` VALUES ('notice_wxtpl', '0');
|
||||
INSERT INTO `dnsmgr_config` VALUES ('mail_smtp', 'smtp.qq.com');
|
||||
|
@ -92,6 +92,7 @@ CREATE TABLE `dnsmgr_dmtask` (
|
|||
`cycle` tinyint(5) NOT NULL DEFAULT 3,
|
||||
`timeout` tinyint(5) NOT NULL DEFAULT 2,
|
||||
`remark` varchar(100) DEFAULT NULL,
|
||||
`proxy` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`addtime` int(11) NOT NULL DEFAULT 0,
|
||||
`checktime` int(11) NOT NULL DEFAULT 0,
|
||||
`checknexttime` int(11) NOT NULL DEFAULT 0,
|
||||
|
|
|
@ -62,4 +62,7 @@ CREATE TABLE IF NOT EXISTS `dnsmgr_optimizeip` (
|
|||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
ALTER TABLE `dnsmgr_domain`
|
||||
ADD COLUMN `remark` varchar(100) DEFAULT NULL;
|
||||
ADD COLUMN `remark` varchar(100) DEFAULT NULL;
|
||||
|
||||
ALTER TABLE `dnsmgr_dmtask`
|
||||
ADD COLUMN `proxy` tinyint(1) NOT NULL DEFAULT 0;
|
|
@ -107,7 +107,7 @@
|
|||
<a href="/domain"><i class="fa fa-list-ul fa-fw"></i> <span>域名管理</span></a>
|
||||
</li>
|
||||
{if request()->user['level'] eq 2}
|
||||
<li class="treeview {:checkIfActive('overview,task,noticeset,taskinfo,taskform')}">
|
||||
<li class="treeview {:checkIfActive('overview,task,noticeset,taskinfo,taskform,proxyset')}">
|
||||
<a href="javascript:;">
|
||||
<i class="fa fa-heartbeat fa-fw"></i>
|
||||
<span>容灾切换</span>
|
||||
|
@ -119,6 +119,7 @@
|
|||
<li><a href="/dmonitor/overview"><i class="fa fa-circle-o"></i> 运行概览</a></li>
|
||||
<li><a href="/dmonitor/task"><i class="fa fa-circle-o"></i> 切换策略</a></li>
|
||||
<li><a href="/dmonitor/noticeset"><i class="fa fa-circle-o"></i> 通知设置</a></li>
|
||||
<li><a href="/dmonitor/proxyset"><i class="fa fa-circle-o"></i> 代理设置</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="treeview {:checkIfActive('opipset,opiplist,opipform')}">
|
||||
|
|
|
@ -15,6 +15,10 @@
|
|||
<label class="col-sm-3 control-label">微信公众号通知</label>
|
||||
<div class="col-sm-9"><select class="form-control" name="notice_wxtpl" default="{:config_get('notice_wxtpl')}"><option value="0">关闭</option><option value="1">开启</option></select></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">Telegram机器人通知</label>
|
||||
<div class="col-sm-9"><select class="form-control" name="notice_tgbot" default="{:config_get('notice_tgbot')}"><option value="0">关闭</option><option value="1">开启</option></select></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-3 col-sm-9"><input type="submit" name="submit" value="保存" class="btn btn-primary btn-block"/></div>
|
||||
</div>
|
||||
|
@ -99,6 +103,34 @@
|
|||
<b>WxPusher:</b><a href="https://wxpusher.zjiecode.com/admin/" target="_blank" rel="noopener noreferrer">点此进入</a> ,注册并且创建应用 -> 将appToken填写到上方输入框 -> 扫码关注应用 -> 在用户列表查看自己的UID填写到上方输入框<br/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel panel-info">
|
||||
<div class="panel-heading"><h3 class="panel-title">Telegram机器人接口设置</h3></div>
|
||||
<div class="panel-body">
|
||||
<form onsubmit="return saveSetting(this)" method="post" class="form-horizontal" role="form">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">Token</label>
|
||||
<div class="col-sm-9"><input type="text" name="tgbot_token" value="{:config_get('tgbot_token')}" class="form-control"/></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">Chat Id</label>
|
||||
<div class="col-sm-9"><input type="text" name="tgbot_chatid" value="{:config_get('tgbot_chatid')}" class="form-control"/></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">使用代理服务器</label>
|
||||
<div class="col-sm-9"><select class="form-control" name="tgbot_proxy" default="{:config_get('tgbot_proxy')}"><option value="0">否</option><option value="1">是</option></select></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-3 col-sm-9">
|
||||
<input type="submit" name="submit" value="保存" class="btn btn-primary btn-block"/>
|
||||
<a href="javascript:tgbottest()" class="btn btn-default btn-block">发送测试消息</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="panel-footer">
|
||||
与<a href="https://t.me/BotFather" target="_blank" rel="noopener noreferrer">@BotFather</a>对话,使用/newbot命令创建一个新的机器人,根据提示输入机器人的名称和用户名,可得到Token,或使用/mybots命令查看已创建的机器人;与<a href="https://t.me/getmyid_bot" target="_blank" rel="noopener noreferrer">@getmyid_bot</a>对话,可得到Chat Id<br/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
||||
|
@ -129,7 +161,7 @@ function saveSetting(obj){
|
|||
success : function(data) {
|
||||
layer.close(ii);
|
||||
if(data.code == 0){
|
||||
layer.alert('设置保存成功!', {
|
||||
layer.alert('设置保存成功!<br/>重启检测进程或容器后生效', {
|
||||
icon: 1,
|
||||
closeBtn: false
|
||||
}, function(){
|
||||
|
@ -166,5 +198,25 @@ function mailtest(){
|
|||
}
|
||||
});
|
||||
}
|
||||
function tgbottest(){
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : 'GET',
|
||||
url : '/dmonitor/tgbottest',
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
if(data.code == 0){
|
||||
layer.alert(data.msg, {icon: 1});
|
||||
}else{
|
||||
layer.alert(data.msg, {icon: 2})
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.close(ii);
|
||||
layer.msg('服务器错误');
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{/block}
|
129
app/view/dmonitor/proxyset.html
Normal file
129
app/view/dmonitor/proxyset.html
Normal file
|
@ -0,0 +1,129 @@
|
|||
{extend name="common/layout" /}
|
||||
{block name="title"}容灾切换代理设置{/block}
|
||||
{block name="main"}
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-sm-8 col-lg-6 center-block" style="float: none;">
|
||||
<div class="panel panel-info">
|
||||
<div class="panel-heading"><h3 class="panel-title">代理服务器设置</h3></div>
|
||||
<div class="panel-body">
|
||||
<form onsubmit="return saveSetting(this)" method="post" class="form-horizontal" role="form">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">代理IP</label>
|
||||
<div class="col-sm-9"><input type="text" name="proxy_server" value="{:config_get('proxy_server')}" class="form-control"/></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">代理端口</label>
|
||||
<div class="col-sm-9"><input type="text" name="proxy_port" value="{:config_get('proxy_port')}" class="form-control"/></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">代理账号</label>
|
||||
<div class="col-sm-9"><input type="text" name="proxy_user" value="{:config_get('proxy_user')}" class="form-control" placeholder="没有请留空"/></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">代理密码</label>
|
||||
<div class="col-sm-9"><input type="text" name="proxy_pwd" value="{:config_get('proxy_pwd')}" class="form-control" placeholder="没有请留空"/></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">代理协议</label>
|
||||
<div class="col-sm-9"><select class="form-control" name="proxy_type" default="{:config_get('proxy_type')}">
|
||||
<option value="http">HTTP</option>
|
||||
<option value="https">HTTPS</option>
|
||||
<option value="sock4">SOCK4</option>
|
||||
<option value="sock5">SOCK5</option>
|
||||
</select></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-3 col-sm-9"><input type="submit" name="submit" value="保存" class="btn btn-primary btn-block"/></div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
||||
{block name="script"}
|
||||
<script src="{$cdnpublic}layer/3.1.1/layer.js"></script>
|
||||
<script>
|
||||
var items = $("select[default]");
|
||||
for (i = 0; i < items.length; i++) {
|
||||
$(items[i]).val($(items[i]).attr("default")||0);
|
||||
}
|
||||
$("select[name='mail_type']").change(function(){
|
||||
if($(this).val() == 0){
|
||||
$("#frame_set1").show();
|
||||
$("#frame_set2").hide();
|
||||
}else{
|
||||
$("#frame_set1").hide();
|
||||
$("#frame_set2").show();
|
||||
}
|
||||
});
|
||||
$("select[name='mail_type']").change();
|
||||
function saveSetting(obj){
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : 'POST',
|
||||
url : '',
|
||||
data : $(obj).serialize(),
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
if(data.code == 0){
|
||||
layer.alert('设置保存成功!', {
|
||||
icon: 1,
|
||||
closeBtn: false
|
||||
}, function(){
|
||||
window.location.reload()
|
||||
});
|
||||
}else{
|
||||
layer.alert(data.msg, {icon: 2})
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.close(ii);
|
||||
layer.msg('服务器错误');
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
function mailtest(){
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : 'GET',
|
||||
url : '/dmonitor/mailtest',
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
if(data.code == 0){
|
||||
layer.alert(data.msg, {icon: 1});
|
||||
}else{
|
||||
layer.alert(data.msg, {icon: 2})
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.close(ii);
|
||||
layer.msg('服务器错误');
|
||||
}
|
||||
});
|
||||
}
|
||||
function tgbottest(){
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : 'GET',
|
||||
url : '/dmonitor/tgbottest',
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
if(data.code == 0){
|
||||
layer.alert(data.msg, {icon: 1});
|
||||
}else{
|
||||
layer.alert(data.msg, {icon: 2})
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.close(ii);
|
||||
layer.msg('服务器错误');
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{/block}
|
|
@ -70,6 +70,17 @@
|
|||
<input type="text" name="checkurl" v-model="set.checkurl" placeholder="填写以http(s)://开头的完整地址,http状态码须为2xx/3xx" class="form-control" data-bv-uri="true" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" v-show="set.type<=2&&set.checktype==2">
|
||||
<label class="col-sm-3 control-label no-padding-right">使用代理请求</label>
|
||||
<div class="col-sm-6">
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="proxy" value="0" v-model="set.proxy"> 否
|
||||
</label>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="proxy" value="1" v-model="set.proxy"> 是
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" v-show="set.type<=2&&set.checktype>0">
|
||||
<label class="col-sm-3 control-label no-padding-right">最大超时时间</label>
|
||||
<div class="col-sm-3">
|
||||
|
@ -141,6 +152,7 @@ new Vue({
|
|||
frequency: 5,
|
||||
timeout: 2,
|
||||
cycle: 3,
|
||||
proxy: 0,
|
||||
},
|
||||
recordList: [],
|
||||
typeList: [
|
||||
|
|
|
@ -33,5 +33,5 @@ return [
|
|||
|
||||
'version' => '1011',
|
||||
|
||||
'dbversion' => '1007'
|
||||
'dbversion' => '1011'
|
||||
];
|
||||
|
|
|
@ -69,7 +69,9 @@ Route::group(function () {
|
|||
Route::any('/dmonitor/task/:action', 'dmonitor/taskform');
|
||||
Route::get('/dmonitor/task', 'dmonitor/task');
|
||||
Route::any('/dmonitor/noticeset', 'dmonitor/noticeset');
|
||||
Route::any('/dmonitor/proxyset', 'dmonitor/proxyset');
|
||||
Route::get('/dmonitor/mailtest', 'dmonitor/mailtest');
|
||||
Route::get('/dmonitor/tgbottest', 'dmonitor/tgbottest');
|
||||
Route::post('/dmonitor/clean', 'dmonitor/clean');
|
||||
|
||||
Route::any('/optimizeip/opipset', 'optimizeip/opipset');
|
||||
|
|
Loading…
Reference in New Issue
Block a user