mirror of
https://github.com/netcccyun/dnsmgr.git
synced 2026-02-21 15:31:12 +08:00
增加tgbot反代url
This commit is contained in:
parent
48d5ad7569
commit
d9f8cc18eb
@ -19,15 +19,17 @@ class Index extends BaseController
|
||||
}
|
||||
if ($this->request->isAjax()) {
|
||||
if (input('post.do') == 'stat') {
|
||||
$stat = ['domains' => 0, 'users' => 0, 'records' => 0, 'types' => count(DnsHelper::$dns_config)];
|
||||
$stat = ['domains' => 0, 'tasks' => 0, 'certs' => 0, 'deploys' => 0];
|
||||
if ($this->request->user['level'] == 2) {
|
||||
$stat['domains'] = Db::name('domain')->count();
|
||||
$stat['users'] = Db::name('user')->count();
|
||||
$stat['records'] = Db::name('domain')->sum('recordcount');
|
||||
$stat['tasks'] = Db::name('dmtask')->count();
|
||||
$stat['certs'] = Db::name('cert_order')->count();
|
||||
$stat['deploys'] = Db::name('cert_deploy')->count();
|
||||
} else {
|
||||
$stat['domains'] = Db::name('domain')->where('name', 'in', $this->request->user['permission'])->count();
|
||||
$stat['users'] = 1;
|
||||
$stat['records'] = Db::name('domain')->where('name', 'in', $this->request->user['permission'])->sum('recordcount');
|
||||
$stat['tasks'] = Db::name('dmtask')->count();
|
||||
$stat['certs'] = Db::name('cert_order')->count();
|
||||
$stat['deploys'] = Db::name('cert_deploy')->count();
|
||||
}
|
||||
return json($stat);
|
||||
}
|
||||
|
||||
@ -197,7 +197,14 @@ class MsgNotice
|
||||
$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';
|
||||
$tgbot_url = 'https://api.telegram.org';
|
||||
if (config_get('tgbot_proxy') == 2) {
|
||||
$tgbot_url_n = config_get('tgbot_url');
|
||||
if (!empty($tgbot_url_n)) {
|
||||
$tgbot_url = rtrim($tgbot_url_n, '/');
|
||||
}
|
||||
}
|
||||
$url = $tgbot_url.'/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);
|
||||
|
||||
@ -31,12 +31,12 @@
|
||||
<div class="small-box bg-green">
|
||||
<div class="inner">
|
||||
<h3 id="count2">0</h3>
|
||||
<p>用户数量</p>
|
||||
<p>容灾切换策略</p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="fa fa-users"></i>
|
||||
<i class="fa fa-heartbeat"></i>
|
||||
</div>
|
||||
<a href="/user" class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>
|
||||
<a href="/dmonitor/task" class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- ./col -->
|
||||
@ -45,12 +45,12 @@
|
||||
<div class="small-box bg-yellow">
|
||||
<div class="inner">
|
||||
<h3 id="count3">0</h3>
|
||||
<p>解析数量</p>
|
||||
<p>SSL证书订单</p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="fa fa-globe"></i>
|
||||
<i class="fa fa-expeditedssl"></i>
|
||||
</div>
|
||||
<a href="#" class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>
|
||||
<a href="/cert/certorder" class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- ./col -->
|
||||
@ -59,12 +59,12 @@
|
||||
<div class="small-box bg-red">
|
||||
<div class="inner">
|
||||
<h3 id="count4">0</h3>
|
||||
<p>DNS平台数量</p>
|
||||
<p>SSL部署任务</p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="fa fa-connectdevelop"></i>
|
||||
</div>
|
||||
<a href="#" class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>
|
||||
<a href="/cert/deploytask" class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- ./col -->
|
||||
@ -131,9 +131,9 @@ $(document).ready(function(){
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
$('#count1').html(data.domains);
|
||||
$('#count2').html(data.users);
|
||||
$('#count3').html(data.records);
|
||||
$('#count4').html(data.types);
|
||||
$('#count2').html(data.tasks);
|
||||
$('#count3').html(data.certs);
|
||||
$('#count4').html(data.deploys);
|
||||
$.ajax({
|
||||
url: '{$checkupdate}',
|
||||
type: 'get',
|
||||
|
||||
@ -94,9 +94,13 @@
|
||||
<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>
|
||||
<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><option value="2">自定义反代URL</option></select></div>
|
||||
</div>
|
||||
<div class="form-group" id="tgbot_url_div" style="display:none;">
|
||||
<label class="col-sm-3 control-label">自定义反代URL</label>
|
||||
<div class="col-sm-9"><input type="text" name="tgbot_url" value="{:config_get('tgbot_url')}" class="form-control" placeholder="默认为:https://api.telegram.org"/></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"/>
|
||||
@ -148,7 +152,15 @@ $("select[name='mail_type']").change(function(){
|
||||
$("#frame_set2").show();
|
||||
}
|
||||
});
|
||||
$("select[name='tgbot_proxy']").change(function(){
|
||||
if($(this).val() == 2){
|
||||
$("#tgbot_url_div").show();
|
||||
}else{
|
||||
$("#tgbot_url_div").hide();
|
||||
}
|
||||
});
|
||||
$("select[name='mail_type']").change();
|
||||
$("select[name='tgbot_proxy']").change();
|
||||
function saveSetting(obj){
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
|
||||
Loading…
Reference in New Issue
Block a user