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 @@ +