mirror of
https://github.com/netcccyun/dnsmgr.git
synced 2024-11-16 03:32:28 +08:00
支持批量添加修改解析
This commit is contained in:
parent
7a58292fb9
commit
b252816711
|
@ -155,7 +155,7 @@ class Domain extends BaseController
|
|||
|
||||
$select = Db::name('domain')->alias('A')->join('account B','A.aid = B.id');
|
||||
if(!empty($kw)){
|
||||
$select->whereLike('name', '%'.$kw.'%');
|
||||
$select->whereLike('name|A.remark', '%'.$kw.'%');
|
||||
}
|
||||
if(!empty($type)){
|
||||
$select->whereLike('B.type', $type);
|
||||
|
@ -164,7 +164,7 @@ class Domain extends BaseController
|
|||
$select->where('is_hide', 0)->where('A.name', 'in', request()->user['permission']);
|
||||
}
|
||||
$total = $select->count();
|
||||
$rows = $select->fieldRaw('A.*,B.type,B.remark')->order('A.id','desc')->limit($offset, $limit)->select();
|
||||
$rows = $select->fieldRaw('A.*,B.type,B.remark aremark')->order('A.id','desc')->limit($offset, $limit)->select();
|
||||
|
||||
$list = [];
|
||||
foreach($rows as $row){
|
||||
|
@ -210,9 +210,11 @@ class Domain extends BaseController
|
|||
if(!$row) return json(['code'=>-1, 'msg'=>'域名不存在']);
|
||||
$is_hide = input('post.is_hide/d');
|
||||
$is_sso = input('post.is_sso/d');
|
||||
$remark = input('post.remark', null, 'trim');
|
||||
Db::name('domain')->where('id', $id)->update([
|
||||
'is_hide' => $is_hide,
|
||||
'is_sso' => $is_sso,
|
||||
'remark' => $remark,
|
||||
]);
|
||||
return json(['code'=>0, 'msg'=>'修改域名配置成功!']);
|
||||
}elseif($act == 'del'){
|
||||
|
@ -534,6 +536,7 @@ class Domain extends BaseController
|
|||
}
|
||||
|
||||
$success = 0;
|
||||
$fail = 0;
|
||||
$dns = DnsHelper::getModel($drow['aid'], $drow['name'], $drow['thirdid']);
|
||||
if($action == 'open'){
|
||||
foreach($recordids as $recordid){
|
||||
|
@ -559,6 +562,17 @@ class Domain extends BaseController
|
|||
}
|
||||
}
|
||||
$msg = '成功删除'.$success.'条解析记录';
|
||||
}else if($action == 'remark'){
|
||||
$remark = input('post.remark', null, 'trim');
|
||||
if(empty($remark)) $remark = null;
|
||||
foreach($recordids as $recordid){
|
||||
if($dns->updateDomainRecordRemark($recordid, $remark)){
|
||||
$success++;
|
||||
}else{
|
||||
$fail++;
|
||||
}
|
||||
}
|
||||
$msg = '批量修改备注,成功'.$success.'条,失败'.$fail.'条';
|
||||
}
|
||||
return json(['code'=>0, 'msg'=>$msg]);
|
||||
}
|
||||
|
|
|
@ -61,7 +61,11 @@ class Index extends BaseController
|
|||
$value=trim($value);
|
||||
if(empty($value))continue;
|
||||
$value = str_replace('dnsmgr_',$mysql_prefix,$value);
|
||||
Db::execute($value);
|
||||
try{
|
||||
Db::execute($value);
|
||||
}catch(Exception $e){
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ CREATE TABLE `dnsmgr_domain` (
|
|||
`is_hide` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`is_sso` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`recordcount` int(1) NOT NULL DEFAULT '0',
|
||||
`remark` varchar(100) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `name` (`name`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
|
|
@ -59,4 +59,7 @@ CREATE TABLE IF NOT EXISTS `dnsmgr_optimizeip` (
|
|||
`errmsg` varchar(100) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `did` (`did`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
ALTER TABLE `dnsmgr_domain`
|
||||
ADD COLUMN `remark` varchar(100) DEFAULT NULL;
|
|
@ -74,6 +74,12 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label no-padding-right">备注</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" class="form-control" name="remark" placeholder="">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
|
@ -91,7 +97,7 @@
|
|||
<form onsubmit="return searchSubmit()" method="GET" class="form-inline" id="searchToolbar">
|
||||
<div class="form-group">
|
||||
<label>搜索</label>
|
||||
<input type="text" class="form-control" name="kw" placeholder="域名">
|
||||
<input type="text" class="form-control" name="kw" placeholder="域名或备注">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<select name="type" class="form-control"><option value="">所有平台</option>{foreach $types as $k=>$v}
|
||||
|
@ -139,7 +145,7 @@ $(document).ready(function(){
|
|||
field: 'typename',
|
||||
title: '平台账户',
|
||||
formatter: function(value, row, index) {
|
||||
return '<span title="'+row.remark+'" data-toggle="tooltip" data-placement="right" title="Tooltip on right"><img src="/static/images/'+row.type+'.ico" class="type-logo"></img>'+value+'('+row.aid+')</span>';
|
||||
return '<span title="'+row.aremark+'" data-toggle="tooltip" data-placement="right" title="Tooltip on right"><img src="/static/images/'+row.type+'.ico" class="type-logo"></img>'+value+'('+row.aid+')</span>';
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -157,6 +163,10 @@ $(document).ready(function(){
|
|||
field: 'addtime',
|
||||
title: '添加时间'
|
||||
},
|
||||
{
|
||||
field: 'remark',
|
||||
title: '备注'
|
||||
},
|
||||
{
|
||||
field: 'is_hide',
|
||||
title: '是否隐藏',
|
||||
|
|
|
@ -171,7 +171,7 @@ td{overflow: hidden;text-overflow: ellipsis;white-space: nowrap;max-width:360px;
|
|||
<a href="javascript:addframe()" class="btn btn-success"><i class="fa fa-plus"></i> 添加记录</a>
|
||||
<div class="btn-group" role="group">
|
||||
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">批量操作 <span class="caret"></span></button>
|
||||
<ul class="dropdown-menu"><li><a href="/record/batchadd/{$domainId}">添加</a></li><li><a href="javascript:operation('open')">启用</a></li><li><a href="javascript:operation('pause')">暂停</a></li><li><a href="javascript:operation('edit')">修改记录</a></li><li><a href="javascript:operation('editline')">修改线路</a></li><li><a href="javascript:operation('delete')">删除</a></li></ul>
|
||||
<ul class="dropdown-menu"><li><a href="/record/batchadd/{$domainId}">添加</a></li><li><a href="javascript:operation('open')">启用</a></li><li><a href="javascript:operation('pause')">暂停</a></li><li><a href="javascript:operation('edit')">修改记录</a></li><li><a href="javascript:operation('editline')">修改线路</a></li>{if $dnsconfig.remark == 1}<li><a href="javascript:operation('editremark')">修改备注</a></li>{/if}<li><a href="javascript:operation('delete')">删除</a></li></ul>
|
||||
</div>
|
||||
<div class="btn-group" role="group">
|
||||
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">日志 <span class="caret"></span></button>
|
||||
|
@ -497,6 +497,13 @@ function operation(action){
|
|||
})
|
||||
batch_edit_line(records)
|
||||
return;
|
||||
}else if(action == 'editremark'){
|
||||
var ids = [];
|
||||
$.each(rows, function(index, item){
|
||||
ids.push(item.RecordId);
|
||||
})
|
||||
batch_edit_remark(ids)
|
||||
return;
|
||||
}
|
||||
|
||||
var ids = [];
|
||||
|
@ -597,5 +604,39 @@ function batch_save_line(){
|
|||
}
|
||||
});
|
||||
}
|
||||
function batch_edit_remark(recordids) {
|
||||
layer.open({
|
||||
type: 1,
|
||||
area: ['350px'],
|
||||
closeBtn: 2,
|
||||
title: '批量修改备注',
|
||||
content: '<div style="padding:15px"><div class="form-group"><input class="form-control" type="text" name="remark" value="" autocomplete="off" placeholder="备注信息"></div></div>',
|
||||
btn: ['确认', '取消'],
|
||||
yes: function(){
|
||||
var remark = $("input[name='remark']").val();
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : 'POST',
|
||||
url : '/record/batch/{$domainId}',
|
||||
data : {action:'remark', recordids:recordids, remark:remark},
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
layer.alert(data.msg,{
|
||||
icon: 1,
|
||||
closeBtn: false
|
||||
}, function(){
|
||||
layer.closeAll();
|
||||
searchSubmit();
|
||||
});
|
||||
},
|
||||
error:function(data){
|
||||
layer.close(ii);
|
||||
layer.msg('服务器错误');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{/block}
|
Loading…
Reference in New Issue
Block a user