mirror of https://github.com/certd/certd
				
				
				
			站点监控批量导入支持分组和备注
							parent
							
								
									2ed12c429e
								
							
						
					
					
						commit
						77b4a1eaf6
					
				| 
						 | 
				
			
			@ -294,7 +294,7 @@ export default {
 | 
			
		|||
  },
 | 
			
		||||
  domainList: {
 | 
			
		||||
    title: "Domain List",
 | 
			
		||||
    helper: "Format: domain:port:name, one per line. Port and name are optional.\nExamples:\nwww.baidu.com:443:Baidu\nwww.taobao.com::Taobao\nwww.google.com",
 | 
			
		||||
    helper: "Format: domain:port:name:remark, one per line. Port and name are optional.\nExamples:\nwww.baidu.com:443:Baidu:remarkText\nwww.taobao.com::Taobao\nwww.google.com",
 | 
			
		||||
    required: "Please enter domains to import",
 | 
			
		||||
    placeholder: "www.baidu.com:443:Baidu\nwww.taobao.com::Taobao\nwww.google.com\n",
 | 
			
		||||
  },
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -299,9 +299,9 @@ export default {
 | 
			
		|||
  },
 | 
			
		||||
  domainList: {
 | 
			
		||||
    title: "域名列表",
 | 
			
		||||
    helper: "格式【域名:端口:名称】,一行一个,其中端口、名称可以省略\n比如:\nwww.baidu.com:443:百度\nwww.taobao.com::淘宝\nwww.google.com",
 | 
			
		||||
    helper: "格式【域名:端口:名称:备注】,一行一个,其中端口、名称、备注可以省略\n比如:\nwww.baidu.com:443:百度:备注文本\nwww.taobao.com::淘宝\nwww.google.com",
 | 
			
		||||
    required: "请输入要导入的域名",
 | 
			
		||||
    placeholder: "www.baidu.com:443:百度\nwww.taobao.com::淘宝\nwww.google.com\n",
 | 
			
		||||
    placeholder: "www.baidu.com:443:百度:备注文本\nwww.taobao.com::淘宝\nwww.google.com\n",
 | 
			
		||||
  },
 | 
			
		||||
  accountInfo: "账号信息",
 | 
			
		||||
  securitySettings: "认证安全设置",
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -26,13 +26,10 @@
 | 
			
		|||
</template>
 | 
			
		||||
 | 
			
		||||
<script lang="ts" setup>
 | 
			
		||||
import { onActivated, onMounted } from "vue";
 | 
			
		||||
import { useFs } from "@fast-crud/fast-crud";
 | 
			
		||||
import { onActivated, onMounted } from "vue";
 | 
			
		||||
import createCrudOptions from "./crud";
 | 
			
		||||
import { siteInfoApi } from "./api";
 | 
			
		||||
import { Modal, notification } from "ant-design-vue";
 | 
			
		||||
import { useI18n } from "/src/locales";
 | 
			
		||||
import * as api from "./api";
 | 
			
		||||
const { t } = useI18n();
 | 
			
		||||
defineOptions({
 | 
			
		||||
  name: "SiteCertMonitor",
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -119,6 +119,7 @@ export class SiteInfoController extends CrudController<SiteInfoService> {
 | 
			
		|||
    const userId = this.getUserId();
 | 
			
		||||
    await this.service.doImport({
 | 
			
		||||
      text:body.text,
 | 
			
		||||
      groupId:body.groupId,
 | 
			
		||||
      userId
 | 
			
		||||
    })
 | 
			
		||||
    return this.ok();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -393,7 +393,7 @@ export class SiteInfoService extends BaseService<SiteInfoEntity> {
 | 
			
		|||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  async doImport(req: { text: string; userId: number }) {
 | 
			
		||||
  async doImport(req: { text: string; userId: number,groupId?:number }) {
 | 
			
		||||
    if (!req.text) {
 | 
			
		||||
      throw new Error("text is required");
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -421,17 +421,22 @@ export class SiteInfoService extends BaseService<SiteInfoEntity> {
 | 
			
		|||
        } catch (e) {
 | 
			
		||||
          throw new Error(`${item}格式错误`);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
      }
 | 
			
		||||
      if (arr.length > 2) {
 | 
			
		||||
        name = arr[2] || domain;
 | 
			
		||||
      }
 | 
			
		||||
      let remark:string = "";
 | 
			
		||||
      if (arr.length > 3) {
 | 
			
		||||
        remark = arr[3] || "";
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      list.push({
 | 
			
		||||
        domain,
 | 
			
		||||
        name,
 | 
			
		||||
        httpsPort: port,
 | 
			
		||||
        userId: req.userId
 | 
			
		||||
        userId: req.userId,
 | 
			
		||||
        remark,
 | 
			
		||||
        groupId: req.groupId
 | 
			
		||||
      });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue