diff --git a/app/controller/Domain.php b/app/controller/Domain.php index 9dd6262..2fa559c 100644 --- a/app/controller/Domain.php +++ b/app/controller/Domain.php @@ -154,6 +154,26 @@ class Domain extends BaseController return view(); } + public function domain_add() + { + if (!checkPermission(2)) return $this->alert('error', '无权限'); + $list = Db::name('account')->select(); + $accounts = []; + $types = []; + foreach ($list as $row) { + $accounts[$row['id']] = $row['id'] . '_' . DnsHelper::$dns_config[$row['type']]['name']; + if (!array_key_exists($row['type'], $types)) { + $types[$row['type']] = DnsHelper::$dns_config[$row['type']]['name']; + } + if (!empty($row['remark'])) { + $accounts[$row['id']] .= '(' . $row['remark'] . ')'; + } + } + View::assign('accounts', $accounts); + View::assign('types', $types); + return view(); + } + public function domain_data() { if (!checkPermission(1)) return json(['total' => 0, 'rows' => []]); @@ -234,6 +254,25 @@ class Domain extends BaseController Db::name('dmtask')->where('did', $id)->delete(); Db::name('optimizeip')->where('did', $id)->delete(); return json(['code' => 0]); + } elseif ($act == 'batchadd') { + if (!checkPermission(2)) return $this->alert('error', '无权限'); + $aid = input('post.aid/d'); + $domains = input('post.domains'); + if (empty($domains)) return json(['code' => -1, 'msg' => '参数不能为空']); + $data = []; + foreach ($domains as $row) { + $data[] = [ + 'aid' => $aid, + 'name' => $row['name'], + 'thirdid' => $row['id'], + 'addtime' => date('Y-m-d H:i:s'), + 'is_hide' => 0, + 'is_sso' => 1, + 'recordcount' => $row['recordcount'], + ]; + } + Db::name('domain')->insertAll($data); + return json(['code' => 0, 'msg' => '成功添加' . count($data) . '个域名!']); } return json(['code' => -3]); } @@ -249,13 +288,10 @@ class Domain extends BaseController $result = $dns->getDomainList($kw, $page, $pagesize); if (!$result) return json(['code' => -1, 'msg' => '获取域名列表失败,' . $dns->getError()]); - $newlist = []; - foreach ($result['list'] as $row) { - if (!Db::name('domain')->where('aid', $aid)->where('name', $row['Domain'])->find()) { - $newlist[] = $row; - } + foreach ($result['list'] as &$row) { + $row['disabled'] = Db::name('domain')->where('aid', $aid)->where('name', $row['Domain'])->find() != null; } - return json(['code' => 0, 'data' => ['total' => $result['total'], 'list' => $newlist]]); + return json(['code' => 0, 'data' => ['total' => $result['total'], 'list' => $result['list']]]); } //获取解析线路和最小TTL diff --git a/app/data/domain_root.txt b/app/data/domain_root.txt index 2db22b1..e7c75d1 100644 --- a/app/data/domain_root.txt +++ b/app/data/domain_root.txt @@ -1923,4 +1923,6 @@ com.zw mil.cn edu.kg edu.cn -eu.org \ No newline at end of file +eu.org +us.kg +ggff.net \ No newline at end of file diff --git a/app/lib/DeployHelper.php b/app/lib/DeployHelper.php index 21c4c3e..85b7c8b 100644 --- a/app/lib/DeployHelper.php +++ b/app/lib/DeployHelper.php @@ -343,7 +343,7 @@ class DeployHelper 'taskinputs' => [], ], 'mwpanel' => [ - 'name' => 'mdserver-web', + 'name' => 'MW面板', 'class' => 1, 'icon' => 'mwpanel.ico', 'note' => null, diff --git a/app/lib/dns/west.php b/app/lib/dns/west.php index db174ab..f2c139d 100644 --- a/app/lib/dns/west.php +++ b/app/lib/dns/west.php @@ -179,7 +179,7 @@ class west implements DnsInterface private function execute($path, $params) { $params['username'] = $this->username; - $params['time'] = $this->getMillisecond(); + $params['time'] = getMillisecond(); $params['token'] = md5($this->username.$this->api_password.$params['time']); try{ $response = curl_client($this->baseUrl . $path, http_build_query($params), null, null, null, $this->proxy); @@ -202,12 +202,6 @@ class west implements DnsInterface } } - private function getMillisecond() - { - list($s1, $s2) = explode(' ', microtime()); - return (float)sprintf('%.0f', (floatval($s1) + floatval($s2)) * 1000); - } - private function setError($message) { $this->error = $message; diff --git a/app/service/CertDeployService.php b/app/service/CertDeployService.php index 71c5296..f66fb8f 100644 --- a/app/service/CertDeployService.php +++ b/app/service/CertDeployService.php @@ -133,7 +133,11 @@ class CertDeployService if (empty($this->task['processid'])) return; if (!is_dir(app()->getRuntimePath() . 'log')) mkdir(app()->getRuntimePath() . 'log'); $file_name = app()->getRuntimePath().'log/'.$this->task['processid'].'.log'; + $file_exists = file_exists($file_name); file_put_contents($file_name, $txt . PHP_EOL, FILE_APPEND); + if (!$file_exists) { + @chmod($file_name, 0777); + } if(php_sapi_name() == 'cli'){ echo $txt . PHP_EOL; } diff --git a/app/service/CertOrderService.php b/app/service/CertOrderService.php index ecb7899..0ac2cd8 100644 --- a/app/service/CertOrderService.php +++ b/app/service/CertOrderService.php @@ -420,7 +420,11 @@ class CertOrderService if (empty($this->order['processid'])) return; if (!is_dir(app()->getRuntimePath() . 'log')) mkdir(app()->getRuntimePath() . 'log'); $file_name = app()->getRuntimePath().'log/'.$this->order['processid'].'.log'; + $file_exists = file_exists($file_name); file_put_contents($file_name, $txt . PHP_EOL, FILE_APPEND); + if (!$file_exists) { + @chmod($file_name, 0777); + } if(php_sapi_name() == 'cli'){ echo $txt . PHP_EOL; } diff --git a/app/view/common/layout.html b/app/view/common/layout.html index 2d2bea0..275e2a3 100644 --- a/app/view/common/layout.html +++ b/app/view/common/layout.html @@ -103,7 +103,7 @@ {if request()->user['type'] eq 'user'}