From b25281671189202ba9b1ed64d8d8934fd5b427a3 Mon Sep 17 00:00:00 2001 From: net909 Date: Fri, 17 May 2024 18:35:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E6=89=B9=E9=87=8F=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E4=BF=AE=E6=94=B9=E8=A7=A3=E6=9E=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/Domain.php | 18 ++++++++++++++-- app/controller/Index.php | 6 +++++- app/sql/install.sql | 1 + app/sql/update.sql | 5 ++++- app/view/domain/domain.html | 14 ++++++++++-- app/view/domain/record.html | 43 ++++++++++++++++++++++++++++++++++++- 6 files changed, 80 insertions(+), 7 deletions(-) diff --git a/app/controller/Domain.php b/app/controller/Domain.php index f21b77a..726ac4e 100644 --- a/app/controller/Domain.php +++ b/app/controller/Domain.php @@ -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]); } diff --git a/app/controller/Index.php b/app/controller/Index.php index 5c8a4ee..339cec6 100644 --- a/app/controller/Index.php +++ b/app/controller/Index.php @@ -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){ + + } } } diff --git a/app/sql/install.sql b/app/sql/install.sql index b1291d8..42b5448 100644 --- a/app/sql/install.sql +++ b/app/sql/install.sql @@ -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; diff --git a/app/sql/update.sql b/app/sql/update.sql index 1ab9e5d..1b82512 100644 --- a/app/sql/update.sql +++ b/app/sql/update.sql @@ -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; \ No newline at end of file +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +ALTER TABLE `dnsmgr_domain` +ADD COLUMN `remark` varchar(100) DEFAULT NULL; \ No newline at end of file diff --git a/app/view/domain/domain.html b/app/view/domain/domain.html index 219d85c..bb223c3 100644 --- a/app/view/domain/domain.html +++ b/app/view/domain/domain.html @@ -74,6 +74,12 @@ +
+ +
+ +
+
', + 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('服务器错误'); + } + }); + } + }); +} {/block} \ No newline at end of file