1
@@ -0,0 +1,33 @@
|
||||
HELP.md
|
||||
/**/target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**
|
||||
!**/src/test/**
|
||||
|
||||
### STS ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
|
||||
~$*
|
||||
@@ -0,0 +1,194 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.cym</groupId>
|
||||
<artifactId>cdnServerPlugin</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>release</version>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>3.3.3</version>
|
||||
<relativePath /> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
<java.version>21</java.version>
|
||||
</properties>
|
||||
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.cym</groupId>
|
||||
<artifactId>jpaHelper</artifactId>
|
||||
<version>release</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/lib/jpaHelper-release.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.junit.vintage</groupId>
|
||||
<artifactId>junit-vintage-engine</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-freemarker</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.session</groupId>
|
||||
<artifactId>spring-session-jdbc</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-quartz</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.github.binance</groupId>
|
||||
<artifactId>binance-connector-java</artifactId>
|
||||
<version>3.2.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.odiszapc</groupId>
|
||||
<artifactId>nginxparser</artifactId>
|
||||
<version>0.9.6</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.clickhouse</groupId>
|
||||
<artifactId>clickhouse-jdbc</artifactId>
|
||||
<version>0.6.2</version>
|
||||
<classifier>all</classifier>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>5.8.25</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
<version>5.2.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.jodah</groupId>
|
||||
<artifactId>expiringmap</artifactId>
|
||||
<version>0.5.11</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sun.mail</groupId>
|
||||
<artifactId>javax.mail</artifactId>
|
||||
<version>1.6.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.huaweicloud.sdk</groupId>
|
||||
<artifactId>huaweicloud-sdk-dns</artifactId>
|
||||
<version>3.1.104</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alipay.sdk</groupId>
|
||||
<artifactId>alipay-sdk-java</artifactId>
|
||||
<version>4.38.28.ALL</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.google.zxing</groupId>
|
||||
<artifactId>core</artifactId>
|
||||
<version>3.3.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.zxing</groupId>
|
||||
<artifactId>javase</artifactId>
|
||||
<version>3.3.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.axis</groupId>
|
||||
<artifactId>axis</artifactId>
|
||||
<version>1.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jsoup</groupId>
|
||||
<artifactId>jsoup</artifactId>
|
||||
<version>1.16.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-openapi3-jakarta-spring-boot-starter</artifactId>
|
||||
<version>4.5.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>21.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!--curator-recipes -->
|
||||
<dependency>
|
||||
<groupId>org.apache.curator</groupId>
|
||||
<artifactId>curator-recipes</artifactId>
|
||||
<version>5.6.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.upyun</groupId>
|
||||
<artifactId>java-sdk</artifactId>
|
||||
<version>4.2.3</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip> <!-- 跳过测试 -->
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.cym;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
@EnableAsync
|
||||
@EnableTransactionManagement
|
||||
@SpringBootApplication
|
||||
public class CdnWebUI {
|
||||
public static void main(String[] args) {
|
||||
|
||||
SpringApplication.run(CdnWebUI.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.cym.config;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer;
|
||||
import org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver;
|
||||
|
||||
import freemarker.template.TemplateException;
|
||||
|
||||
@Configuration
|
||||
public class FreeMarkerConfig {
|
||||
|
||||
@Bean
|
||||
public FreeMarkerConfigurer freeMarkerConfigurer() throws IOException, TemplateException {
|
||||
FreeMarkerConfigurer freeMarkerConfigurer = new FreeMarkerConfigurer();
|
||||
freeMarkerConfigurer.setTemplateLoaderPath("classpath:templates/");
|
||||
|
||||
freemarker.template.Configuration configuration = freeMarkerConfigurer.createConfiguration();
|
||||
configuration.setDefaultEncoding("UTF-8");
|
||||
configuration.setSetting("classic_compatible", "true");// 使用经典语法
|
||||
configuration.setSetting("number_format", "0.##");
|
||||
|
||||
freeMarkerConfigurer.setConfiguration(configuration);
|
||||
return freeMarkerConfigurer;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public FreeMarkerViewResolver freeMarkerViewResolver() {
|
||||
FreeMarkerViewResolver resolver = new FreeMarkerViewResolver();
|
||||
resolver.setPrefix("");
|
||||
resolver.setSuffix(".html");
|
||||
resolver.setContentType("text/html; charset=UTF-8");
|
||||
resolver.setRequestContextAttribute("request"); // 将上下文路径注入request变量
|
||||
resolver.setExposeSessionAttributes(true); // 将session属性展示
|
||||
return resolver;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.cym.config;
|
||||
|
||||
import org.springframework.boot.web.servlet.MultipartConfigFactory;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.util.unit.DataSize;
|
||||
|
||||
import jakarta.servlet.MultipartConfigElement;
|
||||
|
||||
@Configuration
|
||||
public class MultipartConfig {
|
||||
|
||||
@Bean
|
||||
public MultipartConfigElement multipartConfigElement() {
|
||||
MultipartConfigFactory factory = new MultipartConfigFactory();
|
||||
|
||||
// 置文件大小限制 ,超出此大小页面会抛出异常信息
|
||||
factory.setMaxFileSize(DataSize.ofGigabytes(5)); // KB,MB
|
||||
// 设置总上传数据总大小
|
||||
factory.setMaxRequestSize(DataSize.ofGigabytes(5));
|
||||
// 设置文件临时文件夹路径
|
||||
factory.setLocation(System.getProperty("java.io.tmpdir"));
|
||||
// 如果文件大于这个值,将以文件的形式存储,如果小/于这个值文件将存储在内存中,默认为0
|
||||
// factory.setMaxRequestSize(0);
|
||||
return factory.createMultipartConfig();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package com.cym.controller.page;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.cym.bean.Page;
|
||||
import com.cym.ext.ExampleExt;
|
||||
import com.cym.model.Admin;
|
||||
import com.cym.model.Example;
|
||||
import com.cym.service.ExampleService;
|
||||
import com.cym.utils.BaseController;
|
||||
import com.cym.utils.JsonResult;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import jakarta.transaction.Transactional;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
@Controller
|
||||
@RequestMapping("/adminPage/example")
|
||||
public class ExampleController extends BaseController {
|
||||
@Autowired
|
||||
ExampleService exampleService;
|
||||
|
||||
@RequestMapping("")
|
||||
public ModelAndView index(ModelAndView modelAndView, Page page) {
|
||||
page = exampleService.search(page);
|
||||
|
||||
List<ExampleExt> exts = new ArrayList<ExampleExt>();
|
||||
for (Example example : (List<Example>) page.getList()) {
|
||||
ExampleExt exampleExt = new ExampleExt();
|
||||
BeanUtil.copyProperties(example, exampleExt);
|
||||
|
||||
exampleExt.setAdmin(jpaHelper.findById(example.getAdminId(), Admin.class));
|
||||
|
||||
exts.add(exampleExt);
|
||||
}
|
||||
page.setList(exts);
|
||||
|
||||
|
||||
modelAndView.addObject("adminList", jpaHelper.findAll(Admin.class));
|
||||
modelAndView.addObject("page", page);
|
||||
modelAndView.setViewName("/example/index");
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@RequestMapping("addOver")
|
||||
@ResponseBody
|
||||
public JsonResult addOver(Example example) {
|
||||
|
||||
jpaHelper.insertOrUpdate(example);
|
||||
|
||||
return renderSuccess();
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping("detail")
|
||||
@ResponseBody
|
||||
public JsonResult detail(String id) {
|
||||
Example example = jpaHelper.findById(id, Example.class);
|
||||
ExampleExt exampleExt = new ExampleExt();
|
||||
BeanUtil.copyProperties(example, exampleExt);
|
||||
|
||||
exampleExt.setAdmin(jpaHelper.findById(example.getAdminId(), Admin.class));
|
||||
|
||||
return renderSuccess(exampleExt);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@RequestMapping("del")
|
||||
@ResponseBody
|
||||
public JsonResult del(String id) {
|
||||
jpaHelper.deleteById(id, Example.class);
|
||||
|
||||
return renderSuccess();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.cym.ext;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.cym.model.Admin;
|
||||
import com.cym.utils.MenuUtils.Menu;
|
||||
import com.cym.utils.MenuUtils.MenuCategory;
|
||||
|
||||
public class AdminExt extends Admin {
|
||||
|
||||
private static final long serialVersionUID = 1137434496709241566L;
|
||||
|
||||
List<MenuCategory> menuCategoryList;
|
||||
|
||||
List<Menu> menuList;
|
||||
|
||||
List<NameValue> nameValues;
|
||||
|
||||
|
||||
public List<NameValue> getNameValues() {
|
||||
return nameValues;
|
||||
}
|
||||
|
||||
public void setNameValues(List<NameValue> nameValues) {
|
||||
this.nameValues = nameValues;
|
||||
}
|
||||
|
||||
public List<MenuCategory> getMenuCategoryList() {
|
||||
return menuCategoryList;
|
||||
}
|
||||
|
||||
public void setMenuCategoryList(List<MenuCategory> menuCategoryList) {
|
||||
this.menuCategoryList = menuCategoryList;
|
||||
}
|
||||
|
||||
public static long getSerialversionuid() {
|
||||
return serialVersionUID;
|
||||
}
|
||||
|
||||
public List<Menu> getMenuList() {
|
||||
return menuList;
|
||||
}
|
||||
|
||||
public void setMenuList(List<Menu> menuList) {
|
||||
this.menuList = menuList;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.cym.ext;
|
||||
|
||||
import com.cym.model.Admin;
|
||||
import com.cym.model.Example;
|
||||
|
||||
public class ExampleExt extends Example {
|
||||
|
||||
Admin admin;
|
||||
|
||||
public Admin getAdmin() {
|
||||
return admin;
|
||||
}
|
||||
|
||||
public void setAdmin(Admin admin) {
|
||||
this.admin = admin;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.cym.ext;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class NameValue implements Serializable {
|
||||
private static final long serialVersionUID = 7601908525981573453L;
|
||||
|
||||
String name;
|
||||
String value;
|
||||
|
||||
public NameValue() {
|
||||
|
||||
}
|
||||
|
||||
public NameValue(String name, String value) {
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.cym.ext;
|
||||
|
||||
import com.cym.model.Level;
|
||||
import com.cym.model.User;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
@Schema(description = "用户Ext")
|
||||
public class UserExt extends User {
|
||||
private static final long serialVersionUID = 3218155943288312071L;
|
||||
|
||||
@Schema(description = "用户等级")
|
||||
Level level;
|
||||
@Schema(description = "域名数")
|
||||
Long domainCount;
|
||||
@Schema(description = "四层转发数")
|
||||
Long upstreamCount;
|
||||
@Schema(description = "证书数")
|
||||
Long certCount;
|
||||
@Schema(description = "推广url")
|
||||
String parentUrl;
|
||||
|
||||
@Schema(description = "主机数量")
|
||||
Long machineCount;
|
||||
|
||||
public static long getSerialversionuid() {
|
||||
return serialVersionUID;
|
||||
}
|
||||
|
||||
public Long getMachineCount() {
|
||||
return machineCount;
|
||||
}
|
||||
|
||||
public void setMachineCount(Long machineCount) {
|
||||
this.machineCount = machineCount;
|
||||
}
|
||||
|
||||
public Level getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public void setLevel(Level level) {
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
public Long getDomainCount() {
|
||||
return domainCount;
|
||||
}
|
||||
|
||||
public void setDomainCount(Long domainCount) {
|
||||
this.domainCount = domainCount;
|
||||
}
|
||||
|
||||
public Long getUpstreamCount() {
|
||||
return upstreamCount;
|
||||
}
|
||||
|
||||
public void setUpstreamCount(Long upstreamCount) {
|
||||
this.upstreamCount = upstreamCount;
|
||||
}
|
||||
|
||||
public Long getCertCount() {
|
||||
return certCount;
|
||||
}
|
||||
|
||||
public void setCertCount(Long certCount) {
|
||||
this.certCount = certCount;
|
||||
}
|
||||
|
||||
public String getParentUrl() {
|
||||
return parentUrl;
|
||||
}
|
||||
|
||||
public void setParentUrl(String parentUrl) {
|
||||
this.parentUrl = parentUrl;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
package com.cym.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.cym.bean.CreateTime;
|
||||
import com.cym.bean.InitValue;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Id;
|
||||
|
||||
@Schema(description = "管理员")
|
||||
@Entity
|
||||
public class Admin implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -4917355177911155544L;
|
||||
|
||||
@Id
|
||||
String id;
|
||||
|
||||
@Schema(description = "用户名")
|
||||
@Column(unique = true)
|
||||
String name;
|
||||
|
||||
@Schema(description = "密码")
|
||||
String pass;
|
||||
|
||||
@Schema(description = "电话")
|
||||
String phone;
|
||||
@Schema(description = "邮箱")
|
||||
String email;
|
||||
|
||||
@Schema(description = "自动登录key")
|
||||
String autoKey;
|
||||
|
||||
@CreateTime
|
||||
Long createTime;
|
||||
|
||||
@InitValue("0")
|
||||
@Schema(description = "类型 0:普通管理员 1:超级管理员")
|
||||
Integer type;
|
||||
|
||||
@Schema(description = "tg对话id")
|
||||
String chatId;
|
||||
|
||||
@Schema(description = "api token")
|
||||
String token;
|
||||
|
||||
@Schema(description = "token有效期")
|
||||
Long tokenExpiresTime;
|
||||
|
||||
public String getToken() {
|
||||
return token;
|
||||
}
|
||||
|
||||
public void setToken(String token) {
|
||||
this.token = token;
|
||||
}
|
||||
|
||||
public Long getTokenExpiresTime() {
|
||||
return tokenExpiresTime;
|
||||
}
|
||||
|
||||
public void setTokenExpiresTime(Long tokenExpiresTime) {
|
||||
this.tokenExpiresTime = tokenExpiresTime;
|
||||
}
|
||||
|
||||
public String getChatId() {
|
||||
return chatId;
|
||||
}
|
||||
|
||||
public void setChatId(String chatId) {
|
||||
this.chatId = chatId;
|
||||
}
|
||||
|
||||
public Integer getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(Integer type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public Long getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Long createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
public static long getSerialversionuid() {
|
||||
return serialVersionUID;
|
||||
}
|
||||
|
||||
// public Integer getType() {
|
||||
// return type;
|
||||
// }
|
||||
//
|
||||
// public void setType(Integer type) {
|
||||
// this.type = type;
|
||||
// }
|
||||
|
||||
public String getAutoKey() {
|
||||
return autoKey;
|
||||
}
|
||||
|
||||
public void setAutoKey(String autoKey) {
|
||||
this.autoKey = autoKey;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getPass() {
|
||||
return pass;
|
||||
}
|
||||
|
||||
public void setPass(String pass) {
|
||||
this.pass = pass;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.cym.model;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Id;
|
||||
|
||||
@Schema(description = "演示表")
|
||||
@Entity
|
||||
public class Example {
|
||||
@Id
|
||||
String id;
|
||||
|
||||
@Schema(description = "名称")
|
||||
String name;
|
||||
|
||||
@Schema(description = "描述")
|
||||
String descr;
|
||||
@Schema(description = "管理员id")
|
||||
String adminId;
|
||||
|
||||
|
||||
|
||||
public String getAdminId() {
|
||||
return adminId;
|
||||
}
|
||||
|
||||
public void setAdminId(String adminId) {
|
||||
this.adminId = adminId;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getDescr() {
|
||||
return descr;
|
||||
}
|
||||
|
||||
public void setDescr(String descr) {
|
||||
this.descr = descr;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
package com.cym.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Id;
|
||||
|
||||
import com.cym.bean.CreateTime;
|
||||
import com.cym.bean.InitValue;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.media.SchemaProperty;
|
||||
|
||||
@Schema(description ="用户等级")
|
||||
@Entity
|
||||
public class Level implements Serializable{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 105453908518958974L;
|
||||
|
||||
@Schema(description ="主键")
|
||||
@Id
|
||||
String id;
|
||||
|
||||
@Schema(description ="名称")
|
||||
String name;
|
||||
|
||||
@Schema(description ="类型 0:折扣 1:扣减金额")
|
||||
@InitValue("0")
|
||||
Integer type;
|
||||
|
||||
@Schema(description ="折扣")
|
||||
Double discount;
|
||||
|
||||
// @InitValue("0")
|
||||
// @Schema(description ="扣减金额(CNY)")
|
||||
// Double subtractionCny;
|
||||
|
||||
@InitValue("0")
|
||||
@Schema(description ="扣减金额(USD)")
|
||||
Double subtractionUsd;
|
||||
|
||||
@CreateTime
|
||||
Long createTime;
|
||||
|
||||
public Long getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Long createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
// public Double getSubtractionCny() {
|
||||
// return subtractionCny;
|
||||
// }
|
||||
//
|
||||
// public void setSubtractionCny(Double subtractionCny) {
|
||||
// this.subtractionCny = subtractionCny;
|
||||
// }
|
||||
|
||||
public Double getSubtractionUsd() {
|
||||
return subtractionUsd;
|
||||
}
|
||||
|
||||
public void setSubtractionUsd(Double subtractionUsd) {
|
||||
this.subtractionUsd = subtractionUsd;
|
||||
}
|
||||
|
||||
public static long getSerialversionuid() {
|
||||
return serialVersionUID;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Double getDiscount() {
|
||||
return discount;
|
||||
}
|
||||
|
||||
public void setDiscount(Double discount) {
|
||||
this.discount = discount;
|
||||
}
|
||||
|
||||
public Integer getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(Integer type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,482 @@
|
||||
package com.cym.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Id;
|
||||
|
||||
import com.cym.bean.CreateTime;
|
||||
import com.cym.bean.InitValue;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.media.SchemaProperty;
|
||||
|
||||
@Schema(description ="用户")
|
||||
@Entity
|
||||
public class User implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -3591882129154972699L;
|
||||
|
||||
@Schema(description ="主键")
|
||||
@Id
|
||||
String id;
|
||||
@Schema(description ="用户名")
|
||||
@Column(unique = true)
|
||||
String name;
|
||||
@Schema(description ="用户真实名称")
|
||||
String realname;
|
||||
@Schema(description ="地址")
|
||||
String addr;
|
||||
|
||||
/*-----------OEM信息----------*/
|
||||
@Schema(description ="访问域名")
|
||||
String host;
|
||||
@Schema(description ="公司名")
|
||||
String companyName;
|
||||
@Schema(description ="版权")
|
||||
String copyright;
|
||||
|
||||
@Schema(description ="qq")
|
||||
String qq;
|
||||
@Schema(description ="电话")
|
||||
String phone;
|
||||
@Schema(description ="邮箱")
|
||||
String email;
|
||||
@Schema(description ="密码")
|
||||
String pass;
|
||||
|
||||
@Schema(description ="货币类型 CNY:人民币 USD:美元")
|
||||
@InitValue("CNY")
|
||||
String moneyType;
|
||||
|
||||
@Schema(description ="余额")
|
||||
@Column(columnDefinition = "decimal(20,2)")
|
||||
@InitValue("0")
|
||||
Double money;
|
||||
|
||||
@Schema(description ="分润(美元)")
|
||||
@InitValue("0")
|
||||
Double profitUsd;
|
||||
|
||||
|
||||
@Schema(description ="注册ip")
|
||||
String registIp;
|
||||
|
||||
@Schema(description ="注册时间")
|
||||
Long registTime;
|
||||
|
||||
@Schema(description ="实名认证状态 0:未认证 1:认证中 2:已认证 3:认证失败")
|
||||
@InitValue("0")
|
||||
Integer realNameStatus;
|
||||
|
||||
@Schema(description ="推广人id")
|
||||
String parentUserId;
|
||||
|
||||
@Schema(description ="api key")
|
||||
String apiKey;
|
||||
|
||||
@Schema(description ="api apiSecret")
|
||||
String apiSecret;
|
||||
|
||||
@Schema(description ="api token")
|
||||
String token;
|
||||
|
||||
@Schema(description ="token有效期")
|
||||
Long tokenExpiresTime;
|
||||
|
||||
@Schema(description ="用户等级id")
|
||||
String levelId;
|
||||
|
||||
@Schema(description ="身份证号码")
|
||||
String idCard;
|
||||
|
||||
@Schema(description ="身份证正面")
|
||||
String cardFront;
|
||||
|
||||
@Schema(description ="身份证背面")
|
||||
String cardBack;
|
||||
|
||||
@Schema(description ="手持身份证照片")
|
||||
String cardHand;
|
||||
|
||||
@Schema(description ="自动登录key")
|
||||
String autoKey;
|
||||
|
||||
@Schema(description ="创建时间")
|
||||
@CreateTime
|
||||
Long createTime;
|
||||
|
||||
@Schema(description ="是否从fk同步过来")
|
||||
@InitValue("false")
|
||||
Boolean fromFk;
|
||||
|
||||
@InitValue("0")
|
||||
@Schema(description ="保证金")
|
||||
Double ensureMoney;
|
||||
|
||||
@Schema(description ="保证金时间")
|
||||
Long ensureMoneyTime;
|
||||
|
||||
@InitValue("false")
|
||||
@Schema(description ="是否长期合作伙伴")
|
||||
Boolean longTime;
|
||||
|
||||
@Schema(description ="tg对话id")
|
||||
String chatId;
|
||||
|
||||
@Schema(description ="短信条数")
|
||||
@InitValue("0")
|
||||
Long smsCount;
|
||||
|
||||
@Schema(description ="使用短信通知")
|
||||
@InitValue("false")
|
||||
Boolean smsNotice;
|
||||
|
||||
|
||||
// acme-dns需要的参数
|
||||
String username;
|
||||
String password;
|
||||
String fulldomain;
|
||||
String subdomain;
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getFulldomain() {
|
||||
return fulldomain;
|
||||
}
|
||||
|
||||
public void setFulldomain(String fulldomain) {
|
||||
this.fulldomain = fulldomain;
|
||||
}
|
||||
|
||||
public String getSubdomain() {
|
||||
return subdomain;
|
||||
}
|
||||
|
||||
public void setSubdomain(String subdomain) {
|
||||
this.subdomain = subdomain;
|
||||
}
|
||||
|
||||
public Boolean getSmsNotice() {
|
||||
return smsNotice;
|
||||
}
|
||||
|
||||
public void setSmsNotice(Boolean smsNotice) {
|
||||
this.smsNotice = smsNotice;
|
||||
}
|
||||
|
||||
public Long getSmsCount() {
|
||||
return smsCount;
|
||||
}
|
||||
|
||||
public void setSmsCount(Long smsCount) {
|
||||
this.smsCount = smsCount;
|
||||
}
|
||||
|
||||
public Double getProfitUsd() {
|
||||
return profitUsd;
|
||||
}
|
||||
|
||||
public void setProfitUsd(Double profitUsd) {
|
||||
this.profitUsd = profitUsd;
|
||||
}
|
||||
|
||||
public String getChatId() {
|
||||
return chatId;
|
||||
}
|
||||
|
||||
public void setChatId(String chatId) {
|
||||
this.chatId = chatId;
|
||||
}
|
||||
|
||||
public String getCopyright() {
|
||||
return copyright;
|
||||
}
|
||||
|
||||
public void setCopyright(String copyright) {
|
||||
this.copyright = copyright;
|
||||
}
|
||||
|
||||
public Boolean getLongTime() {
|
||||
return longTime;
|
||||
}
|
||||
|
||||
public void setLongTime(Boolean longTime) {
|
||||
this.longTime = longTime;
|
||||
}
|
||||
|
||||
public Double getMoney() {
|
||||
return money;
|
||||
}
|
||||
|
||||
public void setMoney(Double money) {
|
||||
this.money = money;
|
||||
}
|
||||
|
||||
public Double getEnsureMoney() {
|
||||
return ensureMoney;
|
||||
}
|
||||
|
||||
public void setEnsureMoney(Double ensureMoney) {
|
||||
this.ensureMoney = ensureMoney;
|
||||
}
|
||||
|
||||
public Long getEnsureMoneyTime() {
|
||||
return ensureMoneyTime;
|
||||
}
|
||||
|
||||
public void setEnsureMoneyTime(Long ensureMoneyTime) {
|
||||
this.ensureMoneyTime = ensureMoneyTime;
|
||||
}
|
||||
|
||||
public String getCardHand() {
|
||||
return cardHand;
|
||||
}
|
||||
|
||||
public void setCardHand(String cardHand) {
|
||||
this.cardHand = cardHand;
|
||||
}
|
||||
|
||||
public Boolean getFromFk() {
|
||||
return fromFk;
|
||||
}
|
||||
|
||||
public void setFromFk(Boolean fromFk) {
|
||||
this.fromFk = fromFk;
|
||||
}
|
||||
|
||||
public Long getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public Long getRegistTime() {
|
||||
return registTime;
|
||||
}
|
||||
|
||||
public void setRegistTime(Long registTime) {
|
||||
this.registTime = registTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Long createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public String getAutoKey() {
|
||||
return autoKey;
|
||||
}
|
||||
|
||||
public void setAutoKey(String autoKey) {
|
||||
this.autoKey = autoKey;
|
||||
}
|
||||
|
||||
public String getIdCard() {
|
||||
return idCard;
|
||||
}
|
||||
|
||||
public void setIdCard(String idCard) {
|
||||
this.idCard = idCard;
|
||||
}
|
||||
|
||||
public String getCardFront() {
|
||||
return cardFront;
|
||||
}
|
||||
|
||||
public void setCardFront(String cardFront) {
|
||||
this.cardFront = cardFront;
|
||||
}
|
||||
|
||||
public String getCardBack() {
|
||||
return cardBack;
|
||||
}
|
||||
|
||||
public void setCardBack(String cardBack) {
|
||||
this.cardBack = cardBack;
|
||||
}
|
||||
|
||||
// public String getAdminId() {
|
||||
// return adminId;
|
||||
// }
|
||||
//
|
||||
// public void setAdminId(String adminId) {
|
||||
// this.adminId = adminId;
|
||||
// }
|
||||
|
||||
public static long getSerialversionuid() {
|
||||
return serialVersionUID;
|
||||
}
|
||||
|
||||
public String getHost() {
|
||||
return host;
|
||||
}
|
||||
|
||||
public void setHost(String host) {
|
||||
this.host = host;
|
||||
}
|
||||
|
||||
public String getLevelId() {
|
||||
return levelId;
|
||||
}
|
||||
|
||||
public void setLevelId(String levelId) {
|
||||
this.levelId = levelId;
|
||||
}
|
||||
|
||||
public String getApiKey() {
|
||||
return apiKey;
|
||||
}
|
||||
|
||||
public void setApiKey(String apiKey) {
|
||||
this.apiKey = apiKey;
|
||||
}
|
||||
|
||||
public String getApiSecret() {
|
||||
return apiSecret;
|
||||
}
|
||||
|
||||
public void setApiSecret(String apiSecret) {
|
||||
this.apiSecret = apiSecret;
|
||||
}
|
||||
|
||||
public String getToken() {
|
||||
return token;
|
||||
}
|
||||
|
||||
public void setToken(String token) {
|
||||
this.token = token;
|
||||
}
|
||||
|
||||
public Long getTokenExpiresTime() {
|
||||
return tokenExpiresTime;
|
||||
}
|
||||
|
||||
public void setTokenExpiresTime(Long tokenExpiresTime) {
|
||||
this.tokenExpiresTime = tokenExpiresTime;
|
||||
}
|
||||
|
||||
public String getParentUserId() {
|
||||
return parentUserId;
|
||||
}
|
||||
|
||||
public void setParentUserId(String parentUserId) {
|
||||
this.parentUserId = parentUserId;
|
||||
}
|
||||
|
||||
// public Integer getMoneyType() {
|
||||
// return moneyType;
|
||||
// }
|
||||
//
|
||||
// public void setMoneyType(Integer moneyType) {
|
||||
// this.moneyType = moneyType;
|
||||
// }
|
||||
|
||||
public Integer getRealNameStatus() {
|
||||
return realNameStatus;
|
||||
}
|
||||
|
||||
public void setRealNameStatus(Integer realNameStatus) {
|
||||
this.realNameStatus = realNameStatus;
|
||||
}
|
||||
|
||||
public String getRegistIp() {
|
||||
return registIp;
|
||||
}
|
||||
|
||||
public void setRegistIp(String registIp) {
|
||||
this.registIp = registIp;
|
||||
}
|
||||
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getPass() {
|
||||
return pass;
|
||||
}
|
||||
|
||||
public void setPass(String pass) {
|
||||
this.pass = pass;
|
||||
}
|
||||
|
||||
public String getRealname() {
|
||||
return realname;
|
||||
}
|
||||
|
||||
public void setRealname(String realname) {
|
||||
this.realname = realname;
|
||||
}
|
||||
|
||||
public String getAddr() {
|
||||
return addr;
|
||||
}
|
||||
|
||||
public void setAddr(String addr) {
|
||||
this.addr = addr;
|
||||
}
|
||||
|
||||
public String getCompanyName() {
|
||||
return companyName;
|
||||
}
|
||||
|
||||
public void setCompanyName(String companyName) {
|
||||
this.companyName = companyName;
|
||||
}
|
||||
|
||||
public String getQq() {
|
||||
return qq;
|
||||
}
|
||||
|
||||
public void setQq(String qq) {
|
||||
this.qq = qq;
|
||||
}
|
||||
|
||||
public String getMoneyType() {
|
||||
return moneyType;
|
||||
}
|
||||
|
||||
public void setMoneyType(String moneyType) {
|
||||
this.moneyType = moneyType;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.cym.service;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.cym.bean.Page;
|
||||
import com.cym.model.Example;
|
||||
import com.cym.utils.JpaHelper;
|
||||
|
||||
@Service
|
||||
public class ExampleService {
|
||||
@Autowired
|
||||
JpaHelper jpaHelper;
|
||||
|
||||
public Page search(Page page) {
|
||||
page = jpaHelper.findPageByQuery(page, Example.class);
|
||||
|
||||
return page;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
package com.cym.utils;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import com.cym.bean.Page;
|
||||
import com.cym.ext.AdminExt;
|
||||
import com.cym.ext.UserExt;
|
||||
import com.cym.model.User;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpSession;
|
||||
|
||||
/**
|
||||
* Author: D.Yang Email: koyangslash@gmail.com Date: 16/10/9 Time: 下午1:37
|
||||
* Describe: 基础控制器
|
||||
*/
|
||||
@Component
|
||||
public class BaseController {
|
||||
@Autowired
|
||||
public JpaHelper jpaHelper;
|
||||
|
||||
public JsonResult renderError() {
|
||||
JsonResult result = new JsonResult();
|
||||
result.setSuccess(false);
|
||||
result.setStatus("200");
|
||||
result.setTime(DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
|
||||
;
|
||||
return result;
|
||||
}
|
||||
|
||||
public JsonResult renderError(String msg) {
|
||||
JsonResult result = renderError();
|
||||
result.setMsg(msg);
|
||||
return result;
|
||||
}
|
||||
|
||||
public JsonResult renderSuccess() {
|
||||
JsonResult result = new JsonResult();
|
||||
result.setSuccess(true);
|
||||
result.setStatus("200");
|
||||
result.setTime(DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
|
||||
return result;
|
||||
}
|
||||
|
||||
public JsonResult renderSuccess(Object obj) {
|
||||
JsonResult result = renderSuccess();
|
||||
result.setObj(obj);
|
||||
return result;
|
||||
}
|
||||
|
||||
public AdminExt getAdmin() {
|
||||
HttpSession httpSession = getHttpSession();
|
||||
if (httpSession != null) {
|
||||
AdminExt adminExt = (AdminExt) httpSession.getAttribute("adminLogin");
|
||||
return adminExt;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public String getAdminId() {
|
||||
AdminExt adminExt = getAdmin();
|
||||
return adminExt != null ? adminExt.getId() : null;
|
||||
}
|
||||
|
||||
public String getLoginIp() {
|
||||
HttpSession httpSession = getHttpSession();
|
||||
if (httpSession != null) {
|
||||
return (String) getHttpSession().getAttribute("loginIp");
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public String getUserId() {
|
||||
User user = getUser();
|
||||
return user != null ? user.getId() : null;
|
||||
}
|
||||
|
||||
public User getUser() {
|
||||
UserExt userExt = (UserExt) getHttpSession().getAttribute("userLogin");
|
||||
if (userExt != null) {
|
||||
return jpaHelper.findById(userExt.getId(), User.class);
|
||||
} else {
|
||||
String token = getHttpServletRequest().getHeader("token");
|
||||
if (StrUtil.isNotEmpty(token)) {
|
||||
return jpaHelper.findOneByQuery(new ConditionAndWrapper().eq(User::getToken, token), User.class);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Page buildPage(Integer pageNum, Integer pageSize) {
|
||||
Page page = new Page<>();
|
||||
if (pageNum != null) {
|
||||
page.setPageNum(pageNum);
|
||||
}
|
||||
if (pageSize != null) {
|
||||
page.setPageSize(pageSize);
|
||||
}
|
||||
return page;
|
||||
}
|
||||
|
||||
public String removeHttp(String str) {
|
||||
if (StrUtil.isNotEmpty(str)) {
|
||||
return str.replace("http://", "").replace("https://", "").replace("/", "");
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
public HttpSession getHttpSession() {
|
||||
ServletRequestAttributes requestAttributes = ServletRequestAttributes.class.cast(RequestContextHolder.getRequestAttributes());
|
||||
if (requestAttributes != null) {
|
||||
HttpServletRequest request = requestAttributes.getRequest();
|
||||
HttpSession httpSession = request.getSession();
|
||||
return httpSession;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public HttpServletRequest getHttpServletRequest() {
|
||||
ServletRequestAttributes requestAttributes = ServletRequestAttributes.class.cast(RequestContextHolder.getRequestAttributes());
|
||||
HttpServletRequest request = requestAttributes.getRequest();
|
||||
|
||||
return request;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.cym.utils;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
/**
|
||||
* Author: D.Yang Email: koyangslash@gmail.com Date: 16/8/31 Time: 下午5:50
|
||||
* Describe: 封装Json返回信息
|
||||
*/
|
||||
@Schema(description = "返回结果")
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class JsonResult<T> {
|
||||
@Schema(description = "请求结果")
|
||||
private boolean success;
|
||||
@Schema(description = "请求状态 200:请求成功 401:token无效 500:服务器错误")
|
||||
private String status;
|
||||
@Schema(description = "错误信息")
|
||||
private String msg;
|
||||
@Schema(description = "时间")
|
||||
private String time;
|
||||
@Schema(description = "返回内容")
|
||||
private T obj;
|
||||
|
||||
|
||||
public String getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(String time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return JSONUtil.toJsonStr(this);
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public boolean isSuccess() {
|
||||
return success;
|
||||
}
|
||||
|
||||
public void setSuccess(boolean success) {
|
||||
this.success = success;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public T getObj() {
|
||||
return obj;
|
||||
}
|
||||
|
||||
public void setObj(T obj) {
|
||||
this.obj = obj;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,222 @@
|
||||
package com.cym.utils;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class MenuUtils {
|
||||
// List<MenuCategory> menuCategoryList;
|
||||
|
||||
public List<MenuCategory> getAll() {
|
||||
List<MenuCategory> menuCategoryList = new ArrayList<>();
|
||||
// DNS管理
|
||||
MenuCategory menuCategory = new MenuCategory("DNS管理", "other");
|
||||
menuCategory.getMenus().add(new Menu("adminPage/dns?pageSize=50", "DNS管理"));
|
||||
menuCategory.getMenus().add(new Menu("adminPage/hwKey?pageSize=20", "华为key管理"));
|
||||
menuCategory.getMenus().add(new Menu("adminPage/lineGroup?pageSize=20", "线路组"));
|
||||
menuCategory.getMenus().add(new Menu("adminPage/lineRoute?pageSize=20", "线路组解析"));
|
||||
menuCategoryList.add(menuCategory);
|
||||
|
||||
// 服务器管理
|
||||
menuCategory = new MenuCategory("服务器管理", "system");
|
||||
menuCategory.getMenus().add(new Menu("adminPage/node?pageSize=50", "节点管理"));
|
||||
menuCategory.getMenus().add(new Menu("adminPage/nodeStatus?pageSize=50", "节点状态"));
|
||||
menuCategory.getMenus().add(new Menu("adminPage/property?pageSize=50", "资产管理"));
|
||||
menuCategory.getMenus().add(new Menu("adminPage/area?pageSize=20", "地域管理"));
|
||||
menuCategory.getMenus().add(new Menu("adminPage/ruleTab?", "缓存规则"));
|
||||
menuCategory.getMenus().add(new Menu("adminPage/ip?pageSize=20", "IP管理"));
|
||||
menuCategory.getMenus().add(new Menu("adminPage/task?pageSize=20", "同步任务"));
|
||||
menuCategoryList.add(menuCategory);
|
||||
|
||||
// 站点管理
|
||||
menuCategory = new MenuCategory("站点管理", "user");
|
||||
menuCategory.getMenus().add(new Menu("adminPage/domainAdmin?pageSize=20", "域名列表"));
|
||||
menuCategory.getMenus().add(new Menu("adminPage/upstreamAdmin?pageSize=20", "四层转发"));
|
||||
menuCategory.getMenus().add(new Menu("adminPage/certAdmin?pageSize=20", "证书列表"));
|
||||
menuCategory.getMenus().add(new Menu("adminPage/dnsApi?pageSize=20", "DNS API"));
|
||||
menuCategory.getMenus().add(new Menu("adminPage/transfer?pageSize=20", "中转管理"));
|
||||
menuCategory.getMenus().add(new Menu("adminPage/statsTab?", "数据统计"));
|
||||
menuCategory.getMenus().add(new Menu("adminPage/domainRank?", "域名排行"));
|
||||
menuCategory.getMenus().add(new Menu("adminPage/refresh?", "刷新缓存"));
|
||||
menuCategoryList.add(menuCategory);
|
||||
|
||||
// 套餐管理
|
||||
menuCategory = new MenuCategory("套餐管理", "product");
|
||||
menuCategory.getMenus().add(new Menu("adminPage/product?pageSize=20", "套餐管理"));
|
||||
menuCategory.getMenus().add(new Menu("adminPage/orderAdmin?pageSize=20", "售出套餐"));
|
||||
menuCategory.getMenus().add(new Menu("adminPage/customOrder?pageSize=20", "自定义套餐"));
|
||||
menuCategoryList.add(menuCategory);
|
||||
|
||||
// IDC管理
|
||||
menuCategory = new MenuCategory("IDC管理", "product");
|
||||
menuCategory.getMenus().add(new Menu("adminPage/machineOrderAdmin?pageSize=20", "售出主机"));
|
||||
menuCategory.getMenus().add(new Menu("adminPage/machine?pageSize=50", "服务器产品"));
|
||||
menuCategory.getMenus().add(new Menu("adminPage/machineVps?pageSize=50", "云主机产品"));
|
||||
menuCategory.getMenus().add(new Menu("adminPage/machineRoom?pageSize=20", "机房管理"));
|
||||
menuCategory.getMenus().add(new Menu("adminPage/machineProvider?pageSize=20", "供应商管理"));
|
||||
menuCategory.getMenus().add(new Menu("adminPage/icp?pageSize=20", "ICP白名单"));
|
||||
menuCategoryList.add(menuCategory);
|
||||
|
||||
// 财务管理
|
||||
menuCategory = new MenuCategory("财务管理", "user");
|
||||
menuCategory.getMenus().add(new Menu("adminPage/consumeRecord?pageSize=20", "消费充值记录"));
|
||||
menuCategoryList.add(menuCategory);
|
||||
|
||||
// 用户管理
|
||||
menuCategory = new MenuCategory("用户管理", "user");
|
||||
menuCategory.getMenus().add(new Menu("adminPage/user?pageSize=20", "用户管理"));
|
||||
menuCategory.getMenus().add(new Menu("adminPage/admin?pageSize=20", "管理员管理"));
|
||||
menuCategory.getMenus().add(new Menu("adminPage/level?pageSize=20", "用户等级管理"));
|
||||
menuCategory.getMenus().add(new Menu("adminPage/workOrder?pageSize=20", "工单管理"));
|
||||
menuCategoryList.add(menuCategory);
|
||||
|
||||
// 系统设置
|
||||
menuCategory = new MenuCategory("系统设置", "system");
|
||||
menuCategory.getMenus().add(new Menu("adminPage/errorPage?", "错误页面"));
|
||||
menuCategory.getMenus().add(new Menu("adminPage/quartzJob?pageSize=50", "定时任务"));
|
||||
menuCategoryList.add(menuCategory);
|
||||
|
||||
// 日志管理
|
||||
menuCategory = new MenuCategory("日志管理", "other");
|
||||
menuCategory.getMenus().add(new Menu("adminPage/dnsOperationLog?pageSize=50", "DNS操作日志"));
|
||||
menuCategory.getMenus().add(new Menu("adminPage/operationLog?pageSize=50", "操作日志"));
|
||||
menuCategory.getMenus().add(new Menu("adminPage/domainFreeCheck?pageSize=50", "违规监控"));
|
||||
menuCategory.getMenus().add(new Menu("adminPage/checkLog?pageSize=50", "监控记录"));
|
||||
menuCategory.getMenus().add(new Menu("adminPage/checkLogRank?pageSize=50", "监控排行"));
|
||||
menuCategoryList.add(menuCategory);
|
||||
|
||||
// 邮件管理
|
||||
menuCategory = new MenuCategory("邮件管理", "other");
|
||||
menuCategory.getMenus().add(new Menu("adminPage/emailSendLog?pageSize=20", "邮件日志"));
|
||||
menuCategory.getMenus().add(new Menu("adminPage/emailTemplate?pageSize=20", "邮件模板"));
|
||||
menuCategory.getMenus().add(new Menu("adminPage/telegramSendLog?pageSize=20", "Telegram日志"));
|
||||
menuCategoryList.add(menuCategory);
|
||||
|
||||
return menuCategoryList;
|
||||
}
|
||||
|
||||
public List<MenuCategory> getByUrls(List<String> urls) {
|
||||
List<MenuCategory> menuCategoryUsers = getAll();
|
||||
|
||||
for (MenuCategory menuCategory : menuCategoryUsers) {
|
||||
for (Menu menu : menuCategory.getMenus()) {
|
||||
menu.setShow(false);
|
||||
if (urls.contains(menu.getUrl())) {
|
||||
menu.setShow(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return menuCategoryUsers;
|
||||
}
|
||||
|
||||
public List<Menu> getAllMenu() {
|
||||
List<Menu> menus = new ArrayList<>();
|
||||
for (MenuCategory menuCategory : getAll()) {
|
||||
menus.addAll(menuCategory.getMenus());
|
||||
}
|
||||
|
||||
return menus;
|
||||
}
|
||||
|
||||
/**
|
||||
* 菜单分类
|
||||
*
|
||||
* @author CYM
|
||||
*
|
||||
*/
|
||||
public static class MenuCategory implements Serializable {
|
||||
private static final long serialVersionUID = 3175408543485317759L;
|
||||
|
||||
private String name;
|
||||
|
||||
private String group;
|
||||
|
||||
private List<Menu> menus;
|
||||
|
||||
public MenuCategory(String name, String group) {
|
||||
this.name = name;
|
||||
this.group = group;
|
||||
this.menus = new ArrayList<>();
|
||||
|
||||
}
|
||||
|
||||
public String getGroup() {
|
||||
return group;
|
||||
}
|
||||
|
||||
public void setGroup(String group) {
|
||||
this.group = group;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public List<Menu> getMenus() {
|
||||
return menus;
|
||||
}
|
||||
|
||||
public void setMenus(List<Menu> menus) {
|
||||
this.menus = menus;
|
||||
}
|
||||
|
||||
public static long getSerialversionuid() {
|
||||
return serialVersionUID;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 菜单
|
||||
*
|
||||
* @author CYM
|
||||
*
|
||||
*/
|
||||
public static class Menu implements Serializable {
|
||||
private static final long serialVersionUID = 6848241258354172694L;
|
||||
|
||||
private String url;
|
||||
private String name;
|
||||
private Boolean show;
|
||||
|
||||
public Menu(String url, String name) {
|
||||
this.url = url;
|
||||
this.name = name;
|
||||
this.show = true;
|
||||
}
|
||||
|
||||
public Boolean getShow() {
|
||||
return show;
|
||||
}
|
||||
|
||||
public void setShow(Boolean show) {
|
||||
this.show = show;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.cym.utils.cert;
|
||||
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* @author ZhangSan_Plus
|
||||
* @version 1.0
|
||||
* @className SSLEmailDTO
|
||||
* @description
|
||||
* @date 2021/5/20 9:57
|
||||
**/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class CertExportEmailDTO implements Serializable {
|
||||
private List<CertExportEmailVO> certExportEmailVOS;
|
||||
private String[] email;
|
||||
private Map<String, Integer> maps;
|
||||
}
|
||||
@@ -0,0 +1,337 @@
|
||||
package com.cym.utils.cert;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author ZhangSan_Plus
|
||||
* @version 1.0
|
||||
* @className CertExportEmailVO
|
||||
* @description
|
||||
* @date 2022/8/29 15:17
|
||||
**/
|
||||
@Data
|
||||
public class CertExportEmailVO {
|
||||
|
||||
/**
|
||||
* 证书响应状态
|
||||
*/
|
||||
private String success;
|
||||
private String ctUrl;
|
||||
private String commonUrl;
|
||||
/**
|
||||
* 信任状态
|
||||
*/
|
||||
private String trustStatus;
|
||||
/**
|
||||
* 通用名称
|
||||
*/
|
||||
private String commonName;
|
||||
/**
|
||||
* 加密算法
|
||||
*/
|
||||
private String encryptionAlgorithm;
|
||||
/**
|
||||
* 签名算法
|
||||
*/
|
||||
private String signatureAlgorithm;
|
||||
/**
|
||||
* 证书透明(CT)
|
||||
*/
|
||||
private String certificateTransparency;
|
||||
/**
|
||||
* 吊销状态
|
||||
*/
|
||||
private String revocationStatus;
|
||||
private String ocspBindState;
|
||||
private String ocspMustBind;
|
||||
private String isSNI;
|
||||
private String weakKey;
|
||||
//主题信息
|
||||
private String subjectCN;
|
||||
private String subjectO;
|
||||
private String subjectOU;
|
||||
private String subjectL;
|
||||
private String subjectST;
|
||||
private String subjectC;
|
||||
//签发者信息
|
||||
private String issueCN;
|
||||
private String issueO;
|
||||
private String issueC;
|
||||
private String issueOU;
|
||||
//证书信息
|
||||
private String serialNumber;
|
||||
private String rootCert;
|
||||
private String algorithm;
|
||||
private String certificateType;
|
||||
private String certificateBrand;
|
||||
private String privateKeyLen;
|
||||
private String SHA1Fingerprint;
|
||||
private String SHA256Fingerprint;
|
||||
private String startTime;
|
||||
private String endTime;
|
||||
private String validityPeriod;
|
||||
private String extKeyUsage;
|
||||
private List<String> sans;
|
||||
private String ocspUrl;
|
||||
private String crlUrl;
|
||||
private String caUrl;
|
||||
private String publicKey;
|
||||
private String openSSL;
|
||||
private List<CertificateChain> certificateChains;
|
||||
public String getSuccess() {
|
||||
return success;
|
||||
}
|
||||
public void setSuccess(String success) {
|
||||
this.success = success;
|
||||
}
|
||||
public String getCtUrl() {
|
||||
return ctUrl;
|
||||
}
|
||||
public void setCtUrl(String ctUrl) {
|
||||
this.ctUrl = ctUrl;
|
||||
}
|
||||
public String getCommonUrl() {
|
||||
return commonUrl;
|
||||
}
|
||||
public void setCommonUrl(String commonUrl) {
|
||||
this.commonUrl = commonUrl;
|
||||
}
|
||||
public String getTrustStatus() {
|
||||
return trustStatus;
|
||||
}
|
||||
public void setTrustStatus(String trustStatus) {
|
||||
this.trustStatus = trustStatus;
|
||||
}
|
||||
public String getCommonName() {
|
||||
return commonName;
|
||||
}
|
||||
public void setCommonName(String commonName) {
|
||||
this.commonName = commonName;
|
||||
}
|
||||
public String getEncryptionAlgorithm() {
|
||||
return encryptionAlgorithm;
|
||||
}
|
||||
public void setEncryptionAlgorithm(String encryptionAlgorithm) {
|
||||
this.encryptionAlgorithm = encryptionAlgorithm;
|
||||
}
|
||||
public String getSignatureAlgorithm() {
|
||||
return signatureAlgorithm;
|
||||
}
|
||||
public void setSignatureAlgorithm(String signatureAlgorithm) {
|
||||
this.signatureAlgorithm = signatureAlgorithm;
|
||||
}
|
||||
public String getCertificateTransparency() {
|
||||
return certificateTransparency;
|
||||
}
|
||||
public void setCertificateTransparency(String certificateTransparency) {
|
||||
this.certificateTransparency = certificateTransparency;
|
||||
}
|
||||
public String getRevocationStatus() {
|
||||
return revocationStatus;
|
||||
}
|
||||
public void setRevocationStatus(String revocationStatus) {
|
||||
this.revocationStatus = revocationStatus;
|
||||
}
|
||||
public String getOcspBindState() {
|
||||
return ocspBindState;
|
||||
}
|
||||
public void setOcspBindState(String ocspBindState) {
|
||||
this.ocspBindState = ocspBindState;
|
||||
}
|
||||
public String getOcspMustBind() {
|
||||
return ocspMustBind;
|
||||
}
|
||||
public void setOcspMustBind(String ocspMustBind) {
|
||||
this.ocspMustBind = ocspMustBind;
|
||||
}
|
||||
public String getIsSNI() {
|
||||
return isSNI;
|
||||
}
|
||||
public void setIsSNI(String isSNI) {
|
||||
this.isSNI = isSNI;
|
||||
}
|
||||
public String getWeakKey() {
|
||||
return weakKey;
|
||||
}
|
||||
public void setWeakKey(String weakKey) {
|
||||
this.weakKey = weakKey;
|
||||
}
|
||||
public String getSubjectCN() {
|
||||
return subjectCN;
|
||||
}
|
||||
public void setSubjectCN(String subjectCN) {
|
||||
this.subjectCN = subjectCN;
|
||||
}
|
||||
public String getSubjectO() {
|
||||
return subjectO;
|
||||
}
|
||||
public void setSubjectO(String subjectO) {
|
||||
this.subjectO = subjectO;
|
||||
}
|
||||
public String getSubjectOU() {
|
||||
return subjectOU;
|
||||
}
|
||||
public void setSubjectOU(String subjectOU) {
|
||||
this.subjectOU = subjectOU;
|
||||
}
|
||||
public String getSubjectL() {
|
||||
return subjectL;
|
||||
}
|
||||
public void setSubjectL(String subjectL) {
|
||||
this.subjectL = subjectL;
|
||||
}
|
||||
public String getSubjectST() {
|
||||
return subjectST;
|
||||
}
|
||||
public void setSubjectST(String subjectST) {
|
||||
this.subjectST = subjectST;
|
||||
}
|
||||
public String getSubjectC() {
|
||||
return subjectC;
|
||||
}
|
||||
public void setSubjectC(String subjectC) {
|
||||
this.subjectC = subjectC;
|
||||
}
|
||||
public String getIssueCN() {
|
||||
return issueCN;
|
||||
}
|
||||
public void setIssueCN(String issueCN) {
|
||||
this.issueCN = issueCN;
|
||||
}
|
||||
public String getIssueO() {
|
||||
return issueO;
|
||||
}
|
||||
public void setIssueO(String issueO) {
|
||||
this.issueO = issueO;
|
||||
}
|
||||
public String getIssueC() {
|
||||
return issueC;
|
||||
}
|
||||
public void setIssueC(String issueC) {
|
||||
this.issueC = issueC;
|
||||
}
|
||||
public String getIssueOU() {
|
||||
return issueOU;
|
||||
}
|
||||
public void setIssueOU(String issueOU) {
|
||||
this.issueOU = issueOU;
|
||||
}
|
||||
public String getSerialNumber() {
|
||||
return serialNumber;
|
||||
}
|
||||
public void setSerialNumber(String serialNumber) {
|
||||
this.serialNumber = serialNumber;
|
||||
}
|
||||
public String getRootCert() {
|
||||
return rootCert;
|
||||
}
|
||||
public void setRootCert(String rootCert) {
|
||||
this.rootCert = rootCert;
|
||||
}
|
||||
public String getAlgorithm() {
|
||||
return algorithm;
|
||||
}
|
||||
public void setAlgorithm(String algorithm) {
|
||||
this.algorithm = algorithm;
|
||||
}
|
||||
public String getCertificateType() {
|
||||
return certificateType;
|
||||
}
|
||||
public void setCertificateType(String certificateType) {
|
||||
this.certificateType = certificateType;
|
||||
}
|
||||
public String getCertificateBrand() {
|
||||
return certificateBrand;
|
||||
}
|
||||
public void setCertificateBrand(String certificateBrand) {
|
||||
this.certificateBrand = certificateBrand;
|
||||
}
|
||||
public String getPrivateKeyLen() {
|
||||
return privateKeyLen;
|
||||
}
|
||||
public void setPrivateKeyLen(String privateKeyLen) {
|
||||
this.privateKeyLen = privateKeyLen;
|
||||
}
|
||||
public String getSHA1Fingerprint() {
|
||||
return SHA1Fingerprint;
|
||||
}
|
||||
public void setSHA1Fingerprint(String sHA1Fingerprint) {
|
||||
SHA1Fingerprint = sHA1Fingerprint;
|
||||
}
|
||||
public String getSHA256Fingerprint() {
|
||||
return SHA256Fingerprint;
|
||||
}
|
||||
public void setSHA256Fingerprint(String sHA256Fingerprint) {
|
||||
SHA256Fingerprint = sHA256Fingerprint;
|
||||
}
|
||||
public String getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
public void setStartTime(String startTime) {
|
||||
this.startTime = startTime;
|
||||
}
|
||||
public String getEndTime() {
|
||||
return endTime;
|
||||
}
|
||||
public void setEndTime(String endTime) {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
public String getValidityPeriod() {
|
||||
return validityPeriod;
|
||||
}
|
||||
public void setValidityPeriod(String validityPeriod) {
|
||||
this.validityPeriod = validityPeriod;
|
||||
}
|
||||
public String getExtKeyUsage() {
|
||||
return extKeyUsage;
|
||||
}
|
||||
public void setExtKeyUsage(String extKeyUsage) {
|
||||
this.extKeyUsage = extKeyUsage;
|
||||
}
|
||||
public List<String> getSans() {
|
||||
return sans;
|
||||
}
|
||||
public void setSans(List<String> sans) {
|
||||
this.sans = sans;
|
||||
}
|
||||
public String getOcspUrl() {
|
||||
return ocspUrl;
|
||||
}
|
||||
public void setOcspUrl(String ocspUrl) {
|
||||
this.ocspUrl = ocspUrl;
|
||||
}
|
||||
public String getCrlUrl() {
|
||||
return crlUrl;
|
||||
}
|
||||
public void setCrlUrl(String crlUrl) {
|
||||
this.crlUrl = crlUrl;
|
||||
}
|
||||
public String getCaUrl() {
|
||||
return caUrl;
|
||||
}
|
||||
public void setCaUrl(String caUrl) {
|
||||
this.caUrl = caUrl;
|
||||
}
|
||||
public String getPublicKey() {
|
||||
return publicKey;
|
||||
}
|
||||
public void setPublicKey(String publicKey) {
|
||||
this.publicKey = publicKey;
|
||||
}
|
||||
public String getOpenSSL() {
|
||||
return openSSL;
|
||||
}
|
||||
public void setOpenSSL(String openSSL) {
|
||||
this.openSSL = openSSL;
|
||||
}
|
||||
public List<CertificateChain> getCertificateChains() {
|
||||
return certificateChains;
|
||||
}
|
||||
public void setCertificateChains(List<CertificateChain> certificateChains) {
|
||||
this.certificateChains = certificateChains;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
package com.cym.utils.cert;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class CertInfoDTO {
|
||||
|
||||
List<Map<String, String>> pactMap;
|
||||
|
||||
String webTitle;
|
||||
String webServer;
|
||||
String ipAddr;
|
||||
String icon;
|
||||
List<CertExportEmailVO> certExportEmailVOS;
|
||||
String rating;
|
||||
String ats;
|
||||
String pciDss;
|
||||
String detectionTime;
|
||||
|
||||
Boolean pass;
|
||||
|
||||
public Boolean getPass() {
|
||||
return pass;
|
||||
}
|
||||
|
||||
public void setPass(Boolean pass) {
|
||||
this.pass = pass;
|
||||
}
|
||||
|
||||
public List<Map<String, String>> getPactMap() {
|
||||
return pactMap;
|
||||
}
|
||||
|
||||
public void setPactMap(List<Map<String, String>> pactMap) {
|
||||
this.pactMap = pactMap;
|
||||
}
|
||||
|
||||
public String getWebTitle() {
|
||||
return webTitle;
|
||||
}
|
||||
|
||||
public void setWebTitle(String webTitle) {
|
||||
this.webTitle = webTitle;
|
||||
}
|
||||
|
||||
public String getWebServer() {
|
||||
return webServer;
|
||||
}
|
||||
|
||||
public void setWebServer(String webServer) {
|
||||
this.webServer = webServer;
|
||||
}
|
||||
|
||||
public String getIpAddr() {
|
||||
return ipAddr;
|
||||
}
|
||||
|
||||
public void setIpAddr(String ipAddr) {
|
||||
this.ipAddr = ipAddr;
|
||||
}
|
||||
|
||||
public String getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
public void setIcon(String icon) {
|
||||
this.icon = icon;
|
||||
}
|
||||
|
||||
public List<CertExportEmailVO> getCertExportEmailVOS() {
|
||||
return certExportEmailVOS;
|
||||
}
|
||||
|
||||
public void setCertExportEmailVOS(List<CertExportEmailVO> certExportEmailVOS) {
|
||||
this.certExportEmailVOS = certExportEmailVOS;
|
||||
}
|
||||
|
||||
public String getRating() {
|
||||
return rating;
|
||||
}
|
||||
|
||||
public void setRating(String rating) {
|
||||
this.rating = rating;
|
||||
}
|
||||
|
||||
public String getAts() {
|
||||
return ats;
|
||||
}
|
||||
|
||||
public void setAts(String ats) {
|
||||
this.ats = ats;
|
||||
}
|
||||
|
||||
public String getPciDss() {
|
||||
return pciDss;
|
||||
}
|
||||
|
||||
public void setPciDss(String pciDss) {
|
||||
this.pciDss = pciDss;
|
||||
}
|
||||
|
||||
public String getDetectionTime() {
|
||||
return detectionTime;
|
||||
}
|
||||
|
||||
public void setDetectionTime(String detectionTime) {
|
||||
this.detectionTime = detectionTime;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.cym.utils.cert;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author ZhangSan_Plus
|
||||
* @version 1.0
|
||||
* @className CertificateChain
|
||||
* @description
|
||||
* @date 2022/9/1 13:59
|
||||
**/
|
||||
@Data
|
||||
public class CertificateChain {
|
||||
private String issuedTo;
|
||||
private String issuer;
|
||||
private String encryptionAlgorithm;
|
||||
private String signAlgorithm;
|
||||
private String certFingerprint;
|
||||
private String publicKeyPINValue;
|
||||
private String validityPeriod;
|
||||
public String getIssuedTo() {
|
||||
return issuedTo;
|
||||
}
|
||||
public void setIssuedTo(String issuedTo) {
|
||||
this.issuedTo = issuedTo;
|
||||
}
|
||||
public String getIssuer() {
|
||||
return issuer;
|
||||
}
|
||||
public void setIssuer(String issuer) {
|
||||
this.issuer = issuer;
|
||||
}
|
||||
public String getEncryptionAlgorithm() {
|
||||
return encryptionAlgorithm;
|
||||
}
|
||||
public void setEncryptionAlgorithm(String encryptionAlgorithm) {
|
||||
this.encryptionAlgorithm = encryptionAlgorithm;
|
||||
}
|
||||
public String getSignAlgorithm() {
|
||||
return signAlgorithm;
|
||||
}
|
||||
public void setSignAlgorithm(String signAlgorithm) {
|
||||
this.signAlgorithm = signAlgorithm;
|
||||
}
|
||||
public String getCertFingerprint() {
|
||||
return certFingerprint;
|
||||
}
|
||||
public void setCertFingerprint(String certFingerprint) {
|
||||
this.certFingerprint = certFingerprint;
|
||||
}
|
||||
public String getPublicKeyPINValue() {
|
||||
return publicKeyPINValue;
|
||||
}
|
||||
public void setPublicKeyPINValue(String publicKeyPINValue) {
|
||||
this.publicKeyPINValue = publicKeyPINValue;
|
||||
}
|
||||
public String getValidityPeriod() {
|
||||
return validityPeriod;
|
||||
}
|
||||
public void setValidityPeriod(String validityPeriod) {
|
||||
this.validityPeriod = validityPeriod;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,839 @@
|
||||
package com.cym.utils.cert;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.ConnectException;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.InetAddress;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.cert.Certificate;
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.net.ssl.HostnameVerifier;
|
||||
import javax.net.ssl.HttpsURLConnection;
|
||||
import javax.net.ssl.SSLSession;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.cym.utils.cert.ssl.Root;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
|
||||
/**
|
||||
* @author ZhangSan_Plus
|
||||
* @version 1.0
|
||||
* @className CertificateDetectionUtils
|
||||
* @description
|
||||
* @date 2022/8/27 16:36
|
||||
**/
|
||||
@Component
|
||||
public class CertificateDetectionUtils {
|
||||
private static final Pattern CN_PATTERN = Pattern.compile("[\u4e00-\u9fa5]");
|
||||
private static final String HTTPS_STR = "https://";
|
||||
private static final String HTTP_STR = "http://";
|
||||
private static final String DOMAIN_NOT_MATCH_STR = "域名不匹配";
|
||||
private static final String DV_SSL_STR = "DV SSL";
|
||||
private static final String OV_SSL_STR = "OV SSL";
|
||||
private static final String EV_SSL_STR = "EV SSL";
|
||||
private static final String SERIALNUMBER_STR = "SERIALNUMBER";
|
||||
private static final String O_STR = "O";
|
||||
private static final String ST_STR = "ST";
|
||||
private static final String OU_STR = "OU";
|
||||
private static final String L_STR = "L";
|
||||
private static final String C_STR = "C";
|
||||
private static final String CN_STR = "CN";
|
||||
private static final String SHA1_AUTH_STR = "SHA-1";
|
||||
private static final String SHA256_AUTH_STR = "SHA-256";
|
||||
private static final String NORMAL_STR = "正常";
|
||||
private static final String YES_STR = "是";
|
||||
private static final String NO_STR = "否";
|
||||
private static final String SUPPORT_STR = "支持";
|
||||
private static final String NO_SUPPORT_STR = "不支持";
|
||||
|
||||
/**
|
||||
* 根据网址获取证书详细信息(包含当前网址受信任,不受信任的证书)
|
||||
*
|
||||
* @param hpUrl
|
||||
* @return com.cym.utils.cert.CertInfoDTO
|
||||
* @throws Exception
|
||||
* @author ZhangSan_Plus
|
||||
* @date 19:35 2022/9/5
|
||||
**/
|
||||
public static CertInfoDTO getCert(String hpUrl) throws Exception {
|
||||
hpUrl = hpUrl.contains(HTTP_STR) || hpUrl.contains(HTTPS_STR) ? hpUrl.replaceAll(HTTP_STR, "").replaceAll(HTTPS_STR, "").trim() : hpUrl.trim();
|
||||
hpUrl = CNRulesMate(hpUrl) ? chineseDomainNameDecoding(hpUrl) : hpUrl;
|
||||
long start = System.currentTimeMillis();
|
||||
CertInfoDTO certInfoDTO = new CertInfoDTO();
|
||||
List<Map<String, String>> pactMap = Lists.newLinkedList();
|
||||
List<CertExportEmailVO> certExportEmailVOS = Lists.newArrayList();
|
||||
// 获取受信任证书
|
||||
CertExportEmailVO certExportEmailVO = defaultDetection(hpUrl.toLowerCase());
|
||||
// 获取不受信任的证书
|
||||
// CertExportEmailVO certExportEmailVO1 = trustDetection(hpUrl.toLowerCase());
|
||||
if (StringUtils.isNotBlank(certExportEmailVO.getIssueC())) {
|
||||
pactMap.add(certCompatible(certExportEmailVO.getSuccess()));
|
||||
certExportEmailVOS.add(certExportEmailVO);
|
||||
}
|
||||
// if (StringUtils.isNotBlank(certExportEmailVO1.getCertificateType())
|
||||
// && !(StringUtils.isNotBlank(certExportEmailVO.getCommonName()) ? certExportEmailVO.getCommonUrl() : "").equals(certExportEmailVO1.getCommonUrl())) {
|
||||
// pactMap.add(certCompatible(certExportEmailVO1.getSuccess()));
|
||||
// certExportEmailVOS.add(certExportEmailVO1);
|
||||
// }
|
||||
certInfoDTO.setPactMap(pactMap);
|
||||
// 获取当前网址的title,icon,ip等信息
|
||||
Map<String, String> webInfo = getWebInfo(StringUtils.isNotBlank(certExportEmailVO.getCommonName()) ? HTTPS_STR : HTTP_STR, hpUrl);
|
||||
certInfoDTO.setWebTitle(webInfo.get("title"));
|
||||
certInfoDTO.setWebServer("-");
|
||||
certInfoDTO.setIpAddr(webInfo.get("ip"));
|
||||
certInfoDTO.setIcon(webInfo.get("favicon"));
|
||||
certInfoDTO.setCertExportEmailVOS(certExportEmailVOS);
|
||||
if (certExportEmailVOS.size() != 0) {
|
||||
String rating = getRating(certExportEmailVOS.get(0));
|
||||
String status = rating.equals("B") || rating.equals("T") ? "不合规" : "合规";
|
||||
certInfoDTO.setRating(rating);
|
||||
certInfoDTO.setAts(status);
|
||||
certInfoDTO.setPciDss(status);
|
||||
certInfoDTO.setPass(true);
|
||||
} else {
|
||||
certInfoDTO.setPass(false);
|
||||
}
|
||||
long end = System.currentTimeMillis();
|
||||
certInfoDTO.setDetectionTime(DateUtils.formatDate(new Date(), DateUtils.DATE_DEFAULT) + " ( 耗时:" + (end - start) / 1000 + "秒 )");
|
||||
return certInfoDTO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取HTTPS请求连接
|
||||
*
|
||||
* @param url
|
||||
* @return javax.net.ssl.HttpsURLConnection
|
||||
* @throws
|
||||
* @author ZhangSan_Plus
|
||||
* @date 14:31 2022/9/2
|
||||
**/
|
||||
public static HttpsURLConnection getConn(URL url) {
|
||||
HttpsURLConnection conn = null;
|
||||
try {
|
||||
conn = (HttpsURLConnection) url.openConnection();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
conn.addRequestProperty("Accept", "*/*");
|
||||
conn.addRequestProperty("Accept-Encoding", "gzip,deflate,sdch");
|
||||
conn.addRequestProperty("Accept-Language", "zh-CN,zh;q=0.8");
|
||||
conn.addRequestProperty("Cache-Control", "max-age=0");
|
||||
conn.addRequestProperty("Connection", "keep-alive");
|
||||
conn.addRequestProperty("Content-Type", "application/x-www-form-urlencoded");
|
||||
conn.addRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36");
|
||||
conn.setDoOutput(true);
|
||||
conn.setUseCaches(false);
|
||||
conn.setConnectTimeout(10000);
|
||||
conn.setReadTimeout(10000);
|
||||
return conn;
|
||||
}
|
||||
|
||||
/***
|
||||
* 默认证书匹配(只匹配SSL证书安全的证书信息) --若证书抛出没有证书的错误会进行信任全部证书进行检测
|
||||
* --会将所有证书进行匹配包括已经过期或者证书和主域名不匹配的都会进行处理
|
||||
*
|
||||
*
|
||||
* -SSL证书会进行两次匹配规则如下 若两次证书查询的结果相同则代表该网站仅有一个RSA,若两次查询结果不相同会将证书分为 RSA1 RSA2
|
||||
*
|
||||
* @author ZhangSan_Plus
|
||||
* @date 10:04 2022/8/31
|
||||
* @param hpUrl
|
||||
* @return com.cym.utils.cert.CertExportEmailVO
|
||||
* @throws
|
||||
**/
|
||||
public static CertExportEmailVO defaultDetection(String hpUrl) throws Exception {
|
||||
URL url = new URL(HTTPS_STR + hpUrl);
|
||||
// 发起HTTPS请求
|
||||
trustAllHttpsCertificates(1);
|
||||
HttpsURLConnection conn = getConn(url);
|
||||
CertExportEmailVO certExportEmailVO = new CertExportEmailVO();
|
||||
try {
|
||||
conn.connect();
|
||||
if (Objects.nonNull(conn.getServerCertificates())) {
|
||||
Certificate[] serverCertificates = conn.getServerCertificates();
|
||||
X509Certificate certs = (X509Certificate) serverCertificates[0];
|
||||
certExportEmailVO = deal(certs, certExportEmailVO);
|
||||
String parentCert = (serverCertificates.length > 1) ? NO_STR : YES_STR;
|
||||
certExportEmailVO.setRootCert(parentCert);
|
||||
certExportEmailVO.setOcspBindState(parentCert.equals(YES_STR) ? SUPPORT_STR : NO_SUPPORT_STR);
|
||||
certExportEmailVO.setOcspMustBind(parentCert.equals(YES_STR) ? YES_STR : NO_STR);
|
||||
certExportEmailVO.setIsSNI(parentCert.equals(YES_STR) ? YES_STR : NO_STR);
|
||||
certExportEmailVO.setWeakKey(parentCert.equals(YES_STR) ? NO_STR : YES_STR);
|
||||
List<CertificateChain> certChain = getCertChain(serverCertificates, getThumbPrint(certs, SHA1_AUTH_STR).toUpperCase());
|
||||
certExportEmailVO.setCertificateChains(certChain);
|
||||
conn.disconnect();
|
||||
if (!certExportEmailVO.getCommonName().contains(hpUrl.substring(hpUrl.indexOf(".") + 1))) {
|
||||
if (!certExportEmailVO.getSans().contains(hpUrl.replaceAll("www\\.", ""))) {
|
||||
certExportEmailVO.setCommonUrl(certExportEmailVO.getCommonName());
|
||||
certExportEmailVO.setCommonName(certExportEmailVO.getCommonName() + " (不匹配)");
|
||||
certExportEmailVO.setSuccess(DOMAIN_NOT_MATCH_STR);
|
||||
certExportEmailVO.setTrustStatus(DOMAIN_NOT_MATCH_STR);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
conn.disconnect();
|
||||
}
|
||||
return certExportEmailVO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 中文正则表达式
|
||||
*
|
||||
* @param countName 域名
|
||||
* @return boolean
|
||||
* @throws
|
||||
* @author ZhangSan_Plus
|
||||
* @date 10:11 2022/8/31
|
||||
**/
|
||||
public static boolean CNRulesMate(String countName) {
|
||||
Matcher m = CN_PATTERN.matcher(countName);
|
||||
if (m.find()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 对包含中文的域名进行中文域名解析
|
||||
*
|
||||
* @param doMain
|
||||
* @return java.lang.String
|
||||
* @throws
|
||||
* @author ZhangSan_Plus
|
||||
* @date 10:11 2022/8/31
|
||||
**/
|
||||
public static String chineseDomainNameDecoding(String doMain) throws Exception {
|
||||
String[] doMainPunyList = doMain.split("\\.");
|
||||
String doMainPunyCode = "";
|
||||
// 中文域名的解析
|
||||
for (int i = 0; i < doMainPunyList.length; i++) {
|
||||
if (i == doMainPunyList.length - 1) {
|
||||
if (CNRulesMate(doMainPunyList[i])) {
|
||||
doMainPunyCode += "xn--" + PunyUtils.encode(doMainPunyList[i]);
|
||||
} else {
|
||||
doMainPunyCode += doMainPunyList[i];
|
||||
}
|
||||
} else {
|
||||
if (CNRulesMate(doMainPunyList[i])) {
|
||||
doMainPunyCode += "xn--" + PunyUtils.encode(doMainPunyList[i]) + ".";
|
||||
} else {
|
||||
doMainPunyCode += doMainPunyList[i] + ".";
|
||||
}
|
||||
}
|
||||
}
|
||||
return doMainPunyCode;
|
||||
}
|
||||
|
||||
static class Verifier implements HostnameVerifier {
|
||||
|
||||
@Override
|
||||
public boolean verify(String arg0, SSLSession arg1) {
|
||||
return true; // mark everything as verified
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 信任所有证书实现类
|
||||
*/
|
||||
static class miTM implements javax.net.ssl.TrustManager, javax.net.ssl.X509TrustManager {
|
||||
@Override
|
||||
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isServerTrusted(java.security.cert.X509Certificate[] certs) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isClientTrusted(java.security.cert.X509Certificate[] certs) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkServerTrusted(java.security.cert.X509Certificate[] certs, String authType) {
|
||||
return;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkClientTrusted(java.security.cert.X509Certificate[] certs, String authType) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 信任网站所有SSL证书
|
||||
*
|
||||
* @param status
|
||||
* @return void
|
||||
* @throws
|
||||
* @author ZhangSan_Plus
|
||||
* @date 10:11 2022/8/31
|
||||
**/
|
||||
private static void trustAllHttpsCertificates(Integer status) throws Exception {
|
||||
javax.net.ssl.TrustManager[] trustAllCerts = new javax.net.ssl.TrustManager[1];
|
||||
javax.net.ssl.TrustManager tm = new miTM();
|
||||
trustAllCerts[0] = tm;
|
||||
// 实例化SSL协议
|
||||
javax.net.ssl.SSLContext sc = (status == 1) ? javax.net.ssl.SSLContext.getInstance("TLSv1.2") : javax.net.ssl.SSLContext.getInstance("SSL");
|
||||
|
||||
// 实例化SSl协议 信任所有证书
|
||||
sc.init(null, trustAllCerts, null);
|
||||
javax.net.ssl.HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
|
||||
}
|
||||
|
||||
/**
|
||||
* 证书后续处理具体规则匹配
|
||||
*
|
||||
* @param cert
|
||||
* @param xccSSLInfo
|
||||
* @return com.cym.utils.cert.CertExportEmailVO
|
||||
* @throws
|
||||
* @author ZhangSan_Plus
|
||||
* @date 19:40 2022/9/5
|
||||
**/
|
||||
public static CertExportEmailVO deal(X509Certificate cert, CertExportEmailVO xccSSLInfo) throws Exception {
|
||||
Map<String, String> certInfo = getCertInfo(cert.toString());
|
||||
List<String> sansList = new ArrayList<>();
|
||||
if (Objects.nonNull(cert.getSubjectAlternativeNames())) {
|
||||
Collection<List<?>> subjectAlternativeNames = cert.getSubjectAlternativeNames();
|
||||
subjectAlternativeNames.forEach(c -> sansList.add(c.get(1).toString()));
|
||||
}
|
||||
// Root root = JSON.parseObject(JSON.toJSONString(cert), Root.class);
|
||||
// xccSSLInfo.setCommonUrl(root.getSubjectDN().getCommonName());
|
||||
xccSSLInfo.setCommonUrl(cert.getSubjectX500Principal().getName());
|
||||
// xccSSLInfo.setCommonName(root.getSubjectDN().getCommonName());
|
||||
xccSSLInfo.setCommonName(cert.getSubjectX500Principal().getName());
|
||||
xccSSLInfo.setSignatureAlgorithm(cert.getSigAlgName());
|
||||
xccSSLInfo.setEncryptionAlgorithm(cert.toString().contains("SHA256withECDSA") ? "ECDSA 256 bits" : "RSA 2048 bits");
|
||||
xccSSLInfo.setCertificateTransparency("是 (Google: (来自证书,有效); Apple: (来自证书,有效))Firefox: (来自证书,有效))");
|
||||
xccSSLInfo.setRevocationStatus(NORMAL_STR);
|
||||
/**
|
||||
* 主题信息
|
||||
*/
|
||||
xccSSLInfo.setSubjectCN(sslSp(cert.getSubjectDN().toString(), CN_STR));
|
||||
xccSSLInfo.setSubjectO(sslSp(cert.getSubjectDN().toString(), O_STR));
|
||||
xccSSLInfo.setSubjectST(sslSp(cert.getSubjectDN().toString(), ST_STR));
|
||||
xccSSLInfo.setSubjectOU(sslSp(cert.getSubjectDN().toString(), OU_STR));
|
||||
xccSSLInfo.setSubjectL(sslSp(cert.getSubjectDN().toString(), L_STR));
|
||||
xccSSLInfo.setSubjectC(sslSp(cert.getSubjectDN().toString(), C_STR));
|
||||
|
||||
/**
|
||||
* 签发者信息
|
||||
*/
|
||||
xccSSLInfo.setIssueCN(sslSp(cert.getIssuerDN().toString(), CN_STR));
|
||||
xccSSLInfo.setIssueO(sslSp(cert.getIssuerDN().toString(), O_STR));
|
||||
xccSSLInfo.setIssueOU(sslSp(cert.getIssuerDN().toString(), OU_STR));
|
||||
xccSSLInfo.setIssueC(sslSp(cert.getIssuerDN().toString(), C_STR));
|
||||
|
||||
/**
|
||||
* 证书信息
|
||||
*/
|
||||
xccSSLInfo.setSerialNumber(certInfo.get("serialNumber"));
|
||||
xccSSLInfo.setAlgorithm(cert.getSigAlgName());
|
||||
xccSSLInfo.setCertificateType(getSSLType(cert));
|
||||
xccSSLInfo.setCertificateBrand(sslSp(cert.getIssuerDN().toString(), CN_STR).split(" ")[0]);
|
||||
xccSSLInfo.setPrivateKeyLen("2048 Bits");
|
||||
xccSSLInfo.setSHA1Fingerprint(getThumbPrint(cert, SHA1_AUTH_STR).toUpperCase());
|
||||
xccSSLInfo.setSHA256Fingerprint(getThumbPrint(cert, SHA256_AUTH_STR).toUpperCase());
|
||||
xccSSLInfo.setStartTime(DateUtils.formatDate(cert.getNotBefore(), DateUtils.DATETIME_DEFAULT));
|
||||
xccSSLInfo.setEndTime(DateUtils.formatDate(cert.getNotAfter(), DateUtils.DATETIME_DEFAULT));
|
||||
xccSSLInfo.setSuccess(DateUtils.daysBetween(new Date(), cert.getNotAfter()) > 0 && StringUtils.isBlank(xccSSLInfo.getSuccess()) ? NORMAL_STR : "已过期");
|
||||
xccSSLInfo.setTrustStatus(DateUtils.daysBetween(new Date(), cert.getNotAfter()) > 0 && StringUtils.isBlank(xccSSLInfo.getTrustStatus()) ? "可信" : "已过期");
|
||||
xccSSLInfo.setValidityPeriod(DateUtils.daysBetween(new Date(), cert.getNotAfter()) + "天");
|
||||
xccSSLInfo.setExtKeyUsage("extKeyUsage:Server authentication,Client authentication");
|
||||
xccSSLInfo.setSans(sansList);
|
||||
// xccSSLInfo.setOcspUrl((Objects.nonNull(root.getAuthorityInfoAccessExtension())) ? root.getAuthorityInfoAccessExtension().getAccessDescriptions().get(0).getAccessLocation().getName().getName() : "");
|
||||
// xccSSLInfo.setCaUrl((Objects.nonNull(root.getAuthorityInfoAccessExtension())) ? root.getAuthorityInfoAccessExtension().getAccessDescriptions().get(0).getAccessLocation().getName().getName() : "");
|
||||
xccSSLInfo.setCrlUrl(certInfo.get("crlUrl"));
|
||||
xccSSLInfo.setPublicKey(cert.getPublicKey().getFormat());
|
||||
xccSSLInfo.setOpenSSL("OpenSSL:" + "\n" + "Certificate:" + "\n" + cert);
|
||||
return xccSSLInfo;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取证书链
|
||||
*
|
||||
* @param certificates
|
||||
* @return java.util.List<com.cym.utils.cert.CertificateChain>
|
||||
* @throws
|
||||
* @author ZhangSan_Plus
|
||||
* @date 15:40 2022/9/1
|
||||
**/
|
||||
public static List<CertificateChain> getCertChain(Certificate[] certificates, String thumbPrint) throws Exception {
|
||||
List<CertificateChain> certificateChains = Lists.newArrayList();
|
||||
List<Certificate> x509Certificates = Arrays.asList(certificates);
|
||||
List<X509Certificate> certificateList = Lists.newLinkedList();
|
||||
int thumb = 0;
|
||||
for (int i = 0; i < x509Certificates.size(); i++) {
|
||||
X509Certificate cert = (X509Certificate) certificates[i];
|
||||
certificateList.add(cert);
|
||||
if (thumbPrint.equals(getThumbPrint(cert, SHA1_AUTH_STR).toUpperCase())) {
|
||||
thumb = i;
|
||||
}
|
||||
}
|
||||
List<X509Certificate> certificates1 = certificateList.subList(thumb, x509Certificates.size());
|
||||
certificates1.forEach(c -> {
|
||||
CertificateChain certificateChain = certChainDeal(c);
|
||||
certificateChains.add(certificateChain);
|
||||
});
|
||||
return certificateChains;
|
||||
}
|
||||
|
||||
public static List<CertificateChain> getCertChain1(Certificate[] certificates) throws Exception {
|
||||
List<CertificateChain> certificateChains = Lists.newArrayList();
|
||||
for (int i = 0; i < certificates.length; i++) {
|
||||
X509Certificate cert = (X509Certificate) certificates[i];
|
||||
CertificateChain certificateChain = certChainDeal(cert);
|
||||
certificateChains.add(certificateChain);
|
||||
}
|
||||
return certificateChains;
|
||||
}
|
||||
|
||||
public static CertificateChain certChainDeal(X509Certificate cert) {
|
||||
CertificateChain certificateChain = new CertificateChain();
|
||||
certificateChain.setValidityPeriod(DateUtils.formatDate(cert.getNotBefore(), DateUtils.DATETIME_YYYY_MM_DD_HH_MM_SS).concat("~")
|
||||
.concat(DateUtils.formatDate(cert.getNotAfter(), DateUtils.DATETIME_YYYY_MM_DD_HH_MM_SS)).concat("(剩余 " + DateUtils.daysBetween(new Date(), cert.getNotAfter()) + "天)"));
|
||||
try {
|
||||
certificateChain.setCertFingerprint(getThumbPrint(cert, SHA1_AUTH_STR).toUpperCase());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
certificateChain.setEncryptionAlgorithm(cert.toString().contains("SHA256withECDSA") ? "ECDSA 256 bits" : "RSA 2048 bits");
|
||||
certificateChain.setSignAlgorithm(cert.getSigAlgName());
|
||||
certificateChain.setIssuedTo(sslSp(cert.getSubjectDN().toString(), CN_STR));
|
||||
certificateChain.setIssuer(sslSp(cert.getIssuerDN().toString(), CN_STR));
|
||||
return certificateChain;
|
||||
}
|
||||
|
||||
/**
|
||||
* 信任所有证书
|
||||
*
|
||||
* @param hpUrl
|
||||
* @return com.cym.utils.cert.CertExportEmailVO
|
||||
* @throws
|
||||
* @author ZhangSan_Plus
|
||||
* @date 14:32 2022/9/2
|
||||
**/
|
||||
public static CertExportEmailVO trustDetection(String hpUrl) throws Exception {
|
||||
CertExportEmailVO xccSSLInfo = new CertExportEmailVO();
|
||||
URL url = new URL(HTTPS_STR + hpUrl);
|
||||
// 发起HTTPS请求
|
||||
trustAllHttpsCertificates(2);
|
||||
HttpsURLConnection conn = getConn(url);
|
||||
conn.setHostnameVerifier(new Verifier());
|
||||
try {
|
||||
conn.connect();
|
||||
Certificate[] serverCertificates = conn.getServerCertificates();
|
||||
X509Certificate certs = (X509Certificate) serverCertificates[0];
|
||||
xccSSLInfo = deal(certs, xccSSLInfo);
|
||||
List<CertificateChain> certChain = getCertChain(serverCertificates, getThumbPrint(certs, SHA1_AUTH_STR).toUpperCase());
|
||||
xccSSLInfo.setCertificateChains(certChain);
|
||||
String parentCert = (serverCertificates.length > 1) ? NO_STR : YES_STR;
|
||||
xccSSLInfo.setOcspBindState(parentCert.equals(YES_STR) ? SUPPORT_STR : NO_SUPPORT_STR);
|
||||
xccSSLInfo.setOcspMustBind(parentCert.equals(YES_STR) ? YES_STR : NO_STR);
|
||||
xccSSLInfo.setIsSNI(parentCert.equals(YES_STR) ? YES_STR : NO_STR);
|
||||
xccSSLInfo.setWeakKey(parentCert.equals(YES_STR) ? NO_STR : YES_STR);
|
||||
conn.disconnect();
|
||||
if (!xccSSLInfo.getCommonName().contains(hpUrl.substring(hpUrl.indexOf(".") + 1))) {
|
||||
if (xccSSLInfo.getSans().size() == 0 || !xccSSLInfo.getSans().contains(hpUrl)) {
|
||||
xccSSLInfo.setCommonName(xccSSLInfo.getCommonName() + " (不匹配)");
|
||||
xccSSLInfo.setSuccess(DOMAIN_NOT_MATCH_STR);
|
||||
xccSSLInfo.setTrustStatus("域名不匹配 (主流浏览器访问不受影响,影响少数不支持SNI的旧浏览器)");
|
||||
}
|
||||
}
|
||||
} catch (ConnectException e) {
|
||||
return xccSSLInfo;
|
||||
} catch (Exception cer) {
|
||||
return xccSSLInfo;
|
||||
} finally {
|
||||
conn.disconnect();
|
||||
}
|
||||
return xccSSLInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 证书类型规则匹配 -- DV 证书信息中仅包含COMMON_NAME 信息 -- OV 证书信息中包含企业的一些基本信息 -- EV
|
||||
* 证书中包含企业的工商注册号 SERIALNUMBER
|
||||
*
|
||||
* @param cert X.509证书链
|
||||
* @return java.lang.String
|
||||
* @throws
|
||||
* @author ZhangSan_Plus
|
||||
* @date 10:12 2022/8/31
|
||||
**/
|
||||
public static String getSSLType(X509Certificate cert) {
|
||||
if (StringUtils.isBlank(sslSp(cert.getSubjectDN().toString(), O_STR)) && StringUtils.isBlank(sslSp(cert.getSubjectDN().toString(), ST_STR))) {
|
||||
return DV_SSL_STR;
|
||||
}
|
||||
if (StringUtils.isBlank(sslSp(cert.getSubjectDN().toString(), SERIALNUMBER_STR))) {
|
||||
return OV_SSL_STR;
|
||||
} else {
|
||||
return EV_SSL_STR;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取证书序列号及CRURL(证书列表吊销信息) domain:https://sina.com.cn eg:
|
||||
* http://crl3.digicert.com/GeoTrustCNRSACAG1.crl,http://crl4.digicert.com/GeoTrustCNRSACAG1.crl
|
||||
*
|
||||
* @param cert
|
||||
* @return java.util.Map<java.lang.String, java.lang.String>
|
||||
* @throws
|
||||
* @author ZhangSan_Plus
|
||||
* @date 10:14 2022/8/31
|
||||
**/
|
||||
public static Map<String, String> getCertInfo(String cert) {
|
||||
Map<String, String> certMap = Maps.newHashMap();
|
||||
if (cert.contains("SerialNumber: [") && cert.contains("]\n" + "\n" + "Certificate")) {
|
||||
try {
|
||||
String serialNumber = cert.substring(cert.indexOf("SerialNumber: ["), cert.indexOf("]\n" + "\n" + "Certificate")).replace(" ", "").replace("SerialNumber:[", "").replace("]", "")
|
||||
.toUpperCase();
|
||||
certMap.put("serialNumber", serialNumber);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else {
|
||||
String serialNumber = cert.substring(cert.indexOf("SerialNumber: ["), cert.indexOf("]\n" + " Algorithm: [")).replaceAll(" ", "").replaceAll("SerialNumber:\\[", "").replaceAll("]", "")
|
||||
.toUpperCase();
|
||||
certMap.put("serialNumber", serialNumber);
|
||||
}
|
||||
if (cert.contains("[URIName:")) {
|
||||
String crlUrl = cert.substring(cert.indexOf("[URIName:"), cert.indexOf("[6]")).replaceAll("\\[URIName:", "").replaceAll("]", "").replaceAll("DistributionPoint:", "").replaceAll("\n", "")
|
||||
.replaceAll(" ", "");
|
||||
certMap.put("crlUrl", crlUrl);
|
||||
}
|
||||
return certMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据规则匹配颁发者和使用者的信息
|
||||
*
|
||||
* @param str
|
||||
* @param key
|
||||
* @return java.lang.String
|
||||
* @throws
|
||||
* @author ZhangSan_Plus
|
||||
* @date 10:17 2022/8/31
|
||||
**/
|
||||
public static String sslSp(String str, String key) {
|
||||
if (str.contains(".,")) {
|
||||
str = str.replace(".,", "&");
|
||||
}
|
||||
Map<String, String> maps = Maps.newHashMap();
|
||||
String[] split = str.split(",");
|
||||
for (String s : split) {
|
||||
if (s.contains("=")) {
|
||||
String[] split1 = s.split("=");
|
||||
if (split1.length == 2) {
|
||||
maps.put(split1[0].trim(), split1[1].replace("\"", ""));
|
||||
}
|
||||
}
|
||||
}
|
||||
return maps.containsKey(key) ? maps.get(key) : "";
|
||||
}
|
||||
|
||||
/**
|
||||
* @param cert
|
||||
* @param algorithm 算法(支持SHA-1 和 SHA-256)
|
||||
* @return java.lang.String
|
||||
* @throws
|
||||
* @author ZhangSan_Plus
|
||||
* @date 10:17 2022/8/31
|
||||
**/
|
||||
private static String getThumbPrint(X509Certificate cert, String algorithm) throws Exception {
|
||||
MessageDigest md = MessageDigest.getInstance(algorithm);
|
||||
byte[] der = cert.getEncoded();
|
||||
md.update(der);
|
||||
byte[] digest = md.digest();
|
||||
return bytesToHexString(digest);
|
||||
}
|
||||
|
||||
/**
|
||||
* byte[]转String
|
||||
*
|
||||
* @param src
|
||||
* @return java.lang.String
|
||||
* @throws
|
||||
* @author ZhangSan_Plus
|
||||
* @date 10:21 2022/8/31
|
||||
**/
|
||||
private static String bytesToHexString(byte[] src) {
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
if (src == null || src.length <= 0) {
|
||||
return null;
|
||||
}
|
||||
for (int i = 0; i < src.length; i++) {
|
||||
int v = src[i] & 0xFF;
|
||||
String hv = Integer.toHexString(v);
|
||||
if (hv.length() < 2) {
|
||||
stringBuilder.append(0);
|
||||
}
|
||||
stringBuilder.append(hv);
|
||||
}
|
||||
return stringBuilder.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取网站信息
|
||||
*
|
||||
* @param web
|
||||
* @return java.util.Map<java.lang.String, java.lang.String>
|
||||
* @throws
|
||||
* @author ZhangSan_Plus
|
||||
* @date 13:40 2022/9/1
|
||||
**/
|
||||
public static Map<String, String> getWebInfo(String vls, String web) {
|
||||
Map<String, String> webMap = Maps.newHashMap();
|
||||
try {
|
||||
trustAllHttpsCertificates(2);
|
||||
URL url = new URL(vls + web);
|
||||
String ipAddress = InetAddress.getByName(web).getHostAddress();
|
||||
URLConnection URLconnection = url.openConnection();
|
||||
HttpURLConnection httpConnection = (HttpURLConnection) URLconnection;
|
||||
int responseCode = httpConnection.getResponseCode();
|
||||
webMap.put("ip", StringUtils.isBlank(ipAddress) ? "-" : ipAddress);
|
||||
webMap.put("favicon", findIco(vls + web));
|
||||
if (!getResponseStatus().contains(responseCode)) {
|
||||
InputStream in = httpConnection.getInputStream();
|
||||
InputStreamReader isr = new InputStreamReader(in);
|
||||
BufferedReader bufferedReader = new BufferedReader(isr);
|
||||
String str;
|
||||
while ((str = bufferedReader.readLine()) != null) {
|
||||
String trim = str.trim();
|
||||
if (trim.contains("<title>")) {
|
||||
String titleStr = trim.substring(trim.indexOf("<title>"), trim.indexOf("</title>")).replace("<title>", "");
|
||||
webMap.put("title", responseCode == 301 ? "redirect to https://" + web : titleStr);
|
||||
}
|
||||
}
|
||||
bufferedReader.close();
|
||||
} else {
|
||||
webMap.put("title", "redirect to https://" + web);
|
||||
webMap.put("ip", "-");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return webMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取网站favicon
|
||||
*
|
||||
* @param navUrl
|
||||
* @return java.lang.String
|
||||
* @throws
|
||||
* @author ZhangSan_Plus
|
||||
* @date 13:36 2022/9/1
|
||||
**/
|
||||
private static String findIco(String navUrl) {
|
||||
String body = HttpUtil.get(navUrl);
|
||||
String str = body.split("/favicon.ico")[0];
|
||||
int http = str.indexOf(HTTPS_STR, str.length() - 100);
|
||||
if (http == -1) {
|
||||
http = str.indexOf(HTTPS_STR, str.length() - 100);
|
||||
}
|
||||
if (http == -1) {
|
||||
// 说明没有指定 走拼接逻辑
|
||||
int i = navUrl.indexOf("/", 8);
|
||||
if (i > 0) {
|
||||
navUrl = navUrl.substring(0, i);
|
||||
}
|
||||
} else {
|
||||
navUrl = str.substring(http);
|
||||
}
|
||||
return navUrl + "/favicon.ico";
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取证书兼容性测试
|
||||
*
|
||||
* @param success
|
||||
* @return java.util.Map<java.lang.String, java.lang.String>
|
||||
* @throws
|
||||
* @author ZhangSan_Plus
|
||||
* @date 17:20 2022/9/1
|
||||
**/
|
||||
public static Map<String, String> certCompatible(String success) {
|
||||
Map<String, String> maps = Maps.newLinkedHashMap();
|
||||
String status = success.equals(NORMAL_STR) ? YES_STR : NO_STR;
|
||||
if (success.equals("网址无法访问") || success.equals("没有证书")) {
|
||||
return maps;
|
||||
} else {
|
||||
maps.put("Android 2.3 (Gingerbread)", status);
|
||||
maps.put("Android 4.0 (Ice Cream Sandwich)", status);
|
||||
maps.put("Android 4.1 (Jelly Bean)", status);
|
||||
maps.put("Android 4.2 (Jelly Bean)", status);
|
||||
maps.put("Android 4.3 (Jelly Bean)", status);
|
||||
maps.put("Android 4.4 (KitKat)", status);
|
||||
maps.put("Android 5.0 (Lollipop)", status);
|
||||
maps.put("Android 5.1 (Lollipop)", status);
|
||||
maps.put("Android 6.0 (Marshmallow)", status);
|
||||
maps.put("Android 7.0 (Android Nougat)", status);
|
||||
maps.put("Android 7.1 (Android Nougat)", status);
|
||||
maps.put("Android 8.0 (Android Oreo)", status);
|
||||
maps.put("Android 9.0 (Android Pie)", status);
|
||||
maps.put("Android 10.0 (Android Q)", status);
|
||||
maps.put("Android 11.0 (Android R)", status);
|
||||
maps.put("iOS 5-6", status);
|
||||
maps.put("iOS 7", status);
|
||||
maps.put("iOS 8", status);
|
||||
maps.put("iOS 9", status);
|
||||
maps.put("iOS 10", status);
|
||||
maps.put("iOS 11", status);
|
||||
maps.put("iOS 12", status);
|
||||
maps.put("iOS 13", status);
|
||||
maps.put("iOS 14", status);
|
||||
maps.put("OS X 10.9 (Mavericks)", status);
|
||||
maps.put("OS X 10.10 (Yosemite)", status);
|
||||
maps.put("OS X 10.11 (Eicapitan)", status);
|
||||
maps.put("OS X 10.12 (Sierra)", status);
|
||||
maps.put("OS X 10.13 (High Sierra)", status);
|
||||
maps.put("OS X 10.14 (Mojave)", status);
|
||||
maps.put("java 7u181", status);
|
||||
maps.put("java 8u161", status);
|
||||
maps.put("java_8u181", status);
|
||||
maps.put("java_8u202", status);
|
||||
maps.put("java 9", status);
|
||||
maps.put("java 10", status);
|
||||
maps.put("java 11", status);
|
||||
maps.put("java 12", status);
|
||||
maps.put("java 13", status);
|
||||
maps.put("java 17", status);
|
||||
maps.put("Firefox 3.0", status);
|
||||
maps.put("Firefox 3.5", status);
|
||||
maps.put("Firefox 3.6", status);
|
||||
maps.put("Firefox 6.0", status);
|
||||
maps.put("Firefox 16", status);
|
||||
maps.put("Firefox 23", status);
|
||||
maps.put("Firefox 32", status);
|
||||
maps.put("Firefox 42", status);
|
||||
maps.put("Firefox 50", status);
|
||||
maps.put("Firefox 51", status);
|
||||
maps.put("Firefox 54", status);
|
||||
maps.put("Firefox 58", status);
|
||||
maps.put("Firefox 63", status);
|
||||
maps.put("Firefox 65", status);
|
||||
maps.put("Windows XP", status);
|
||||
maps.put("Windows 7", status);
|
||||
maps.put("Windows 8", status);
|
||||
maps.put("Windows 10", status);
|
||||
maps.put("Windows 11", status);
|
||||
}
|
||||
return maps;
|
||||
}
|
||||
|
||||
public static String getRating(CertExportEmailVO certExportEmailVO) {
|
||||
if (certExportEmailVO.getSuccess().equals(NORMAL_STR) && certExportEmailVO.getCertificateType().equals(EV_SSL_STR)) {
|
||||
return "A+";
|
||||
}
|
||||
if (certExportEmailVO.getSuccess().equals(NORMAL_STR) && certExportEmailVO.getCertificateType().equals(OV_SSL_STR)) {
|
||||
return "A";
|
||||
}
|
||||
if (certExportEmailVO.getSuccess().equals(NORMAL_STR) && certExportEmailVO.getCertificateType().equals(DV_SSL_STR)) {
|
||||
return "A-";
|
||||
}
|
||||
if (certExportEmailVO.getSuccess().equals(DOMAIN_NOT_MATCH_STR)) {
|
||||
return "T";
|
||||
}
|
||||
return "B";
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取证书响应错误状态码
|
||||
*
|
||||
* @param
|
||||
* @return java.util.List<java.lang.Integer>
|
||||
* @throws
|
||||
* @author ZhangSan_Plus
|
||||
* @date 11:26 2022/9/2
|
||||
**/
|
||||
public static List<Integer> getResponseStatus() {
|
||||
String code = "[\n" + " 404,\n" + " 400,\n" + " 500,\n" + " 502,\n" + " 503,\n" + " 504,\n" + " 505,\n" + " 506,\n" + " 507,\n" + " 508,\n" + " 509,\n" + " 511,\n" + " 512,\n"
|
||||
+ " 513,\n" + " 521,\n" + " 530,\n" + " 600,\n" + " 651\n" + "]";
|
||||
List<Integer> codeList = JSON.parseObject(code, List.class);
|
||||
return codeList;
|
||||
}
|
||||
|
||||
public CertExportEmailVO getCertChain(String fingerprint, String hpUrl) throws Exception {
|
||||
hpUrl = hpUrl.contains(HTTP_STR) || hpUrl.contains(HTTPS_STR) ? hpUrl.replaceAll(HTTP_STR, "").replaceAll(HTTPS_STR, "").trim() : hpUrl.trim();
|
||||
hpUrl = CNRulesMate(hpUrl) ? chineseDomainNameDecoding(hpUrl) : hpUrl;
|
||||
CertExportEmailVO certExportEmailVO1 = distrustCert(fingerprint, hpUrl);
|
||||
CertExportEmailVO certExportEmailVO = noDistrustCert(fingerprint, hpUrl);
|
||||
return StringUtils.isNotBlank(certExportEmailVO1.getSerialNumber()) ? certExportEmailVO1 : certExportEmailVO;
|
||||
}
|
||||
|
||||
public static CertExportEmailVO distrustCert(String fingerprint, String hpUrl) throws Exception {
|
||||
URL url = new URL(HTTPS_STR + hpUrl);
|
||||
// 发起HTTPS请求
|
||||
trustAllHttpsCertificates(1);
|
||||
HttpsURLConnection conn = getConn(url);
|
||||
CertExportEmailVO certExportEmailVO = new CertExportEmailVO();
|
||||
try {
|
||||
conn.connect();
|
||||
Certificate[] serverCertificates = conn.getServerCertificates();
|
||||
for (int i = 0; i < serverCertificates.length; i++) {
|
||||
X509Certificate certs = (X509Certificate) serverCertificates[i];
|
||||
if (getThumbPrint(certs, SHA1_AUTH_STR).toUpperCase().equals(fingerprint)) {
|
||||
certExportEmailVO = deal(certs, certExportEmailVO);
|
||||
certExportEmailVO.setCertificateChains(getCertChain(serverCertificates, getThumbPrint(certs, SHA1_AUTH_STR).toUpperCase()));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
} finally {
|
||||
conn.disconnect();
|
||||
}
|
||||
return certExportEmailVO;
|
||||
}
|
||||
|
||||
public static CertExportEmailVO noDistrustCert(String fingerprint, String hpUrl) throws Exception {
|
||||
CertExportEmailVO certExportEmailVO = new CertExportEmailVO();
|
||||
URL url = new URL(HTTPS_STR + hpUrl);
|
||||
trustAllHttpsCertificates(2);
|
||||
HttpsURLConnection conn = getConn(url);
|
||||
conn.setHostnameVerifier(new Verifier());
|
||||
try {
|
||||
conn.connect();
|
||||
Certificate[] serverCertificates = conn.getServerCertificates();
|
||||
for (int i = 0; i < serverCertificates.length; i++) {
|
||||
X509Certificate certs = (X509Certificate) serverCertificates[i];
|
||||
if (getThumbPrint(certs, SHA1_AUTH_STR).toUpperCase().equals(fingerprint)) {
|
||||
certExportEmailVO = deal(certs, certExportEmailVO);
|
||||
certExportEmailVO.setCertificateChains(getCertChain(serverCertificates, getThumbPrint(certs, SHA1_AUTH_STR).toUpperCase()));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
} finally {
|
||||
conn.disconnect();
|
||||
}
|
||||
return certExportEmailVO;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,928 @@
|
||||
package com.cym.utils.cert;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.time.DateFormatUtils;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
/**
|
||||
* @ClassName DateUtils
|
||||
* @Description 日期工具类
|
||||
* @Author ZhangSan_Plus
|
||||
* @Date 2020/5/11 9:53
|
||||
* @Version 1.0
|
||||
**/
|
||||
public class DateUtils {
|
||||
public final static int FORMAT_DEFAULT = 0;
|
||||
|
||||
/**
|
||||
* 日时字符串格式:长格式(如:年份用4位表示)
|
||||
*/
|
||||
public final static int FORMAT_LONG = 1;
|
||||
|
||||
/**
|
||||
* 日时字符串格式:短格式(如:年份用2位表示)
|
||||
*/
|
||||
public final static int FORMAT_SHORT = 2;
|
||||
|
||||
/**
|
||||
* 默认日期字符串格式 "yyyy-MM-dd"
|
||||
*/
|
||||
public final static String DATE_DEFAULT = "yyyy-MM-dd";
|
||||
/**
|
||||
* 日期字符串格式 "yyyy"
|
||||
*/
|
||||
private final static String DATE_YYYY = "yyyy";
|
||||
/**
|
||||
* 日期字符串格式 "mm"
|
||||
*/
|
||||
private final static String DATE_MM = "mm";
|
||||
/**
|
||||
* 日期字符串格式 "dd"
|
||||
*/
|
||||
private final static String DATE_DD = "dd";
|
||||
/**
|
||||
* 日期字符串格式 "yyyyMM"
|
||||
*/
|
||||
public final static String DATE_YYYYMM = "yyyyMM";
|
||||
|
||||
/**
|
||||
* 日期字符串格式 "yyyyMMdd"
|
||||
*/
|
||||
public final static String DATE_YYYYMMDD = "yyyyMMdd";
|
||||
|
||||
/**
|
||||
* 日期字符串格式 "yyyy-MM"
|
||||
*/
|
||||
public final static String DATE_YYYY_MM = "yyyy-MM";
|
||||
|
||||
/**
|
||||
* 日期字符串格式 "yyyy-MM-dd"
|
||||
*/
|
||||
public final static String DATE_YYYY_MM_DD = "yyyy-MM-dd";
|
||||
|
||||
/**
|
||||
* 默认日时字符串格式 "yyyy-MM-dd HH:mm:ss"
|
||||
*/
|
||||
public final static String DATETIME_DEFAULT = "yyyy-MM-dd HH:mm:ss";
|
||||
|
||||
/**
|
||||
* 日时字符串格式 "yyyy-MM-dd HH:mm"
|
||||
*/
|
||||
public final static String DATETIME_YYYY_MM_DD_HH_MM = "yyyy-MM-dd HH:mm";
|
||||
|
||||
/**
|
||||
* 日时字符串格式 "yyyy-MM-dd HH:mm:ss"
|
||||
*/
|
||||
public final static String DATETIME_YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
|
||||
|
||||
/**
|
||||
* 日时字符串格式 "yyyy-MM-dd HH:mm:ss.SSS"
|
||||
*/
|
||||
public final static String DATETIME_YYYY_MM_DD_HH_MM_SS_SSS = "yyyy-MM-dd HH:mm:ss.SSS";
|
||||
|
||||
/**
|
||||
* 默认时间字符串格式 "HH:mm:ss"
|
||||
*/
|
||||
public final static String TIME_DEFAULT = "HH:mm:ss";
|
||||
|
||||
/**
|
||||
* 默认时间字符串格式 "HH:mm"
|
||||
*/
|
||||
public final static String TIME_HH_MM = "HH:mm";
|
||||
|
||||
/**
|
||||
* 默认时间字符串格式 "HH:mm:ss"
|
||||
*/
|
||||
public final static String TIME_HH_MM_SS = "HH:mm:ss";
|
||||
/**
|
||||
* 年
|
||||
*/
|
||||
public static final long YEAR_NUMBER = 365;
|
||||
/**
|
||||
* 分
|
||||
*/
|
||||
public static final long MINUTE_TTL = 60 * 1000L;
|
||||
/**
|
||||
* 时
|
||||
*/
|
||||
public static final long HOURS_TTL = 60 * 60 * 1000L;
|
||||
/**
|
||||
* 半天
|
||||
*/
|
||||
public static final long HALF_DAY_TTL = 12 * 60 * 60 * 1000L;
|
||||
/**
|
||||
* 天
|
||||
*/
|
||||
public static final long DAY_TTL = 24 * 60 * 60L * 1000L;
|
||||
/**
|
||||
* 月
|
||||
*/
|
||||
public static final long MONTH_TTL = 30 * 24 * 60 * 60 * 1000L;
|
||||
public static final String DAY_BEFORE_STR = "天前";
|
||||
public static final String HOUR_BEFORE_STR = "小时前";
|
||||
public static final String MINUTE_BEFORE_STR = "分钟前";
|
||||
public static final String SECONDS_BEFORE_STR = "秒前";
|
||||
public static final String TIME_OPERATION_SRT = "TIME_OPERATION";
|
||||
public static final String TIME_STRAP_STR = "TIME_STRAP";
|
||||
|
||||
public static Integer getMonth(Integer month) {
|
||||
Calendar c = Calendar.getInstance();
|
||||
c.setTime(new Date());
|
||||
c.add(Calendar.MONTH, month);
|
||||
return c.get(Calendar.YEAR);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将字符串转换成日期
|
||||
*
|
||||
* @param str
|
||||
* @return java.util.Date
|
||||
* @author ZhangSan_Plus
|
||||
* @description //
|
||||
* @date 18:46 2022/2/28
|
||||
**/
|
||||
public static Date getDateToStr(String str) {
|
||||
SimpleDateFormat format = new SimpleDateFormat(DATE_YYYY_MM_DD);
|
||||
Date r = null;
|
||||
try {
|
||||
r = format.parse(str);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
/**
|
||||
* 时间计算
|
||||
*
|
||||
* @param day
|
||||
* @return
|
||||
*/
|
||||
public static String countData(String day) {
|
||||
SimpleDateFormat format = new SimpleDateFormat(DATE_YYYY_MM_DD);
|
||||
Calendar c = Calendar.getInstance();
|
||||
c.add(Calendar.YEAR, -Integer.parseInt(day));
|
||||
Date start = c.getTime();
|
||||
String startDay = format.format(start);
|
||||
return startDay;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定日期前一天日期
|
||||
*
|
||||
* @param specifiedDay
|
||||
* @return java.lang.String
|
||||
* @throws
|
||||
* @author ZhangSan_Plus
|
||||
* @date 17:04 2021/4/30
|
||||
**/
|
||||
public static String getSpecifiedDayBefore(String specifiedDay) {
|
||||
Calendar c = Calendar.getInstance();
|
||||
Date date = null;
|
||||
try {
|
||||
date = new SimpleDateFormat(DATE_YYYY_MM_DD).parse(specifiedDay);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
c.setTime(date);
|
||||
int day = c.get(Calendar.DATE);
|
||||
c.set(Calendar.DATE, day - 1);
|
||||
|
||||
String dayBefore = new SimpleDateFormat(DATE_YYYY_MM_DD).format(c.getTime());
|
||||
return dayBefore;
|
||||
}
|
||||
|
||||
public static String ToSevenDate(String specifiedDay) {
|
||||
Calendar c = Calendar.getInstance();
|
||||
Date date = null;
|
||||
try {
|
||||
date = new SimpleDateFormat(DATE_YYYY_MM_DD).parse(specifiedDay);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
c.setTime(date);
|
||||
int day = c.get(Calendar.DATE);
|
||||
c.set(Calendar.DATE, day - 7);
|
||||
|
||||
String dayBefore = new SimpleDateFormat(DATE_YYYY_MM_DD).format(c.getTime());
|
||||
return dayBefore;
|
||||
}
|
||||
|
||||
public static String ToThirtyDate(String specifiedDay) {
|
||||
Calendar c = Calendar.getInstance();
|
||||
Date date = null;
|
||||
try {
|
||||
date = new SimpleDateFormat(DATE_YYYY_MM_DD).parse(specifiedDay);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
c.setTime(date);
|
||||
int day = c.get(Calendar.DATE);
|
||||
c.set(Calendar.DATE, day - 30);
|
||||
|
||||
String dayBefore = new SimpleDateFormat(DATE_YYYY_MM_DD).format(c.getTime());
|
||||
return dayBefore;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定日期后一天的数据
|
||||
*
|
||||
* @param
|
||||
* @return java.lang.String
|
||||
* @throws
|
||||
* @author ZhangSan_Plus
|
||||
* @date 17:35 2021/4/30
|
||||
**/
|
||||
public static String getSpecifiedDayAfter(String specifiedDay) {
|
||||
Calendar c = Calendar.getInstance();
|
||||
Date date = null;
|
||||
try {
|
||||
date = new SimpleDateFormat(DATE_YYYY_MM_DD).parse(specifiedDay);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
c.setTime(date);
|
||||
int day = c.get(Calendar.DATE);
|
||||
c.set(Calendar.DATE, day + 1);
|
||||
|
||||
String dayAfter = new SimpleDateFormat(DATE_YYYY_MM_DD).format(c.getTime());
|
||||
return dayAfter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the difference between two time
|
||||
*
|
||||
* @param startDate
|
||||
* @param endDate
|
||||
* @return int(两个时间相差的天数)
|
||||
* @throws
|
||||
* @Author ZhangSan_Plus
|
||||
*/
|
||||
public static int daysBetween(Date startDate, Date endDate) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(startDate);
|
||||
long sTime = calendar.getTimeInMillis();
|
||||
calendar.setTime(endDate);
|
||||
long endTime = calendar.getTimeInMillis();
|
||||
long between_days = (endTime - sTime) / DAY_TTL;
|
||||
return Integer.parseInt(String.valueOf(between_days));
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算时间差距年月,并计算信用分
|
||||
*
|
||||
* @param fromDate
|
||||
* @param toDate
|
||||
* @return java.util.Map<java.lang.String, java.lang.Object>
|
||||
* @author ZhangSan_Plus
|
||||
* @description //
|
||||
* @date 9:34 2021/12/17
|
||||
**/
|
||||
public static Map<String, Object> dayCompare(Date fromDate, Date toDate, Integer type) {
|
||||
Map<String, Object> maps = Maps.newHashMap();
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(fromDate);
|
||||
int startY = calendar.get(Calendar.YEAR);
|
||||
int startM = calendar.get(Calendar.MONTH);
|
||||
Calendar calendar1 = Calendar.getInstance();
|
||||
calendar1.setTime(toDate);
|
||||
int endY = calendar1.get(Calendar.YEAR);
|
||||
int endM = calendar1.get(Calendar.MONTH);
|
||||
int mos = (endY - startY) * 12 + (endM - startM);
|
||||
int lyear = mos / 12;
|
||||
int lmonth = mos % 12;
|
||||
maps.put("year", lyear);
|
||||
maps.put("month", lmonth);
|
||||
if (type == 1) {
|
||||
if (lyear != 0) {
|
||||
if (lmonth == 0) {
|
||||
maps.put("cred", lyear + "年");
|
||||
maps.put("sources", (lyear * 12 * 10 + lmonth * 10));
|
||||
} else {
|
||||
maps.put("cred", lyear + "年" + lmonth + "个月");
|
||||
maps.put("sources", (lyear * 12 * 10 + lmonth * 10));
|
||||
}
|
||||
} else {
|
||||
if (lmonth == 0) {
|
||||
lmonth = lmonth + 1;
|
||||
}
|
||||
maps.put("cred", lmonth + "个月");
|
||||
maps.put("sources", (lmonth * 10));
|
||||
}
|
||||
} else {
|
||||
maps.put("cred", lyear + 1 + "年");
|
||||
}
|
||||
return maps;
|
||||
}
|
||||
|
||||
/**
|
||||
* 时间戳差值计算
|
||||
*
|
||||
* @param
|
||||
* @return java.lang.String
|
||||
* @throws
|
||||
* @author liyangshuai
|
||||
* @date 15:40 2021/6/9
|
||||
**/
|
||||
public static String getDistanceTime(long time1, long time2) {
|
||||
long diff;
|
||||
if (time1 < time2) {
|
||||
diff = time2 - time1;
|
||||
} else {
|
||||
diff = time1 - time2;
|
||||
}
|
||||
long day = diff / (DAY_TTL);
|
||||
long hour = (diff / (60 * 60 * 1000) - day * 24);
|
||||
long min = ((diff / (60 * 1000)) - day * 24 * 60 - hour * 60);
|
||||
long sec = (diff / 1000 - day * 24 * 60 * 60 - hour * 60 * 60 - min * 60);
|
||||
if (day != 0) {
|
||||
if (day > 10) {
|
||||
return sdf.format(new Date(time2));
|
||||
}
|
||||
return day + "天前";
|
||||
}
|
||||
if (hour != 0) {
|
||||
return hour + HOUR_BEFORE_STR;
|
||||
}
|
||||
if (min != 0) {
|
||||
return min + MINUTE_BEFORE_STR;
|
||||
}
|
||||
if (sec != 0) {
|
||||
return sec + SECONDS_BEFORE_STR;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
private static SimpleDateFormat sdf = new SimpleDateFormat(DATE_YYYY_MM_DD);
|
||||
private static SimpleDateFormat HMSSdf = new SimpleDateFormat(DATETIME_YYYY_MM_DD_HH_MM_SS);
|
||||
|
||||
public static Map<String, Object> getDateUnixStr(String dateStr) throws ParseException {
|
||||
Map<String, Object> map = Maps.newHashMap();
|
||||
long diff;
|
||||
long time1 = System.currentTimeMillis();
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(HMSSdf.parse(dateStr));
|
||||
calendar.add(Calendar.DAY_OF_MONTH, 0);
|
||||
long time2 = calendar.getTime().getTime();
|
||||
map.put(TIME_STRAP_STR, time2);
|
||||
if (time1 < time2) {
|
||||
diff = time2 - time1;
|
||||
} else {
|
||||
diff = time1 - time2;
|
||||
}
|
||||
long day = diff / (DAY_TTL);
|
||||
long hour = (diff / (60 * 60 * 1000) - day * 24);
|
||||
long min = ((diff / (60 * 1000)) - day * 24 * 60 - hour * 60);
|
||||
long sec = (diff / 1000 - day * 24 * 60 * 60 - hour * 60 * 60 - min * 60);
|
||||
if (day != 0) {
|
||||
map.put(TIME_OPERATION_SRT, String.valueOf(sdf.format(new Date(time2))));
|
||||
return map;
|
||||
}
|
||||
if (hour != 0) {
|
||||
map.put(TIME_OPERATION_SRT, hour + HOUR_BEFORE_STR);
|
||||
return map;
|
||||
}
|
||||
if (min != 0) {
|
||||
map.put(TIME_OPERATION_SRT, min + MINUTE_BEFORE_STR);
|
||||
return map;
|
||||
}
|
||||
if (sec != 0) {
|
||||
map.put(TIME_OPERATION_SRT, sec + SECONDS_BEFORE_STR);
|
||||
return map;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current system time
|
||||
*
|
||||
* @param
|
||||
* @return java.util.Date
|
||||
* @throws
|
||||
* @author ZhangSan_Plus
|
||||
* @date 17:36 2021/4/30
|
||||
**/
|
||||
public static Date getNewDate() {
|
||||
SimpleDateFormat df = new SimpleDateFormat(DATETIME_YYYY_MM_DD_HH_MM_SS);
|
||||
Date newDate = null;
|
||||
try {
|
||||
newDate = df.parse(df.format(new Date()));
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return newDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the date string format by default(yyyy-MM-dd) pattern can "yyyy-MM-dd"
|
||||
* "HH:mm:ss" "E"
|
||||
*
|
||||
* @param date
|
||||
* @param pattern
|
||||
* @return java.lang.String
|
||||
* @throws
|
||||
* @author ZhangSan_Plus
|
||||
* @date 17:37 2021/4/30
|
||||
**/
|
||||
public static String formatDate(Date date, Object... pattern) {
|
||||
String formatDate = null;
|
||||
if (pattern != null && pattern.length > 0) {
|
||||
formatDate = DateFormatUtils.format(date, pattern[0].toString());
|
||||
} else {
|
||||
formatDate = DateFormatUtils.format(date, DATE_YYYY_MM_DD);
|
||||
}
|
||||
return formatDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据指定的时间催获取时间
|
||||
*
|
||||
* @param dateUnix
|
||||
* @return java.lang.String
|
||||
* @throws
|
||||
* @author ZhangSan_Plus
|
||||
* @date 11:00 2021/7/5
|
||||
**/
|
||||
public static String getDateByDateUnix(Long dateUnix) {
|
||||
return sdf.format(new Date(dateUnix * 1000));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定日期 指定天数的字符串值
|
||||
*
|
||||
* @param date
|
||||
* @param days
|
||||
* @return java.lang.String
|
||||
* @throws
|
||||
* @author ZhangSan_Plus
|
||||
* @date 14:39 2021/5/6
|
||||
**/
|
||||
public static String getDisposeDate(Date date, Integer days) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(date);
|
||||
calendar.add(Calendar.DAY_OF_MONTH, days);
|
||||
return DateFormatUtils.format(calendar.getTime(), DATE_YYYY_MM_DD);
|
||||
}
|
||||
|
||||
public static Date getDisposeToDate(Date date, Integer days) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(date);
|
||||
calendar.add(Calendar.DAY_OF_MONTH, days);
|
||||
return calendar.getTime();
|
||||
}
|
||||
|
||||
public static Date getDisposeToYear(Date date, Integer year) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(date);
|
||||
calendar.add(Calendar.YEAR, year);
|
||||
return calendar.getTime();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定时间的时间戳
|
||||
* <p>
|
||||
* (int) (System.currentTimeMillis() / 1000) https://tool.lu/timestamp/
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @param
|
||||
* @return long
|
||||
* @throws
|
||||
* @author liyangshuai
|
||||
* @date 15:28 2021/6/9
|
||||
**/
|
||||
public static long getUnixNum(Date date, Integer days) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(date);
|
||||
calendar.add(Calendar.DAY_OF_MONTH, days);
|
||||
long time = calendar.getTime().getTime() / 1000;
|
||||
return time;
|
||||
}
|
||||
|
||||
/**
|
||||
* get the current year str format(yyyy)
|
||||
*
|
||||
* @param
|
||||
* @return java.lang.String
|
||||
* @throws
|
||||
* @author ZhangSan_Plus
|
||||
* @date 17:49 2021/4/30
|
||||
**/
|
||||
public static String getYear() {
|
||||
return formatDate(new Date(), DATE_YYYY);
|
||||
}
|
||||
|
||||
/**
|
||||
* get the current month format(MM)
|
||||
*
|
||||
* @param
|
||||
* @return java.lang.String
|
||||
* @throws
|
||||
* @author ZhangSan_Plus
|
||||
* @date 17:52 2021/4/30
|
||||
**/
|
||||
public static String getMonth() {
|
||||
return formatDate(new Date(), DATE_MM);
|
||||
}
|
||||
|
||||
/**
|
||||
* get the current day format(dd)
|
||||
*
|
||||
* @param
|
||||
* @return java.lang.String
|
||||
* @throws
|
||||
* @author ZhangSan_Plus
|
||||
* @date 17:52 2021/4/30
|
||||
**/
|
||||
public static String getDay() {
|
||||
return formatDate(new Date(), DATE_DD);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前时间的字符串形式(例如;"201806291135")
|
||||
*
|
||||
* @return 年月日时分
|
||||
*/
|
||||
public static String getDateToString() {
|
||||
Calendar c = Calendar.getInstance();
|
||||
return getYear() + getMonth() + getDay() + c.get(Calendar.HOUR_OF_DAY) + c.get(Calendar.MINUTE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of years in the past
|
||||
*
|
||||
* @param date
|
||||
* @return java.lang.Long
|
||||
* @throws
|
||||
* @author ZhangSan_Plus
|
||||
* @date 17:37 2021/4/30
|
||||
**/
|
||||
public static Long pastYear(Date date) {
|
||||
return date == null ? null : pastDays(date) / YEAR_NUMBER;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of days in the past
|
||||
*
|
||||
* @param date
|
||||
* @return long
|
||||
* @throws
|
||||
* @author ZhangSan_Plus
|
||||
* @date 17:38 2021/4/30
|
||||
**/
|
||||
public static long pastDays(Date date) {
|
||||
long t = System.currentTimeMillis() - date.getTime();
|
||||
return t / DAY_TTL;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取过去的小时
|
||||
*
|
||||
* @param date
|
||||
* @return long
|
||||
* @throws
|
||||
* @author ZhangSan_Plus
|
||||
* @date 17:38 2021/4/30
|
||||
**/
|
||||
public static long pastHour(Date date) {
|
||||
long t = System.currentTimeMillis() - date.getTime();
|
||||
return t / HOURS_TTL;
|
||||
}
|
||||
|
||||
/**
|
||||
* return To date the number of days in the past
|
||||
*
|
||||
* @param date
|
||||
* @return long
|
||||
* @throws
|
||||
* @author ZhangSan_Plus
|
||||
* @date 17:39 2021/4/30
|
||||
**/
|
||||
public static long pastMinutes(Date date) {
|
||||
long t = System.currentTimeMillis() - date.getTime();
|
||||
return t / MINUTE_TTL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of days between two dates
|
||||
*
|
||||
* @param before
|
||||
* @param after
|
||||
* @return double
|
||||
* @throws
|
||||
* @author ZhangSan_Plus
|
||||
* @date 17:39 2021/4/30
|
||||
**/
|
||||
public static double getDistanceOfTwoDate(Date before, Date after) {
|
||||
long beforeTime = before.getTime();
|
||||
long afterTime = after.getTime();
|
||||
return (afterTime - beforeTime) / DAY_TTL;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过身份证号码获取出生日期、性别、年齡
|
||||
*
|
||||
* @param certificateNo
|
||||
* @return 返回的出生日期格式:1990-01-01 性别格式:2-女,1-男
|
||||
*/
|
||||
public static Map<String, String> getBirAgeSex(String certificateNo) {
|
||||
String birthday = "";
|
||||
String age = "";
|
||||
String sexCode = "";
|
||||
int year = Calendar.getInstance().get(Calendar.YEAR);
|
||||
char[] number = certificateNo.toCharArray();
|
||||
boolean flag = true;
|
||||
if (number.length == 15) {
|
||||
for (int x = 0; x < number.length; x++) {
|
||||
if (!flag) {
|
||||
return new HashMap<>(10);
|
||||
}
|
||||
flag = Character.isDigit(number[x]);
|
||||
}
|
||||
} else if (number.length == 18) {
|
||||
for (int x = 0; x < number.length - 1; x++) {
|
||||
if (!flag) {
|
||||
return new HashMap<>(10);
|
||||
}
|
||||
flag = Character.isDigit(number[x]);
|
||||
|
||||
}
|
||||
}
|
||||
if (flag && certificateNo.length() == 15) {
|
||||
birthday = "19" + certificateNo.substring(6, 8) + "-" + certificateNo.substring(8, 10) + "-" + certificateNo.substring(10, 12);
|
||||
sexCode = Integer.parseInt(certificateNo.substring(certificateNo.length() - 3, certificateNo.length())) % 2 == 0 ? "2" : "1";
|
||||
age = (year - Integer.parseInt("19" + certificateNo.substring(6, 8))) + "";
|
||||
} else {
|
||||
birthday = certificateNo.substring(6, 10) + "-" + certificateNo.substring(10, 12) + "-" + certificateNo.substring(12, 14);
|
||||
sexCode = Integer.parseInt(certificateNo.substring(certificateNo.length() - 4, certificateNo.length() - 1)) % 2 == 0 ? "2" : "1";
|
||||
age = (year - Integer.parseInt(certificateNo.substring(6, 10))) + "";
|
||||
}
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("birthday", birthday);
|
||||
map.put("age", age);
|
||||
map.put("sexCode", sexCode);
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据身份证的号码算出当前身份证持有者的年龄 18位身份证
|
||||
*
|
||||
* @return
|
||||
* @throws Exception
|
||||
* @author ZhangSan_Plus
|
||||
*/
|
||||
public static int getCarAge(String birthday) {
|
||||
// 得到年份
|
||||
String year = birthday.substring(0, 4);
|
||||
// 得到月份
|
||||
String yue = birthday.substring(4, 6);
|
||||
// 得到当前的系统时间
|
||||
Date date = new Date();
|
||||
SimpleDateFormat format = new SimpleDateFormat(DATE_YYYY_MM_DD);
|
||||
// 当前年份
|
||||
String fYear = format.format(date).substring(0, 4);
|
||||
// 月份
|
||||
String fYue = format.format(date).substring(5, 7);
|
||||
int age = 0;
|
||||
// 当前月份大于用户出身的月份表示已过生
|
||||
if (Integer.parseInt(yue) <= Integer.parseInt(fYue)) {
|
||||
age = Integer.parseInt(fYear) - Integer.parseInt(year) + 1;
|
||||
} else {// 当前用户还没过生
|
||||
age = Integer.parseInt(fYear) - Integer.parseInt(year);
|
||||
}
|
||||
return age;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据身份证获取性别
|
||||
*/
|
||||
public static String getCarSex(String CardCode) {
|
||||
String sex;
|
||||
if (Integer.parseInt(CardCode.substring(16).substring(0, 1)) % 2 == 0) {
|
||||
// 判断性别
|
||||
sex = "2";
|
||||
} else {
|
||||
sex = "1";
|
||||
}
|
||||
return sex;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据传入的日历型日期,计算出执行的时间值(精确版)
|
||||
*
|
||||
* @param beginTime
|
||||
* @param endTime
|
||||
* @return
|
||||
*/
|
||||
public static String countExecTimeToString_exact(Calendar beginTime, Calendar endTime) {// 计算两个日期类型之间的差值(单位:毫秒)
|
||||
Long timeDispersion = endTime.getTimeInMillis() - beginTime.getTimeInMillis();
|
||||
String tmpMsg = "耗时: ";
|
||||
// 记录时间的数值(几小时、几分、几秒)
|
||||
int timeNum = 0;
|
||||
// 判断是否足够一小时
|
||||
if (timeDispersion >= (HOURS_TTL)) { // 若足够则计算有几小时
|
||||
timeNum = (int) (timeDispersion / HOURS_TTL);
|
||||
tmpMsg += timeNum + "时";
|
||||
timeDispersion = timeDispersion - (timeNum * HOURS_TTL);
|
||||
}
|
||||
// 判断是否足够一分钟
|
||||
if (timeDispersion >= (MINUTE_TTL)) {// 若足够则计算有几分钟
|
||||
timeNum = (int) (timeDispersion / MINUTE_TTL);
|
||||
tmpMsg += timeNum + "分";
|
||||
timeDispersion = timeDispersion - (timeNum * MINUTE_TTL);
|
||||
}
|
||||
// 判断是否足够一秒
|
||||
if (timeDispersion >= 1000) {
|
||||
timeNum = (int) (timeDispersion / 1000);
|
||||
tmpMsg += timeNum + "秒";
|
||||
timeDispersion = timeDispersion - timeNum * 1000;
|
||||
}
|
||||
tmpMsg += timeDispersion + "毫秒";
|
||||
return tmpMsg;
|
||||
}
|
||||
|
||||
/**
|
||||
* 直接返回毫秒数
|
||||
*
|
||||
* @param beginTime
|
||||
* @param endTime
|
||||
* @return java.lang.Long
|
||||
* @throws
|
||||
* @author ZhangSan_Plus
|
||||
* @date 14:43 2021/5/6
|
||||
**/
|
||||
public static Long countMsDataTime(Calendar beginTime, Calendar endTime) {
|
||||
return (endTime.getTimeInMillis() - beginTime.getTimeInMillis());
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据传入的long类型日期,计算出执行的时间值(精确版)
|
||||
*
|
||||
* @param beginTime
|
||||
* @param endTime
|
||||
* @return java.lang.String
|
||||
* @throws
|
||||
* @author ZhangSan_Plus
|
||||
* @date 14:44 2021/5/6
|
||||
**/
|
||||
public static String countMsDataTimeToString(Long beginTime, Long endTime) {
|
||||
Long timeDispersion = endTime - beginTime;
|
||||
String tmpMsg = "耗时: ";
|
||||
int timeNum = 0;
|
||||
if (timeDispersion >= (HOURS_TTL)) {
|
||||
timeNum = (int) (timeDispersion / (HOURS_TTL));
|
||||
tmpMsg += timeNum + "时";
|
||||
timeDispersion = timeDispersion - (timeNum * HOURS_TTL);
|
||||
}
|
||||
if (timeDispersion >= (MINUTE_TTL)) {
|
||||
timeNum = (int) (timeDispersion / (MINUTE_TTL));
|
||||
tmpMsg += timeNum + "分";
|
||||
timeDispersion = timeDispersion - (timeNum * MINUTE_TTL);
|
||||
}
|
||||
if (timeDispersion >= 1000) {
|
||||
timeNum = (int) (timeDispersion / 1000);
|
||||
tmpMsg += timeNum + "秒";
|
||||
timeDispersion = timeDispersion - timeNum * 1000;
|
||||
}
|
||||
tmpMsg += timeDispersion + "毫秒";
|
||||
return tmpMsg;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定年度全部月份集合
|
||||
*
|
||||
* @param year
|
||||
* @return java.util.List<java.lang.String>
|
||||
* @throws
|
||||
* @author ZhangSan_Plus
|
||||
* @date 14:45 2021/5/6
|
||||
**/
|
||||
public static List<String> getYearMonthByYear(String year) {
|
||||
List<String> monthList = new ArrayList<>();
|
||||
for (int i = 1; i <= 12; i++) {
|
||||
monthList.add(year + "-" + (i < 10 ? "0" : "") + i);
|
||||
}
|
||||
return monthList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取下个月
|
||||
*
|
||||
* @param dateStr
|
||||
* @param format
|
||||
* @return java.lang.String
|
||||
* @throws
|
||||
* @author ZhangSan_Plus
|
||||
* @date 14:45 2021/5/6
|
||||
**/
|
||||
public static String getPreMonth(String dateStr, String format) {
|
||||
String preMonth = "";
|
||||
SimpleDateFormat sdf = new SimpleDateFormat(format);
|
||||
Date date;
|
||||
try {
|
||||
date = sdf.parse(dateStr);
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(date);
|
||||
calendar.add(Calendar.MONTH, 1);
|
||||
sdf.format(calendar.getTime());
|
||||
|
||||
} catch (ParseException e) {
|
||||
// Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
return preMonth;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取下个月str
|
||||
*
|
||||
* @param dateStr
|
||||
* @param format
|
||||
* @return java.lang.String
|
||||
* @throws
|
||||
* @author ZhangSan_Plus
|
||||
* @date 14:46 2021/5/6
|
||||
**/
|
||||
public static String getPreMonthFormat(String dateStr, String format) {
|
||||
String preMonth = "";
|
||||
SimpleDateFormat sdf = new SimpleDateFormat(format);
|
||||
Date date;
|
||||
try {
|
||||
date = sdf.parse(dateStr);
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(date);
|
||||
calendar.add(Calendar.MONTH, 1);
|
||||
preMonth = sdf.format(calendar.getTime());
|
||||
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return preMonth;
|
||||
}
|
||||
|
||||
/**
|
||||
* 日期比较
|
||||
*
|
||||
* @param
|
||||
* @return boolean
|
||||
* @throws
|
||||
* @author ZhangSan_Plus
|
||||
* @date 14:47 2021/5/6
|
||||
**/
|
||||
public static boolean dateSize(String aDate, String bDate, SimpleDateFormat format) {
|
||||
boolean str = false;
|
||||
try {
|
||||
if (StringUtils.isBlank(aDate) && StringUtils.isBlank(bDate)) {
|
||||
Date date1 = format.parse(aDate);
|
||||
Date date2 = format.parse(bDate);
|
||||
str = date1.after(date2);
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
// Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
public static Map<Integer, Long> timestamp() {
|
||||
Map<Integer, Long> timeMap = Maps.newHashMap();
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(new Date());
|
||||
int[] yearArr = new int[] { 1, 1, 1, 2, 5, 1 };
|
||||
int[] arr = new int[] { 1, 2, 3, 5, 10, 11 };
|
||||
for (int i = 0; i < yearArr.length; i++) {
|
||||
calendar.add(Calendar.YEAR, -yearArr[i]);
|
||||
timeMap.put(arr[i], calendar.getTimeInMillis());
|
||||
}
|
||||
return timeMap;
|
||||
}
|
||||
|
||||
public static Date getDateToOne() {
|
||||
Date date = new Date();
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(date);
|
||||
calendar.add(Calendar.MONTH, 1);
|
||||
/**
|
||||
* 1. getActualMinimum(Calendar.DAY_OF_MONTH)是拿到当月最小天数作为第一天
|
||||
*
|
||||
* 2. calendar.set(Calendar.DAY_OF_MONTH, 1)也能获取当月第一天
|
||||
*/
|
||||
calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMinimum(Calendar.DAY_OF_MONTH));
|
||||
System.out.println(calendar.getTime());
|
||||
String s = DateUtils.formatDate(calendar.getTime(), DateUtils.DATE_YYYY_MM_DD);
|
||||
System.out.println(s);
|
||||
return calendar.getTime();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,194 @@
|
||||
package com.cym.utils.cert;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author czh
|
||||
* @data 2020/10/20 10:47
|
||||
*/
|
||||
public class PunyUtils {
|
||||
static int TMIN = 1;
|
||||
static int TMAX = 26;
|
||||
static int BASE = 36;
|
||||
static int INITIAL_N = 128;
|
||||
static int INITIAL_BIAS = 72;
|
||||
static int DAMP = 700;
|
||||
static int SKEW = 38;
|
||||
static char DELIMITER = '-';
|
||||
|
||||
|
||||
public static String encode(String input) throws Exception {
|
||||
int n = INITIAL_N;
|
||||
int delta = 0;
|
||||
int bias = INITIAL_BIAS;
|
||||
StringBuilder output = new StringBuilder();
|
||||
// Copy all basic code points to the output
|
||||
int b = 0;
|
||||
for (int i = 0; i < input.length(); i++) {
|
||||
char c = input.charAt(i);
|
||||
if (isBasic(c)) {
|
||||
output.append(c);
|
||||
b++;
|
||||
}
|
||||
}
|
||||
// Append delimiter
|
||||
if (b > 0) {
|
||||
output.append(DELIMITER);
|
||||
}
|
||||
int h = b;
|
||||
while (h < input.length()) {
|
||||
int m = Integer.MAX_VALUE;
|
||||
// Find the minimum code point >= n
|
||||
for (int i = 0; i < input.length(); i++) {
|
||||
int c = input.charAt(i);
|
||||
if (c >= n && c < m) {
|
||||
m = c;
|
||||
}
|
||||
}
|
||||
if (m - n > (Integer.MAX_VALUE - delta) / (h + 1)) {
|
||||
throw new Exception("OVERFLOW");
|
||||
}
|
||||
delta = delta + (m - n) * (h + 1);
|
||||
n = m;
|
||||
for (int j = 0; j < input.length(); j++) {
|
||||
int c = input.charAt(j);
|
||||
if (c < n) {
|
||||
delta++;
|
||||
if (0 == delta) {
|
||||
throw new Exception("OVERFLOW");
|
||||
}
|
||||
}
|
||||
if (c == n) {
|
||||
int q = delta;
|
||||
for (int k = BASE;; k += BASE) {
|
||||
int t;
|
||||
if (k <= bias) {
|
||||
t = TMIN;
|
||||
} else if (k >= bias + TMAX) {
|
||||
t = TMAX;
|
||||
} else {
|
||||
t = k - bias;
|
||||
}
|
||||
if (q < t) {
|
||||
break;
|
||||
}
|
||||
output.append((char) digit2codepoint(t + (q - t) % (BASE - t)));
|
||||
q = (q - t) / (BASE - t);
|
||||
}
|
||||
output.append((char) digit2codepoint(q));
|
||||
bias = adapt(delta, h + 1, h == b);
|
||||
delta = 0;
|
||||
h++;
|
||||
}
|
||||
}
|
||||
delta++;
|
||||
n++;
|
||||
}
|
||||
return output.toString();
|
||||
}
|
||||
/**
|
||||
* Decode a punycoded string.
|
||||
*
|
||||
* @param input
|
||||
* Punycode string
|
||||
*
|
||||
* @return Unicode string.
|
||||
*/
|
||||
public static String decode(String input) throws Exception {
|
||||
int n = INITIAL_N;
|
||||
int i = 0;
|
||||
int bias = INITIAL_BIAS;
|
||||
StringBuilder output = new StringBuilder();
|
||||
int d = input.lastIndexOf(DELIMITER);
|
||||
if (d > 0) {
|
||||
for (int j = 0; j < d; j++) {
|
||||
char c = input.charAt(j);
|
||||
if (!isBasic(c)) {
|
||||
throw new Exception("BAD_INPUT");
|
||||
}
|
||||
output.append(c);
|
||||
}
|
||||
d++;
|
||||
} else {
|
||||
d = 0;
|
||||
}
|
||||
while (d < input.length()) {
|
||||
int oldi = i;
|
||||
int w = 1;
|
||||
for (int k = BASE;; k += BASE) {
|
||||
if (d == input.length()) {
|
||||
throw new Exception("BAD_INPUT");
|
||||
}
|
||||
int c = input.charAt(d++);
|
||||
int digit = codepoint2digit(c);
|
||||
if (digit > (Integer.MAX_VALUE - i) / w) {
|
||||
throw new Exception("OVERFLOW");
|
||||
}
|
||||
i = i + digit * w;
|
||||
int t;
|
||||
if (k <= bias) {
|
||||
t = TMIN;
|
||||
} else if (k >= bias + TMAX) {
|
||||
t = TMAX;
|
||||
} else {
|
||||
t = k - bias;
|
||||
}
|
||||
if (digit < t) {
|
||||
break;
|
||||
}
|
||||
w = w * (BASE - t);
|
||||
}
|
||||
bias = adapt(i - oldi, output.length() + 1, oldi == 0);
|
||||
if (i / (output.length() + 1) > Integer.MAX_VALUE - n) {
|
||||
throw new Exception("OVERFLOW");
|
||||
}
|
||||
n = n + i / (output.length() + 1);
|
||||
i = i % (output.length() + 1);
|
||||
output.insert(i, (char) n);
|
||||
i++;
|
||||
}
|
||||
return output.toString();
|
||||
}
|
||||
|
||||
public static int adapt(int delta, int numpoints, boolean first) {
|
||||
if (first) {
|
||||
delta = delta / DAMP;
|
||||
} else {
|
||||
delta = delta / 2;
|
||||
}
|
||||
delta = delta + (delta / numpoints);
|
||||
int k = 0;
|
||||
while (delta > ((BASE - TMIN) * TMAX) / 2) {
|
||||
delta = delta / (BASE - TMIN);
|
||||
k = k + BASE;
|
||||
}
|
||||
return k + ((BASE - TMIN + 1) * delta) / (delta + SKEW);
|
||||
}
|
||||
|
||||
public static boolean isBasic(char c) {
|
||||
return c < 0x80;
|
||||
}
|
||||
public static int digit2codepoint(int d) throws Exception {
|
||||
if (d < 26) {
|
||||
// 0..25 : 'a'..'z'
|
||||
return d + 'a';
|
||||
} else if (d < 36) {
|
||||
// 26..35 : '0'..'9';
|
||||
return d - 26 + '0';
|
||||
} else {
|
||||
throw new Exception("BAD_INPUT");
|
||||
}
|
||||
}
|
||||
public static int codepoint2digit(int c) throws Exception {
|
||||
if (c - '0' < 10) {
|
||||
// '0'..'9' : 26..35
|
||||
return c - '0' + 26;
|
||||
} else if (c - 'a' < 26) {
|
||||
// 'a'..'z' : 0..25
|
||||
return c - 'a';
|
||||
} else {
|
||||
throw new Exception("BAD_INPUT");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
|
||||
package com.cym.utils.cert.ssl;
|
||||
public class AccessDescriptions
|
||||
{
|
||||
private AccessLocation accessLocation;
|
||||
|
||||
private AccessMethod accessMethod;
|
||||
|
||||
public void setAccessLocation(AccessLocation accessLocation){
|
||||
this.accessLocation = accessLocation;
|
||||
}
|
||||
public AccessLocation getAccessLocation(){
|
||||
return this.accessLocation;
|
||||
}
|
||||
public void setAccessMethod(AccessMethod accessMethod){
|
||||
this.accessMethod = accessMethod;
|
||||
}
|
||||
public AccessMethod getAccessMethod(){
|
||||
return this.accessMethod;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.cym.utils.cert.ssl;
|
||||
public class AccessLocation
|
||||
{
|
||||
private Name name;
|
||||
|
||||
private int type;
|
||||
|
||||
public void setName(Name name){
|
||||
this.name = name;
|
||||
}
|
||||
public Name getName(){
|
||||
return this.name;
|
||||
}
|
||||
public void setType(int type){
|
||||
this.type = type;
|
||||
}
|
||||
public int getType(){
|
||||
return this.type;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package com.cym.utils.cert.ssl;
|
||||
public class AccessMethod
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.cym.utils.cert.ssl;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class AlgorithmId {
|
||||
private String name;
|
||||
|
||||
private OID oID;
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public void setOID(OID oID) {
|
||||
this.oID = oID;
|
||||
}
|
||||
|
||||
public OID getOID() {
|
||||
return this.oID;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.cym.utils.cert.ssl;
|
||||
public class AuthKeyId
|
||||
{
|
||||
private String identifier;
|
||||
|
||||
public void setIdentifier(String identifier){
|
||||
this.identifier = identifier;
|
||||
}
|
||||
public String getIdentifier(){
|
||||
return this.identifier;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.cym.utils.cert.ssl;
|
||||
import java.util.List;
|
||||
|
||||
public class AuthorityInfoAccessExtension
|
||||
{
|
||||
private List<AccessDescriptions> accessDescriptions;
|
||||
|
||||
private boolean critical;
|
||||
|
||||
private List<String> elements;
|
||||
|
||||
private ExtensionId extensionId;
|
||||
|
||||
private String extensionValue;
|
||||
|
||||
private String id;
|
||||
|
||||
private String name;
|
||||
|
||||
private String value;
|
||||
|
||||
public void setAccessDescriptions(List<AccessDescriptions> accessDescriptions){
|
||||
this.accessDescriptions = accessDescriptions;
|
||||
}
|
||||
public List<AccessDescriptions> getAccessDescriptions(){
|
||||
return this.accessDescriptions;
|
||||
}
|
||||
public void setCritical(boolean critical){
|
||||
this.critical = critical;
|
||||
}
|
||||
public boolean getCritical(){
|
||||
return this.critical;
|
||||
}
|
||||
public void setElements(List<String> elements){
|
||||
this.elements = elements;
|
||||
}
|
||||
public List<String> getElements(){
|
||||
return this.elements;
|
||||
}
|
||||
public void setExtensionId(ExtensionId extensionId){
|
||||
this.extensionId = extensionId;
|
||||
}
|
||||
public ExtensionId getExtensionId(){
|
||||
return this.extensionId;
|
||||
}
|
||||
public void setExtensionValue(String extensionValue){
|
||||
this.extensionValue = extensionValue;
|
||||
}
|
||||
public String getExtensionValue(){
|
||||
return this.extensionValue;
|
||||
}
|
||||
public void setId(String id){
|
||||
this.id = id;
|
||||
}
|
||||
public String getId(){
|
||||
return this.id;
|
||||
}
|
||||
public void setName(String name){
|
||||
this.name = name;
|
||||
}
|
||||
public String getName(){
|
||||
return this.name;
|
||||
}
|
||||
public void setValue(String value){
|
||||
this.value = value;
|
||||
}
|
||||
public String getValue(){
|
||||
return this.value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.cym.utils.cert.ssl;
|
||||
import java.util.List;
|
||||
|
||||
public class AuthorityKeyIdentifierExtension
|
||||
{
|
||||
private boolean critical;
|
||||
|
||||
private List<String> elements;
|
||||
|
||||
private ExtensionId extensionId;
|
||||
|
||||
private String extensionValue;
|
||||
|
||||
private String id;
|
||||
|
||||
private String name;
|
||||
|
||||
private String value;
|
||||
|
||||
public void setCritical(boolean critical){
|
||||
this.critical = critical;
|
||||
}
|
||||
public boolean getCritical(){
|
||||
return this.critical;
|
||||
}
|
||||
public void setElements(List<String> elements){
|
||||
this.elements = elements;
|
||||
}
|
||||
public List<String> getElements(){
|
||||
return this.elements;
|
||||
}
|
||||
public void setExtensionId(ExtensionId extensionId){
|
||||
this.extensionId = extensionId;
|
||||
}
|
||||
public ExtensionId getExtensionId(){
|
||||
return this.extensionId;
|
||||
}
|
||||
public void setExtensionValue(String extensionValue){
|
||||
this.extensionValue = extensionValue;
|
||||
}
|
||||
public String getExtensionValue(){
|
||||
return this.extensionValue;
|
||||
}
|
||||
public void setId(String id){
|
||||
this.id = id;
|
||||
}
|
||||
public String getId(){
|
||||
return this.id;
|
||||
}
|
||||
public void setName(String name){
|
||||
this.name = name;
|
||||
}
|
||||
public String getName(){
|
||||
return this.name;
|
||||
}
|
||||
public void setValue(String value){
|
||||
this.value = value;
|
||||
}
|
||||
public String getValue(){
|
||||
return this.value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.cym.utils.cert.ssl;
|
||||
import java.util.List;
|
||||
|
||||
public class BasicConstraintsExtension
|
||||
{
|
||||
private boolean critical;
|
||||
|
||||
private List<String> elements;
|
||||
|
||||
private ExtensionId extensionId;
|
||||
|
||||
private String extensionValue;
|
||||
|
||||
private String id;
|
||||
|
||||
private String name;
|
||||
|
||||
private String value;
|
||||
|
||||
public void setCritical(boolean critical){
|
||||
this.critical = critical;
|
||||
}
|
||||
public boolean getCritical(){
|
||||
return this.critical;
|
||||
}
|
||||
public void setElements(List<String> elements){
|
||||
this.elements = elements;
|
||||
}
|
||||
public List<String> getElements(){
|
||||
return this.elements;
|
||||
}
|
||||
public void setExtensionId(ExtensionId extensionId){
|
||||
this.extensionId = extensionId;
|
||||
}
|
||||
public ExtensionId getExtensionId(){
|
||||
return this.extensionId;
|
||||
}
|
||||
public void setExtensionValue(String extensionValue){
|
||||
this.extensionValue = extensionValue;
|
||||
}
|
||||
public String getExtensionValue(){
|
||||
return this.extensionValue;
|
||||
}
|
||||
public void setId(String id){
|
||||
this.id = id;
|
||||
}
|
||||
public String getId(){
|
||||
return this.id;
|
||||
}
|
||||
public void setName(String name){
|
||||
this.name = name;
|
||||
}
|
||||
public String getName(){
|
||||
return this.name;
|
||||
}
|
||||
public void setValue(String value){
|
||||
this.value = value;
|
||||
}
|
||||
public String getValue(){
|
||||
return this.value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.cym.utils.cert.ssl;
|
||||
import java.util.List;
|
||||
|
||||
public class CRLDistributionPointsExtension
|
||||
{
|
||||
private boolean critical;
|
||||
|
||||
private List<String> elements;
|
||||
|
||||
private ExtensionId extensionId;
|
||||
|
||||
private String extensionValue;
|
||||
|
||||
private String id;
|
||||
|
||||
private String name;
|
||||
|
||||
private String value;
|
||||
|
||||
public void setCritical(boolean critical){
|
||||
this.critical = critical;
|
||||
}
|
||||
public boolean getCritical(){
|
||||
return this.critical;
|
||||
}
|
||||
public void setElements(List<String> elements){
|
||||
this.elements = elements;
|
||||
}
|
||||
public List<String> getElements(){
|
||||
return this.elements;
|
||||
}
|
||||
public void setExtensionId(ExtensionId extensionId){
|
||||
this.extensionId = extensionId;
|
||||
}
|
||||
public ExtensionId getExtensionId(){
|
||||
return this.extensionId;
|
||||
}
|
||||
public void setExtensionValue(String extensionValue){
|
||||
this.extensionValue = extensionValue;
|
||||
}
|
||||
public String getExtensionValue(){
|
||||
return this.extensionValue;
|
||||
}
|
||||
public void setId(String id){
|
||||
this.id = id;
|
||||
}
|
||||
public String getId(){
|
||||
return this.id;
|
||||
}
|
||||
public void setName(String name){
|
||||
this.name = name;
|
||||
}
|
||||
public String getName(){
|
||||
return this.name;
|
||||
}
|
||||
public void setValue(String value){
|
||||
this.value = value;
|
||||
}
|
||||
public String getValue(){
|
||||
return this.value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.cym.utils.cert.ssl;
|
||||
import java.util.List;
|
||||
|
||||
public class CertificatePoliciesExtension
|
||||
{
|
||||
private boolean critical;
|
||||
|
||||
private List<String> elements;
|
||||
|
||||
private ExtensionId extensionId;
|
||||
|
||||
private String extensionValue;
|
||||
|
||||
private String id;
|
||||
|
||||
private String name;
|
||||
|
||||
private String value;
|
||||
|
||||
public void setCritical(boolean critical){
|
||||
this.critical = critical;
|
||||
}
|
||||
public boolean getCritical(){
|
||||
return this.critical;
|
||||
}
|
||||
public void setElements(List<String> elements){
|
||||
this.elements = elements;
|
||||
}
|
||||
public List<String> getElements(){
|
||||
return this.elements;
|
||||
}
|
||||
public void setExtensionId(ExtensionId extensionId){
|
||||
this.extensionId = extensionId;
|
||||
}
|
||||
public ExtensionId getExtensionId(){
|
||||
return this.extensionId;
|
||||
}
|
||||
public void setExtensionValue(String extensionValue){
|
||||
this.extensionValue = extensionValue;
|
||||
}
|
||||
public String getExtensionValue(){
|
||||
return this.extensionValue;
|
||||
}
|
||||
public void setId(String id){
|
||||
this.id = id;
|
||||
}
|
||||
public String getId(){
|
||||
return this.id;
|
||||
}
|
||||
public void setName(String name){
|
||||
this.name = name;
|
||||
}
|
||||
public String getName(){
|
||||
return this.name;
|
||||
}
|
||||
public void setValue(String value){
|
||||
this.value = value;
|
||||
}
|
||||
public String getValue(){
|
||||
return this.value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.cym.utils.cert.ssl;
|
||||
import java.util.List;
|
||||
|
||||
public class ExtendedKeyUsageExtension
|
||||
{
|
||||
private boolean critical;
|
||||
|
||||
private List<String> elements;
|
||||
|
||||
private List<String> extendedKeyUsage;
|
||||
|
||||
private ExtensionId extensionId;
|
||||
|
||||
private String extensionValue;
|
||||
|
||||
private String id;
|
||||
|
||||
private String name;
|
||||
|
||||
private String value;
|
||||
|
||||
public void setCritical(boolean critical){
|
||||
this.critical = critical;
|
||||
}
|
||||
public boolean getCritical(){
|
||||
return this.critical;
|
||||
}
|
||||
public void setElements(List<String> elements){
|
||||
this.elements = elements;
|
||||
}
|
||||
public List<String> getElements(){
|
||||
return this.elements;
|
||||
}
|
||||
public void setExtendedKeyUsage(List<String> extendedKeyUsage){
|
||||
this.extendedKeyUsage = extendedKeyUsage;
|
||||
}
|
||||
public List<String> getExtendedKeyUsage(){
|
||||
return this.extendedKeyUsage;
|
||||
}
|
||||
public void setExtensionId(ExtensionId extensionId){
|
||||
this.extensionId = extensionId;
|
||||
}
|
||||
public ExtensionId getExtensionId(){
|
||||
return this.extensionId;
|
||||
}
|
||||
public void setExtensionValue(String extensionValue){
|
||||
this.extensionValue = extensionValue;
|
||||
}
|
||||
public String getExtensionValue(){
|
||||
return this.extensionValue;
|
||||
}
|
||||
public void setId(String id){
|
||||
this.id = id;
|
||||
}
|
||||
public String getId(){
|
||||
return this.id;
|
||||
}
|
||||
public void setName(String name){
|
||||
this.name = name;
|
||||
}
|
||||
public String getName(){
|
||||
return this.name;
|
||||
}
|
||||
public void setValue(String value){
|
||||
this.value = value;
|
||||
}
|
||||
public String getValue(){
|
||||
return this.value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package com.cym.utils.cert.ssl;
|
||||
public class ExtensionId
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.cym.utils.cert.ssl;
|
||||
|
||||
public class HostObject
|
||||
{
|
||||
private String name;
|
||||
|
||||
private int type;
|
||||
|
||||
public void setName(String name){
|
||||
this.name = name;
|
||||
}
|
||||
public String getName(){
|
||||
return this.name;
|
||||
}
|
||||
public void setType(int type){
|
||||
this.type = type;
|
||||
}
|
||||
public int getType(){
|
||||
return this.type;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
package com.cym.utils.cert.ssl;
|
||||
public class IssuerDN
|
||||
{
|
||||
private String commonName;
|
||||
|
||||
private String country;
|
||||
|
||||
private boolean empty;
|
||||
|
||||
private String encoded;
|
||||
|
||||
private String encodedInternal;
|
||||
|
||||
private String name;
|
||||
|
||||
private String organization;
|
||||
|
||||
private String organizationalUnit;
|
||||
|
||||
private String rFC1779Name;
|
||||
|
||||
private String rFC2253CanonicalName;
|
||||
|
||||
private String rFC2253Name;
|
||||
|
||||
private int type;
|
||||
|
||||
public void setCommonName(String commonName){
|
||||
this.commonName = commonName;
|
||||
}
|
||||
public String getCommonName(){
|
||||
return this.commonName;
|
||||
}
|
||||
public void setCountry(String country){
|
||||
this.country = country;
|
||||
}
|
||||
public String getCountry(){
|
||||
return this.country;
|
||||
}
|
||||
public void setEmpty(boolean empty){
|
||||
this.empty = empty;
|
||||
}
|
||||
public boolean getEmpty(){
|
||||
return this.empty;
|
||||
}
|
||||
public void setEncoded(String encoded){
|
||||
this.encoded = encoded;
|
||||
}
|
||||
public String getEncoded(){
|
||||
return this.encoded;
|
||||
}
|
||||
public void setEncodedInternal(String encodedInternal){
|
||||
this.encodedInternal = encodedInternal;
|
||||
}
|
||||
public String getEncodedInternal(){
|
||||
return this.encodedInternal;
|
||||
}
|
||||
public void setName(String name){
|
||||
this.name = name;
|
||||
}
|
||||
public String getName(){
|
||||
return this.name;
|
||||
}
|
||||
public void setOrganization(String organization){
|
||||
this.organization = organization;
|
||||
}
|
||||
public String getOrganization(){
|
||||
return this.organization;
|
||||
}
|
||||
public void setOrganizationalUnit(String organizationalUnit){
|
||||
this.organizationalUnit = organizationalUnit;
|
||||
}
|
||||
public String getOrganizationalUnit(){
|
||||
return this.organizationalUnit;
|
||||
}
|
||||
public void setRFC1779Name(String rFC1779Name){
|
||||
this.rFC1779Name = rFC1779Name;
|
||||
}
|
||||
public String getRFC1779Name(){
|
||||
return this.rFC1779Name;
|
||||
}
|
||||
public void setRFC2253CanonicalName(String rFC2253CanonicalName){
|
||||
this.rFC2253CanonicalName = rFC2253CanonicalName;
|
||||
}
|
||||
public String getRFC2253CanonicalName(){
|
||||
return this.rFC2253CanonicalName;
|
||||
}
|
||||
public void setRFC2253Name(String rFC2253Name){
|
||||
this.rFC2253Name = rFC2253Name;
|
||||
}
|
||||
public String getRFC2253Name(){
|
||||
return this.rFC2253Name;
|
||||
}
|
||||
public void setType(int type){
|
||||
this.type = type;
|
||||
}
|
||||
public int getType(){
|
||||
return this.type;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.cym.utils.cert.ssl;
|
||||
public class Name
|
||||
{
|
||||
private String host;
|
||||
|
||||
private HostObject hostObject;
|
||||
|
||||
private String name;
|
||||
|
||||
private String scheme;
|
||||
|
||||
private int type;
|
||||
|
||||
private String uRI;
|
||||
|
||||
public void setHost(String host){
|
||||
this.host = host;
|
||||
}
|
||||
public String getHost(){
|
||||
return this.host;
|
||||
}
|
||||
public void setHostObject(HostObject hostObject){
|
||||
this.hostObject = hostObject;
|
||||
}
|
||||
public HostObject getHostObject(){
|
||||
return this.hostObject;
|
||||
}
|
||||
public void setName(String name){
|
||||
this.name = name;
|
||||
}
|
||||
public String getName(){
|
||||
return this.name;
|
||||
}
|
||||
public void setScheme(String scheme){
|
||||
this.scheme = scheme;
|
||||
}
|
||||
public String getScheme(){
|
||||
return this.scheme;
|
||||
}
|
||||
public void setType(int type){
|
||||
this.type = type;
|
||||
}
|
||||
public int getType(){
|
||||
return this.type;
|
||||
}
|
||||
public void setURI(String uRI){
|
||||
this.uRI = uRI;
|
||||
}
|
||||
public String getURI(){
|
||||
return this.uRI;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package com.cym.utils.cert.ssl;
|
||||
public class OID
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.cym.utils.cert.ssl;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class PublicKey {
|
||||
private String algorithm;
|
||||
|
||||
private AlgorithmId algorithmId;
|
||||
|
||||
private String encoded;
|
||||
|
||||
private String encodedInternal;
|
||||
|
||||
private String format;
|
||||
|
||||
private String modulus;
|
||||
|
||||
private int publicExponent;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.cym.utils.cert.ssl;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class Root {
|
||||
private AuthKeyId authKeyId;
|
||||
|
||||
private AuthorityInfoAccessExtension authorityInfoAccessExtension;
|
||||
|
||||
private AuthorityKeyIdentifierExtension authorityKeyIdentifierExtension;
|
||||
|
||||
private int basicConstraints;
|
||||
|
||||
private BasicConstraintsExtension basicConstraintsExtension;
|
||||
|
||||
private CRLDistributionPointsExtension cRLDistributionPointsExtension;
|
||||
|
||||
private CertificatePoliciesExtension certificatePoliciesExtension;
|
||||
|
||||
private List<String> criticalExtensionOIDs;
|
||||
|
||||
private List<String> elements;
|
||||
|
||||
private String encoded;
|
||||
|
||||
private String encodedInternal;
|
||||
|
||||
private List<String> extendedKeyUsage;
|
||||
|
||||
private ExtendedKeyUsageExtension extendedKeyUsageExtension;
|
||||
|
||||
private IssuerDN issuerDN;
|
||||
|
||||
private List<Boolean> keyUsage;
|
||||
|
||||
private String name;
|
||||
|
||||
private List<String> nonCriticalExtensionOIDs;
|
||||
|
||||
private Date notAfter;
|
||||
|
||||
private Date notBefore;
|
||||
|
||||
private PublicKey publicKey;
|
||||
|
||||
private double serialNumber;
|
||||
|
||||
private SerialNumberObject serialNumberObject;
|
||||
|
||||
private String sigAlgName;
|
||||
|
||||
private String sigAlgOID;
|
||||
|
||||
private String signature;
|
||||
|
||||
private SubjectAlternativeNameExtension subjectAlternativeNameExtension;
|
||||
|
||||
private List<List<String>> subjectAlternativeNames;
|
||||
|
||||
private SubjectDN subjectDN;
|
||||
|
||||
private SubjectKeyId subjectKeyId;
|
||||
|
||||
private SubjectKeyIdentifierExtension subjectKeyIdentifierExtension;
|
||||
|
||||
private String tBSCertificate;
|
||||
|
||||
private String type;
|
||||
|
||||
private int version;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.cym.utils.cert.ssl;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.Table;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author czh
|
||||
* @data 2020/10/10 9:26
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
@Table(name = "tb_ssl_basic_info")
|
||||
public class SSLBasicInfo {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Integer id;
|
||||
private String domain;
|
||||
|
||||
//序列号
|
||||
private String serialNum;
|
||||
//版本
|
||||
private String version;
|
||||
//加密算法
|
||||
private String encryptionAlgorithm;
|
||||
//签名算法
|
||||
private String signatureAlgorithm;
|
||||
|
||||
//证书类型
|
||||
private String certificateType;
|
||||
//证书品牌
|
||||
private String certificateBrand;
|
||||
//sha256指纹
|
||||
private String sha256Fingerprint;
|
||||
//签发时间
|
||||
private Date issueDate;
|
||||
//到期时间
|
||||
private Date deadlineDate;
|
||||
|
||||
|
||||
|
||||
private String themeAll;
|
||||
|
||||
private String themeCn;
|
||||
private String themeO;
|
||||
private String themeOu;
|
||||
private String themeL;
|
||||
private String themeSt;
|
||||
private String themeC;
|
||||
|
||||
|
||||
private String issueAll;
|
||||
|
||||
private String issueCn;
|
||||
private String issueO;
|
||||
private String issueC;
|
||||
|
||||
private Date createTime;
|
||||
private Date updateTime;
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.cym.utils.cert.ssl;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author czh
|
||||
* @data 2020/8/11 11:44
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
public class SSLDetailsInfo {
|
||||
|
||||
//序列号
|
||||
private String serialNum;
|
||||
//版本
|
||||
private String version;
|
||||
//加密算法
|
||||
private String encryptionAlgorithm;
|
||||
//签名算法
|
||||
private String signatureAlgorithm;
|
||||
|
||||
//证书类型
|
||||
private String certificateType;
|
||||
//证书品牌
|
||||
private String certificateBrand;
|
||||
//sha256指纹
|
||||
private String sha256Fingerprint;
|
||||
//签发时间
|
||||
private Date issueDate;
|
||||
//到期时间
|
||||
private Date deadlineDate;
|
||||
//有效期
|
||||
private String validPeriod;
|
||||
//sans
|
||||
private List<String> sansList;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.cym.utils.cert.ssl;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author czh
|
||||
* @data 2020/8/11 11:44
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
public class SSLInfo {
|
||||
private SSLSubjectInfo sslSubjectInfo;
|
||||
private SSLIssuerInfo sslIssuerInfo;
|
||||
private SSLDetailsInfo sslDetailsInfo;
|
||||
private String subDN;
|
||||
private String issDN;
|
||||
private String webUrl;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.cym.utils.cert.ssl;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author czh
|
||||
* @data 2020/8/11 11:44
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
public class SSLIssuerInfo {
|
||||
private String cn;
|
||||
private String o;
|
||||
private String c;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.cym.utils.cert.ssl;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author czh
|
||||
* @data 2020/8/11 11:44
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
public class SSLSubjectInfo {
|
||||
private String cn;
|
||||
private String o;
|
||||
private String ou;
|
||||
private String l;
|
||||
private String st;
|
||||
private String c;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.cym.utils.cert.ssl;
|
||||
public class SerialNumberObject
|
||||
{
|
||||
private double number;
|
||||
|
||||
public void setNumber(double number){
|
||||
this.number = number;
|
||||
}
|
||||
public double getNumber(){
|
||||
return this.number;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.cym.utils.cert.ssl;
|
||||
import java.util.List;
|
||||
|
||||
public class SubjectAlternativeNameExtension
|
||||
{
|
||||
private boolean critical;
|
||||
|
||||
private List<String> elements;
|
||||
|
||||
private ExtensionId extensionId;
|
||||
|
||||
private String extensionValue;
|
||||
|
||||
private String id;
|
||||
|
||||
private String name;
|
||||
|
||||
private String value;
|
||||
|
||||
public void setCritical(boolean critical){
|
||||
this.critical = critical;
|
||||
}
|
||||
public boolean getCritical(){
|
||||
return this.critical;
|
||||
}
|
||||
public void setElements(List<String> elements){
|
||||
this.elements = elements;
|
||||
}
|
||||
public List<String> getElements(){
|
||||
return this.elements;
|
||||
}
|
||||
public void setExtensionId(ExtensionId extensionId){
|
||||
this.extensionId = extensionId;
|
||||
}
|
||||
public ExtensionId getExtensionId(){
|
||||
return this.extensionId;
|
||||
}
|
||||
public void setExtensionValue(String extensionValue){
|
||||
this.extensionValue = extensionValue;
|
||||
}
|
||||
public String getExtensionValue(){
|
||||
return this.extensionValue;
|
||||
}
|
||||
public void setId(String id){
|
||||
this.id = id;
|
||||
}
|
||||
public String getId(){
|
||||
return this.id;
|
||||
}
|
||||
public void setName(String name){
|
||||
this.name = name;
|
||||
}
|
||||
public String getName(){
|
||||
return this.name;
|
||||
}
|
||||
public void setValue(String value){
|
||||
this.value = value;
|
||||
}
|
||||
public String getValue(){
|
||||
return this.value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
package com.cym.utils.cert.ssl;
|
||||
public class SubjectDN
|
||||
{
|
||||
private String commonName;
|
||||
|
||||
private String country;
|
||||
|
||||
private boolean empty;
|
||||
|
||||
private String encoded;
|
||||
|
||||
private String encodedInternal;
|
||||
|
||||
private String name;
|
||||
|
||||
private String organization;
|
||||
|
||||
private String rFC1779Name;
|
||||
|
||||
private String rFC2253CanonicalName;
|
||||
|
||||
private String rFC2253Name;
|
||||
|
||||
private String state;
|
||||
|
||||
private int type;
|
||||
|
||||
public void setCommonName(String commonName){
|
||||
this.commonName = commonName;
|
||||
}
|
||||
public String getCommonName(){
|
||||
return this.commonName;
|
||||
}
|
||||
public void setCountry(String country){
|
||||
this.country = country;
|
||||
}
|
||||
public String getCountry(){
|
||||
return this.country;
|
||||
}
|
||||
public void setEmpty(boolean empty){
|
||||
this.empty = empty;
|
||||
}
|
||||
public boolean getEmpty(){
|
||||
return this.empty;
|
||||
}
|
||||
public void setEncoded(String encoded){
|
||||
this.encoded = encoded;
|
||||
}
|
||||
public String getEncoded(){
|
||||
return this.encoded;
|
||||
}
|
||||
public void setEncodedInternal(String encodedInternal){
|
||||
this.encodedInternal = encodedInternal;
|
||||
}
|
||||
public String getEncodedInternal(){
|
||||
return this.encodedInternal;
|
||||
}
|
||||
public void setName(String name){
|
||||
this.name = name;
|
||||
}
|
||||
public String getName(){
|
||||
return this.name;
|
||||
}
|
||||
public void setOrganization(String organization){
|
||||
this.organization = organization;
|
||||
}
|
||||
public String getOrganization(){
|
||||
return this.organization;
|
||||
}
|
||||
public void setRFC1779Name(String rFC1779Name){
|
||||
this.rFC1779Name = rFC1779Name;
|
||||
}
|
||||
public String getRFC1779Name(){
|
||||
return this.rFC1779Name;
|
||||
}
|
||||
public void setRFC2253CanonicalName(String rFC2253CanonicalName){
|
||||
this.rFC2253CanonicalName = rFC2253CanonicalName;
|
||||
}
|
||||
public String getRFC2253CanonicalName(){
|
||||
return this.rFC2253CanonicalName;
|
||||
}
|
||||
public void setRFC2253Name(String rFC2253Name){
|
||||
this.rFC2253Name = rFC2253Name;
|
||||
}
|
||||
public String getRFC2253Name(){
|
||||
return this.rFC2253Name;
|
||||
}
|
||||
public void setState(String state){
|
||||
this.state = state;
|
||||
}
|
||||
public String getState(){
|
||||
return this.state;
|
||||
}
|
||||
public void setType(int type){
|
||||
this.type = type;
|
||||
}
|
||||
public int getType(){
|
||||
return this.type;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.cym.utils.cert.ssl;
|
||||
public class SubjectKeyId
|
||||
{
|
||||
private String identifier;
|
||||
|
||||
public void setIdentifier(String identifier){
|
||||
this.identifier = identifier;
|
||||
}
|
||||
public String getIdentifier(){
|
||||
return this.identifier;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.cym.utils.cert.ssl;
|
||||
import java.util.List;
|
||||
|
||||
public class SubjectKeyIdentifierExtension
|
||||
{
|
||||
private boolean critical;
|
||||
|
||||
private List<String> elements;
|
||||
|
||||
private ExtensionId extensionId;
|
||||
|
||||
private String extensionValue;
|
||||
|
||||
private String id;
|
||||
|
||||
private String name;
|
||||
|
||||
private String value;
|
||||
|
||||
public void setCritical(boolean critical){
|
||||
this.critical = critical;
|
||||
}
|
||||
public boolean getCritical(){
|
||||
return this.critical;
|
||||
}
|
||||
public void setElements(List<String> elements){
|
||||
this.elements = elements;
|
||||
}
|
||||
public List<String> getElements(){
|
||||
return this.elements;
|
||||
}
|
||||
public void setExtensionId(ExtensionId extensionId){
|
||||
this.extensionId = extensionId;
|
||||
}
|
||||
public ExtensionId getExtensionId(){
|
||||
return this.extensionId;
|
||||
}
|
||||
public void setExtensionValue(String extensionValue){
|
||||
this.extensionValue = extensionValue;
|
||||
}
|
||||
public String getExtensionValue(){
|
||||
return this.extensionValue;
|
||||
}
|
||||
public void setId(String id){
|
||||
this.id = id;
|
||||
}
|
||||
public String getId(){
|
||||
return this.id;
|
||||
}
|
||||
public void setName(String name){
|
||||
this.name = name;
|
||||
}
|
||||
public String getName(){
|
||||
return this.name;
|
||||
}
|
||||
public void setValue(String value){
|
||||
this.value = value;
|
||||
}
|
||||
public String getValue(){
|
||||
return this.value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.cym.utils.cert.ssl;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author ZhangSan_Plus
|
||||
* @version 1.0
|
||||
* @className XccSSLInfo
|
||||
* @description
|
||||
* @date 2022/8/27 16:17
|
||||
**/
|
||||
@Data
|
||||
public class XccSSLInfo {
|
||||
private String success;
|
||||
private String detectUrl;
|
||||
/**
|
||||
* 信任状态
|
||||
*/
|
||||
private String trustStatus;
|
||||
/**
|
||||
* 通用名称
|
||||
*/
|
||||
private String commonName;
|
||||
/**
|
||||
* 颁发者
|
||||
*/
|
||||
private String issuer;
|
||||
/**
|
||||
* 加密算法
|
||||
*/
|
||||
private String encryptionAlgorithm;
|
||||
/**
|
||||
* 签名算法
|
||||
*/
|
||||
private String signatureAlgorithm;
|
||||
/**
|
||||
* 证书透明(CT)
|
||||
*/
|
||||
private String certificateTransparency;
|
||||
/**
|
||||
* 吊销状态
|
||||
*/
|
||||
private String revocationStatus;
|
||||
|
||||
|
||||
//主题信息
|
||||
private String subjectCN;
|
||||
private String subjectO;
|
||||
private String subjectOU;
|
||||
private String subjectL;
|
||||
private String subjectST;
|
||||
private String subjectC;
|
||||
//签发者信息
|
||||
private String issueCN;
|
||||
private String issueO;
|
||||
private String issueC;
|
||||
private String issueOU;
|
||||
//证书信息
|
||||
private String serialNumber;
|
||||
private String rootCert;
|
||||
private String algorithm;
|
||||
private String certificateType;
|
||||
private String certificateBrand;
|
||||
private String privateKeyLen;
|
||||
private String SHA1Fingerprint;
|
||||
private String SHA256Fingerprint;
|
||||
private String startTime;
|
||||
private String endTime;
|
||||
private String validityPeriod;
|
||||
private String extKeyUsage;
|
||||
private List<List<String>> sans;
|
||||
private String ocspUrl;
|
||||
private String crlUrl;
|
||||
private String caUrl;
|
||||
private String publicKey;
|
||||
private String openSSL;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
spring:
|
||||
datasource:
|
||||
printsql: true
|
||||
url: jdbc:mysql://127.0.0.1:3306/cdnWebUI
|
||||
username: root
|
||||
password: root
|
||||
@@ -0,0 +1,109 @@
|
||||
server:
|
||||
port: 8000
|
||||
sysLogPort: 63701
|
||||
servlet:
|
||||
session:
|
||||
timeout: 7200
|
||||
tomcat:
|
||||
max-http-form-post-size: 100MB
|
||||
compression:
|
||||
enabled: true
|
||||
min-response-size: 2048
|
||||
mim-types: text/html,text/xml,text/plain,text/css,text/javascript,application/json,application/xml
|
||||
error:
|
||||
include-stacktrace: always
|
||||
|
||||
spring:
|
||||
profiles:
|
||||
active: dev
|
||||
application:
|
||||
name: cdnWebUI
|
||||
session:
|
||||
store-type: jdbc
|
||||
jdbc:
|
||||
initialize-schema: always
|
||||
jackson:
|
||||
default-property-inclusion: NON_NULL
|
||||
jmx:
|
||||
enabled: true
|
||||
mvc:
|
||||
pathmatch:
|
||||
matching-strategy: ant_path_matcher
|
||||
static-path-pattern: /**
|
||||
web:
|
||||
resources:
|
||||
static-locations[0]: file:/home/file/
|
||||
static-locations[1]: classpath:/static/
|
||||
jpa:
|
||||
properties:
|
||||
hibernate.globally_quoted_identifiers: true #对jpa sql关键字进行转义
|
||||
hibernate.globally_quoted_identifiers_skip_column_definitions: true #不要对字段类型进行转义
|
||||
hibernate:
|
||||
ddl-auto: update #自动更新数据库表,如不需要自动更新数据库,则取消此参数
|
||||
datasource:
|
||||
hikari:
|
||||
#连接池名
|
||||
pool-name: DateHikariCP
|
||||
#最小空闲连接数
|
||||
minimum-idle: 10
|
||||
# 连接池最大连接数,默认是10
|
||||
maximum-pool-size: 100
|
||||
#使用虚拟线程
|
||||
threads:
|
||||
virtual:
|
||||
enabled: true
|
||||
quartz:
|
||||
#quartz定时任务,采用数据库方式
|
||||
job-store-type: jdbc
|
||||
# 配置文件中的 initialize-schema: always 配置的 always 属性意思是,每次初始化都会重新生成表(执行一次删除,执行一次创建),生成后,可以修改为 never
|
||||
jdbc:
|
||||
initialize-schema: never
|
||||
properties:
|
||||
org:
|
||||
quartz:
|
||||
scheduler:
|
||||
instanceName: cdnServer
|
||||
instanceId: AUTO
|
||||
threadPool: #线程池
|
||||
class: org.quartz.simpl.SimpleThreadPool
|
||||
threadCount: 50
|
||||
|
||||
# springdoc-openapi项目配置
|
||||
springdoc:
|
||||
group-configs:
|
||||
- group: '管理员端'
|
||||
packages-to-scan: com.cym.controller.webapi.admin
|
||||
- group: '用户端'
|
||||
packages-to-scan: com.cym.controller.webapi.user
|
||||
|
||||
knife4j:
|
||||
enable: true
|
||||
|
||||
|
||||
project:
|
||||
clientHome: /home/cdnClient/
|
||||
home: /home/cdnWebUI/
|
||||
|
||||
logging:
|
||||
file:
|
||||
name: ${project.home}log/cdnWebUI.log
|
||||
max-size: 1024MB
|
||||
level:
|
||||
com.binance.connector.client.utils.RequestHandler: OFF
|
||||
|
||||
ali:
|
||||
host: https://my.freecdn.pw/
|
||||
appId: 2017021705714497
|
||||
privateKey: MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCGfBMOwx2blHjBWbEgg/68GAfRFRGgoY8GAn1tOWWNfCYD7zCfBFIZDNc6ptOPEc2q2JH8YB5wgBDU4i/Usi7zkeYIcuhgTF8MK7+6GJkyvFuQk7SNcEhdy0xDD3QgygM752EDp57i3jISkYWEK2swbSjAjrj4FurLbXcCsKhiKVkGGslEPtBRetIMDk+ZnXfC5iMVa0OHIsVfw7xzLBKadA7+5ZPiQ+jpw9CNkXuQOD1cwh57u2Qm0e3q/QFCDnKCeiJ5TIspgbtweK4uxz5vBzvaFnYdup0reA9P2fBhEZkuQjAFAGGJuVl66OzBWEGmA0PvTx71Sl18PtLhF2KJAgMBAAECggEAOD6R9d2Sd2vr6OlrE+9ATUg7lK0cFzMaTughrtmPaFHg0Epr6kVzVHizVxtIZZCLlIVI4OUONfzJjU8fs/PlgQamzyfHmea25a8yW1FIWRi/rsKng3PPQDLzLSS8a64xFg+Z2l5zK+zDwlJMJc/G35T3szi9kTx8bCHW4TAi7BJEa/jNa2CIDKdT43gBmU5r9u8sQ0eLlNk72xvlSVFWIVRjffODhWOz5a2oK8IsJVV+fbBH2v+lY728l8fTT4V2MY2Inj2uzRfylq8aoWB7xjQkibBiLqIhjRODK2aVWiwCCnvq/zidqssOJ6CzcWpIxzDOrgIuj2bh44URs3afVQKBgQDSvBuK5v5Chdgf2S5nGo3tQBDXD+IX8o53HhFuDU2gbse8b95ZYWuFgXPGDx+NLrvlnJd+imaIk2lbUL5abxbJSEVXh+vSnh3U73OGqQ/a9lzJtWsLnl4dzUb47hpn0H5q88LgezcypNLXRrdHmmVBe7zKz4opvBr/QKOHmRgVHwKBgQCjXx89ITStw7iVf7J1iWZfW2E3tlWdYA/uwuPCAaUagizjpJ9MRzmH7F2fbPd5sQTnjpBcPATNDGqT4JSRxyBeDxYEDx92QFO3l7W5XwnSbJI/k/wDFbt7zFGuhZju/Uxo0E+uel6AtW2EzakouT6A3anEkwa3LB0+6+F7aiQrVwKBgH8N7Ok1Vg0Tl3e0QLbnGrT1UHHp4J4hnuWQml+o46mbwQ8Kv5tSEjqfDwdV7Ob5S04nuGsR1Ln5bqcgqnPp0GoxCaW5jGQi8seESzngSm/w44a1u8F4jTQYpPbGz+LRoLapG1Cu2VvOZlRnDW+9VdlCWlRJBvscr4ZAGZhSpGNvAoGAVBFSxeYccX5RsbxwXMNDhrZDJKQTElSoXjizctXd2/I4nzvLLTlJhYQ/+RXdkyVgXLej2ZKY9dr5zPa3/Pv2z+/7aENP8U3QxpyuyqD5MOrlpwnDmOLKAz50mdXtiK2XcCghmKsnjhvOK5SZA3evjiiCf8EYp5Fvyz0eXp+T1SkCgYEAxP6+Ud5WFXsqnWtsJ0MVzL1KLb4pngcYxi04USXtwHnfWlpXwj3QRkwYiAHkh4S4hh+MYq89j2mH7rNjt2VKD6vwM5R6nN7bbg3kbOtXti4J2R6mOtdUY+i4qH9hmMtUmAsRPOv9E2+R866RJ+OJ7elN/F5uzWob2Y5382wW5R4=
|
||||
alipayPublicKey: MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4W97QFrpiRVraGqEx+izzW68YaYnbq3dLYJ4ZlUeZ+5yl0y3jIb5ZNqOoddAkahwht5HT95fvQ7ISDENEpwx79Nt3DtsFeEoJoLtMRKIQAEjE+kK25xBP2e6KDxJE7MCBFWBduVv+DQAjPQU+nqOxZKeVJaiTKdxxKNH/k6WT3D3b8zvF9nIQ/rDWGqwg0Jc0J5ko2+X087m3C0EPqGlXDUC0pLvKbJII8SWPxLuLwxIhSfU/3G6CWVAWj8RZ1++NFrIg1weqlImp8JTXfUy36DPm1CMus4Hm0tew5uiIqAvZz7AYFoOsx7T5rzSZGXgrZ4PRJuo0GTOAZZ93ZpltwIDAQAB
|
||||
|
||||
bian:
|
||||
apiKey: Lh44H4Z5nBHObDkL8wHg4mvN5RDt0vhA076b4WnBNaA5k4TAe6lN23dVB8GVK6Ec
|
||||
secretKey: lyIDhTkJO1tJz9bLO0wI7zyv9HsrQGdU1LAJQQ8t5xyC1Ca9waQRp0Ocy7he2PWX
|
||||
|
||||
telegramToken: 6960437020:AAE-BbpzfyKz5KVKqBkK6tcDymECWF8UGNo
|
||||
|
||||
#proxy:
|
||||
# ips: 27.124.8.250:12302,154.84.17.66:12302,156.234.95.92:12302
|
||||
|
||||
acmeDnsAuth: http://127.0.0.1:7890
|
||||
@@ -0,0 +1,68 @@
|
||||
.red {
|
||||
color: red;
|
||||
}
|
||||
|
||||
.green {
|
||||
color: green;
|
||||
}
|
||||
|
||||
.gray {
|
||||
color: gray;
|
||||
}
|
||||
|
||||
.blue {
|
||||
color: blue;
|
||||
}
|
||||
|
||||
.layui-layout-admin .layui-body {
|
||||
bottom: 0px;
|
||||
}
|
||||
|
||||
.root {
|
||||
height: 38px;
|
||||
width: 50px;
|
||||
}
|
||||
|
||||
.layui-icon-export {
|
||||
font-size: 30px;
|
||||
color: gray;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.layui-icon-set-fill {
|
||||
font-size: 30px;
|
||||
color: gray;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
textarea {
|
||||
resize: none !important;
|
||||
}
|
||||
|
||||
::-webkit-input-placeholder {
|
||||
color: #bbbbbb;
|
||||
}
|
||||
|
||||
:-moz-placeholder {
|
||||
color: #bbbbbb;
|
||||
}
|
||||
|
||||
.ellipsis {
|
||||
width: 300px;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
-o-text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.center {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.select_menu{
|
||||
font-weight: bolder;
|
||||
}
|
||||
|
||||
.layui-input-wrap .layui-input-suffix.layui-input-split {
|
||||
display: none;
|
||||
}
|
||||
|
After Width: | Height: | Size: 15 KiB |
@@ -0,0 +1,333 @@
|
||||
var layer;
|
||||
var element;
|
||||
var form;
|
||||
var laypage;
|
||||
var laydate;
|
||||
var xmSelect;
|
||||
|
||||
// 使用layui内部jQuery
|
||||
var $ = layui.$;
|
||||
var jQuery = layui.$;
|
||||
|
||||
$(function() {
|
||||
|
||||
// layer变量
|
||||
layer = layui.layer;
|
||||
element = layui.element;
|
||||
form = layui.form;
|
||||
laypage = layui.laypage;
|
||||
|
||||
// 执行一个laypage实例
|
||||
laypage.render({
|
||||
elem: 'pageInfo', // 渲染节点
|
||||
count: page.total, // 总记录数
|
||||
curr: page.pageNum, // 起始页
|
||||
limit: page.pageSize, // 每页记录数
|
||||
limits: [10, 20, 50, 100, 200], // 显示分页数
|
||||
layout: ['count', 'prev', 'page', 'next', 'skip', 'limit'],
|
||||
jump: function(obj, first) {
|
||||
// 首次不执行
|
||||
if (!first) {
|
||||
// do something
|
||||
$("input[name='pageNum']").val(obj.curr);
|
||||
$("input[name='pageSize']").val(obj.limit);
|
||||
$("#searchForm").submit();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// 多选组件
|
||||
layui.config({
|
||||
base: ctx + 'lib/layui/exts/xmSelect/'
|
||||
}).extend({
|
||||
xmSelect: 'xm-select'
|
||||
}).use(['xmSelect'], function() {
|
||||
xmSelect = layui.xmSelect;
|
||||
|
||||
if (typeof initXmSelect != "undefined") {
|
||||
initXmSelect();
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
// 日期控件
|
||||
layui.use('laydate', function() {
|
||||
laydate = layui.laydate;
|
||||
|
||||
// 执行laydate实例
|
||||
$(".laydate").each(function() {
|
||||
$(this).attr("id", "date_" + guid());
|
||||
$(this).attr("readonly", true);
|
||||
|
||||
laydate.render({
|
||||
elem: "#" + $(this).attr("id"), // 指定元素
|
||||
type: 'date',
|
||||
trigger: 'click',
|
||||
format: 'yyyy-MM-dd' // 可任意组合
|
||||
});
|
||||
})
|
||||
|
||||
$(".laytime").each(function() {
|
||||
$(this).attr("id", "time_" + guid());
|
||||
$(this).attr("readonly", true);
|
||||
|
||||
laydate.render({
|
||||
elem: "#" + $(this).attr("id"), // 指定元素
|
||||
type: 'datetime',
|
||||
trigger: 'click',
|
||||
format: 'yyyy-MM-dd HH:mm:ss' // 可任意组合
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
// 设置input[type='number']为正整数
|
||||
$("input[type='number']").attr("lay-affix", "number");
|
||||
$("input[type='number']").attr("lay-precision", 0); // 取整
|
||||
$("input[type='number']").attr("min", 0);
|
||||
$("input[type='number']").attr("max", 1000000);
|
||||
$("input[type='number']").attr("step", 1); // 步进为1
|
||||
|
||||
$("input.money").attr("lay-precision", 2); //小数进度为2
|
||||
$("input.money").attr("step", 0.01); // 步进为0.01
|
||||
|
||||
form.render();
|
||||
|
||||
// 关闭input自动填充
|
||||
$("input").attr("autocomplete", "off");
|
||||
|
||||
// 菜单选中
|
||||
var url = location.pathname.replace(/\//g, "/") + "?";
|
||||
$("a[href*='" + url + "']:first").parent().addClass("layui-this");
|
||||
|
||||
// 只显示当前大类菜单
|
||||
$("a[href*='" + url + "']").parent().parent().parent().addClass("layui-nav-itemed");
|
||||
|
||||
// 翻译按钮隐藏
|
||||
$("#translate").hide();
|
||||
})
|
||||
|
||||
// 关闭AJAX相应的缓存
|
||||
$.ajaxSetup({
|
||||
cache: false
|
||||
});
|
||||
|
||||
|
||||
// 退出登录
|
||||
function loginOut() {
|
||||
if (confirm("是否退出登录?")) {
|
||||
location.href = ctx + "loginOut";
|
||||
}
|
||||
}
|
||||
|
||||
// 日期格式化
|
||||
Date.prototype.format = function(format) {
|
||||
var date = {
|
||||
"M+": this.getMonth() + 1,
|
||||
"d+": this.getDate(),
|
||||
"H+": this.getHours(),
|
||||
"m+": this.getMinutes(),
|
||||
"s+": this.getSeconds(),
|
||||
"q+": Math.floor((this.getMonth() + 3) / 3),
|
||||
"S+": this.getMilliseconds()
|
||||
};
|
||||
if (/(y+)/i.test(format)) {
|
||||
format = format.replace(RegExp.$1, (this.getFullYear() + '')
|
||||
.substr(4 - RegExp.$1.length));
|
||||
}
|
||||
for (var k in date) {
|
||||
if (new RegExp("(" + k + ")").test(format)) {
|
||||
format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? date[k]
|
||||
: ("00" + date[k]).substr(("" + date[k]).length));
|
||||
}
|
||||
}
|
||||
return format;
|
||||
}
|
||||
|
||||
function formatDate(now) {
|
||||
if (now == null || now == '') {
|
||||
return "";
|
||||
}
|
||||
|
||||
return new Date(now).format("yyyy-MM-dd HH:mm:ss");
|
||||
}
|
||||
|
||||
// 查看图片
|
||||
function seePic(url) {
|
||||
window.open(url);
|
||||
}
|
||||
|
||||
// 生成uuid
|
||||
function S4() {
|
||||
return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
|
||||
}
|
||||
function guid() {
|
||||
return (S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4()
|
||||
+ S4() + S4());
|
||||
}
|
||||
|
||||
// 时间字符串转时间戳
|
||||
function strToTime(str) {
|
||||
var str = str.replace(/-/g, '/');
|
||||
var timestamp = new Date(str).getTime();
|
||||
|
||||
return timestamp
|
||||
}
|
||||
|
||||
// 获取url参数
|
||||
function getQueryString(name) {
|
||||
/*
|
||||
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
|
||||
var r = window.location.search.substr(1).match(reg);
|
||||
if (r != null)
|
||||
return unescape(r[2]);
|
||||
return null;
|
||||
*/
|
||||
const paramsStr = window.location.search;
|
||||
const params = new URLSearchParams(paramsStr);
|
||||
return params.get(name); // list
|
||||
}
|
||||
|
||||
// 下载文件
|
||||
function downloadFile(url, name) {
|
||||
window.open(ctx + "downloadFile?url=" + encodeURIComponent(url) + "&name="
|
||||
+ encodeURIComponent(name));
|
||||
}
|
||||
|
||||
// form转json
|
||||
function form2JsonString(formId) {
|
||||
var paramArray = $('#' + formId).serializeArray();
|
||||
/* 请求参数转json对象 */
|
||||
var jsonObj = {};
|
||||
$(paramArray).each(function() {
|
||||
jsonObj[this.name] = this.value;
|
||||
});
|
||||
return JSON.stringify(jsonObj);
|
||||
|
||||
}
|
||||
|
||||
function changeLang() {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: ctx + 'main/changeLang',
|
||||
data: $("#adminForm").serialize(),
|
||||
dataType: 'json',
|
||||
success: function(data) {
|
||||
if (data.success) {
|
||||
location.reload();
|
||||
} else {
|
||||
layer.msg(data.msg);
|
||||
}
|
||||
},
|
||||
error: function() {
|
||||
layer.alert("请求失败,请刷新重试");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function setParamOrder(id, seq) {
|
||||
if (seq == -1) {
|
||||
// 前移
|
||||
var prev = $("#" + id).prev();
|
||||
$("#" + id).after(prev);
|
||||
} else {
|
||||
// 后移
|
||||
var next = $("#" + id).next();
|
||||
$("#" + id).before(next);
|
||||
}
|
||||
}
|
||||
|
||||
// 显示载入框
|
||||
var loadIndex;
|
||||
function showLoad() {
|
||||
loadIndex = layer.load();
|
||||
}
|
||||
function closeLoad() {
|
||||
layer.close(loadIndex);
|
||||
}
|
||||
|
||||
|
||||
function userCenter() {
|
||||
location.href = ctx + "userPage/userCenter";
|
||||
}
|
||||
|
||||
function adminCenter(group) {
|
||||
location.href = ctx + "adminPage/adminCenter?group=" + group;
|
||||
}
|
||||
|
||||
|
||||
function showTgBind() {
|
||||
layer.alert("在任意聊天窗口发送“@freecdnBot”然后点击这条消息即可打开与freecdnBot的聊天,发送任意消息给freecdnBot它会返回你的信息,其中包含一个ID,这就是我们需要的chat_id");
|
||||
}
|
||||
|
||||
function goUser(id) {
|
||||
if (location.href.indexOf("adminPage") > -1) {
|
||||
location.href = ctx + "adminPage/user?pageSize=20&id=" + id;
|
||||
}
|
||||
}
|
||||
|
||||
function goOrder(id) {
|
||||
if (location.href.indexOf("adminPage") > -1) {
|
||||
location.href = ctx + "adminPage/orderAdmin?pageSize=20&id=" + id;
|
||||
} else {
|
||||
location.href = ctx + "userPage/order?pageSize=20&id=" + id;
|
||||
}
|
||||
}
|
||||
|
||||
function goMachineOrder(id) {
|
||||
if (location.href.indexOf("adminPage") > -1) {
|
||||
location.href = ctx + "adminPage/machineOrderAdmin?pageSize=20&id=" + id;
|
||||
} else {
|
||||
location.href = ctx + "userPage/machineOrder?pageSize=20&id=" + id;
|
||||
}
|
||||
}
|
||||
|
||||
function goMachine(id) {
|
||||
if (location.href.indexOf("adminPage") > -1) {
|
||||
location.href = ctx + "adminPage/machine?pageSize=20&id=" + id;
|
||||
}
|
||||
}
|
||||
function goMachineVps(id) {
|
||||
if (location.href.indexOf("adminPage") > -1) {
|
||||
location.href = ctx + "adminPage/machineVps?pageSize=20&id=" + id;
|
||||
}
|
||||
}
|
||||
|
||||
function goDomain(id) {
|
||||
if (location.href.indexOf("adminPage") > -1) {
|
||||
location.href = ctx + "adminPage/domainAdmin?pageSize=20&id=" + id;
|
||||
} else {
|
||||
location.href = ctx + "userPage/domain?pageSize=20&id=" + id;
|
||||
}
|
||||
}
|
||||
|
||||
function goDomainOrder(orderId) {
|
||||
if (location.href.indexOf("adminPage") > -1) {
|
||||
location.href = ctx + "adminPage/domainAdmin?pageSize=20&orderId=" + orderId;
|
||||
} else {
|
||||
location.href = ctx + "userPage/domain?pageSize=20&orderId=" + orderId;
|
||||
}
|
||||
}
|
||||
|
||||
function goUpstreamOrder(orderId) {
|
||||
if (location.href.indexOf("adminPage") > -1) {
|
||||
location.href = ctx + "adminPage/upstreamAdmin?pageSize=20&orderId=" + orderId;
|
||||
} else {
|
||||
location.href = ctx + "userPage/upstream?pageSize=20&orderId=" + orderId;
|
||||
}
|
||||
}
|
||||
|
||||
function goCertOrder(orderId) {
|
||||
if (location.href.indexOf("adminPage") > -1) {
|
||||
location.href = ctx + "adminPage/certAdmin?pageSize=20&orderId=" + orderId;
|
||||
} else {
|
||||
location.href = ctx + "userPage/cert?pageSize=20&orderId=" + orderId;
|
||||
}
|
||||
}
|
||||
|
||||
function goProduct(id) {
|
||||
if (location.href.indexOf("adminPage") > -1) {
|
||||
location.href = ctx + "adminPage/product?pageSize=20&id=" + id;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
var menuUrl;
|
||||
|
||||
$(function() {
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
function search() {
|
||||
$("input[name='pageNum']").val(1);
|
||||
$("#searchForm").submit();
|
||||
}
|
||||
|
||||
function add() {
|
||||
$("#id").val("");
|
||||
$("#name").val("");
|
||||
$("#descr").val("");
|
||||
$("#adminId option:first").prop("selected", true);
|
||||
|
||||
form.render();
|
||||
showWindow("添加");
|
||||
}
|
||||
|
||||
|
||||
function showWindow(title) {
|
||||
layer.open({
|
||||
type: 1,
|
||||
title: title,
|
||||
area: ['400px', '400px'], // 宽高
|
||||
content: $('#windowDiv')
|
||||
});
|
||||
}
|
||||
|
||||
function addOver() {
|
||||
if ($("#name").val().trim() == '') {
|
||||
layer.msg("未填写名称");
|
||||
return;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: ctx + 'adminPage/example/addOver',
|
||||
data: $('#addForm').serialize(),
|
||||
dataType: 'json',
|
||||
success: function(data) {
|
||||
if (data.success) {
|
||||
location.reload();
|
||||
} else {
|
||||
layer.msg(data.msg);
|
||||
}
|
||||
},
|
||||
error: function() {
|
||||
layer.alert("请求失败,请刷新重试");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function edit(id) {
|
||||
$("#id").val(id);
|
||||
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: ctx + 'adminPage/example/detail',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
id: id
|
||||
},
|
||||
success: function(data) {
|
||||
if (data.success) {
|
||||
var example = data.obj;
|
||||
$("#id").val(example.id);
|
||||
$("#name").val(example.name);
|
||||
$("#descr").val(example.descr);
|
||||
$("#adminId").val(example.adminId);
|
||||
|
||||
form.render();
|
||||
showWindow("编辑");
|
||||
} else {
|
||||
layer.msg(data.msg);
|
||||
}
|
||||
},
|
||||
error: function() {
|
||||
layer.alert("请求失败,请刷新重试");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function del(id) {
|
||||
if (confirm("确认删除?")) {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: ctx + 'adminPage/example/del',
|
||||
data: {
|
||||
id: id
|
||||
},
|
||||
dataType: 'json',
|
||||
success: function(data) {
|
||||
if (data.success) {
|
||||
location.reload();
|
||||
} else {
|
||||
layer.msg(data.msg)
|
||||
}
|
||||
},
|
||||
error: function() {
|
||||
layer.alert("请求失败,请刷新重试");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,303 @@
|
||||
|
||||
//
|
||||
// THIS FILE IS AUTOMATICALLY GENERATED! DO NOT EDIT BY HAND!
|
||||
//
|
||||
;(function(global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined'
|
||||
? module.exports = factory()
|
||||
: typeof define === 'function' && define.amd
|
||||
? define(factory) :
|
||||
// cf. https://github.com/dankogai/js-base64/issues/119
|
||||
(function() {
|
||||
// existing version for noConflict()
|
||||
const _Base64 = global.Base64;
|
||||
const gBase64 = factory();
|
||||
gBase64.noConflict = () => {
|
||||
global.Base64 = _Base64;
|
||||
return gBase64;
|
||||
};
|
||||
if (global.Meteor) { // Meteor.js
|
||||
Base64 = gBase64;
|
||||
}
|
||||
global.Base64 = gBase64;
|
||||
})();
|
||||
}((typeof self !== 'undefined' ? self
|
||||
: typeof window !== 'undefined' ? window
|
||||
: typeof global !== 'undefined' ? global
|
||||
: this
|
||||
), function() {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* base64.ts
|
||||
*
|
||||
* Licensed under the BSD 3-Clause License.
|
||||
* http://opensource.org/licenses/BSD-3-Clause
|
||||
*
|
||||
* References:
|
||||
* http://en.wikipedia.org/wiki/Base64
|
||||
*
|
||||
* @author Dan Kogai (https://github.com/dankogai)
|
||||
*/
|
||||
const version = '3.5.2';
|
||||
/**
|
||||
* @deprecated use lowercase `version`.
|
||||
*/
|
||||
const VERSION = version;
|
||||
const _hasatob = typeof atob === 'function';
|
||||
const _hasbtoa = typeof btoa === 'function';
|
||||
const _hasBuffer = typeof Buffer === 'function';
|
||||
const _TD = typeof TextDecoder === 'function' ? new TextDecoder() : undefined;
|
||||
const _TE = typeof TextEncoder === 'function' ? new TextEncoder() : undefined;
|
||||
const b64ch = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
||||
const b64chs = [...b64ch];
|
||||
const b64tab = ((a) => {
|
||||
let tab = {};
|
||||
a.forEach((c, i) => tab[c] = i);
|
||||
return tab;
|
||||
})(b64chs);
|
||||
const b64re = /^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/;
|
||||
const _fromCC = String.fromCharCode.bind(String);
|
||||
const _U8Afrom = typeof Uint8Array.from === 'function'
|
||||
? Uint8Array.from.bind(Uint8Array)
|
||||
: (it, fn = (x) => x) => new Uint8Array(Array.prototype.slice.call(it, 0).map(fn));
|
||||
const _mkUriSafe = (src) => src
|
||||
.replace(/[+\/]/g, (m0) => m0 == '+' ? '-' : '_')
|
||||
.replace(/=+$/m, '');
|
||||
const _tidyB64 = (s) => s.replace(/[^A-Za-z0-9\+\/]/g, '');
|
||||
/**
|
||||
* polyfill version of `btoa`
|
||||
*/
|
||||
const btoaPolyfill = (bin) => {
|
||||
// console.log('polyfilled');
|
||||
let u32, c0, c1, c2, asc = '';
|
||||
const pad = bin.length % 3;
|
||||
for (let i = 0; i < bin.length;) {
|
||||
if ((c0 = bin.charCodeAt(i++)) > 255 ||
|
||||
(c1 = bin.charCodeAt(i++)) > 255 ||
|
||||
(c2 = bin.charCodeAt(i++)) > 255)
|
||||
throw new TypeError('invalid character found');
|
||||
u32 = (c0 << 16) | (c1 << 8) | c2;
|
||||
asc += b64chs[u32 >> 18 & 63]
|
||||
+ b64chs[u32 >> 12 & 63]
|
||||
+ b64chs[u32 >> 6 & 63]
|
||||
+ b64chs[u32 & 63];
|
||||
}
|
||||
return pad ? asc.slice(0, pad - 3) + "===".substring(pad) : asc;
|
||||
};
|
||||
/**
|
||||
* does what `window.btoa` of web browsers do.
|
||||
* @param {String} bin binary string
|
||||
* @returns {string} Base64-encoded string
|
||||
*/
|
||||
const _btoa = _hasbtoa ? (bin) => btoa(bin)
|
||||
: _hasBuffer ? (bin) => Buffer.from(bin, 'binary').toString('base64')
|
||||
: btoaPolyfill;
|
||||
const _fromUint8Array = _hasBuffer
|
||||
? (u8a) => Buffer.from(u8a).toString('base64')
|
||||
: (u8a) => {
|
||||
// cf. https://stackoverflow.com/questions/12710001/how-to-convert-uint8-array-to-base64-encoded-string/12713326#12713326
|
||||
const maxargs = 0x1000;
|
||||
let strs = [];
|
||||
for (let i = 0, l = u8a.length; i < l; i += maxargs) {
|
||||
strs.push(_fromCC.apply(null, u8a.subarray(i, i + maxargs)));
|
||||
}
|
||||
return _btoa(strs.join(''));
|
||||
};
|
||||
/**
|
||||
* converts a Uint8Array to a Base64 string.
|
||||
* @param {boolean} [urlsafe] URL-and-filename-safe a la RFC4648 §5
|
||||
* @returns {string} Base64 string
|
||||
*/
|
||||
const fromUint8Array = (u8a, urlsafe = false) => urlsafe ? _mkUriSafe(_fromUint8Array(u8a)) : _fromUint8Array(u8a);
|
||||
// This trick is found broken https://github.com/dankogai/js-base64/issues/130
|
||||
// const utob = (src: string) => unescape(encodeURIComponent(src));
|
||||
// reverting good old fationed regexp
|
||||
const cb_utob = (c) => {
|
||||
if (c.length < 2) {
|
||||
var cc = c.charCodeAt(0);
|
||||
return cc < 0x80 ? c
|
||||
: cc < 0x800 ? (_fromCC(0xc0 | (cc >>> 6))
|
||||
+ _fromCC(0x80 | (cc & 0x3f)))
|
||||
: (_fromCC(0xe0 | ((cc >>> 12) & 0x0f))
|
||||
+ _fromCC(0x80 | ((cc >>> 6) & 0x3f))
|
||||
+ _fromCC(0x80 | (cc & 0x3f)));
|
||||
}
|
||||
else {
|
||||
var cc = 0x10000
|
||||
+ (c.charCodeAt(0) - 0xD800) * 0x400
|
||||
+ (c.charCodeAt(1) - 0xDC00);
|
||||
return (_fromCC(0xf0 | ((cc >>> 18) & 0x07))
|
||||
+ _fromCC(0x80 | ((cc >>> 12) & 0x3f))
|
||||
+ _fromCC(0x80 | ((cc >>> 6) & 0x3f))
|
||||
+ _fromCC(0x80 | (cc & 0x3f)));
|
||||
}
|
||||
};
|
||||
const re_utob = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g;
|
||||
/**
|
||||
* @deprecated should have been internal use only.
|
||||
* @param {string} src UTF-8 string
|
||||
* @returns {string} UTF-16 string
|
||||
*/
|
||||
const utob = (u) => u.replace(re_utob, cb_utob);
|
||||
//
|
||||
const _encode = _hasBuffer
|
||||
? (s) => Buffer.from(s, 'utf8').toString('base64')
|
||||
: _TE
|
||||
? (s) => _fromUint8Array(_TE.encode(s))
|
||||
: (s) => _btoa(utob(s));
|
||||
/**
|
||||
* converts a UTF-8-encoded string to a Base64 string.
|
||||
* @param {boolean} [urlsafe] if `true` make the result URL-safe
|
||||
* @returns {string} Base64 string
|
||||
*/
|
||||
const encode = (src, urlsafe = false) => urlsafe
|
||||
? _mkUriSafe(_encode(src))
|
||||
: _encode(src);
|
||||
/**
|
||||
* converts a UTF-8-encoded string to URL-safe Base64 RFC4648 §5.
|
||||
* @returns {string} Base64 string
|
||||
*/
|
||||
const encodeURI = (src) => encode(src, true);
|
||||
// This trick is found broken https://github.com/dankogai/js-base64/issues/130
|
||||
// const btou = (src: string) => decodeURIComponent(escape(src));
|
||||
// reverting good old fationed regexp
|
||||
const re_btou = /[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g;
|
||||
const cb_btou = (cccc) => {
|
||||
switch (cccc.length) {
|
||||
case 4:
|
||||
var cp = ((0x07 & cccc.charCodeAt(0)) << 18)
|
||||
| ((0x3f & cccc.charCodeAt(1)) << 12)
|
||||
| ((0x3f & cccc.charCodeAt(2)) << 6)
|
||||
| (0x3f & cccc.charCodeAt(3)), offset = cp - 0x10000;
|
||||
return (_fromCC((offset >>> 10) + 0xD800)
|
||||
+ _fromCC((offset & 0x3FF) + 0xDC00));
|
||||
case 3:
|
||||
return _fromCC(((0x0f & cccc.charCodeAt(0)) << 12)
|
||||
| ((0x3f & cccc.charCodeAt(1)) << 6)
|
||||
| (0x3f & cccc.charCodeAt(2)));
|
||||
default:
|
||||
return _fromCC(((0x1f & cccc.charCodeAt(0)) << 6)
|
||||
| (0x3f & cccc.charCodeAt(1)));
|
||||
}
|
||||
};
|
||||
/**
|
||||
* @deprecated should have been internal use only.
|
||||
* @param {string} src UTF-16 string
|
||||
* @returns {string} UTF-8 string
|
||||
*/
|
||||
const btou = (b) => b.replace(re_btou, cb_btou);
|
||||
/**
|
||||
* polyfill version of `atob`
|
||||
*/
|
||||
const atobPolyfill = (asc) => {
|
||||
// console.log('polyfilled');
|
||||
asc = asc.replace(/\s+/g, '');
|
||||
if (!b64re.test(asc))
|
||||
throw new TypeError('malformed base64.');
|
||||
asc += '=='.slice(2 - (asc.length & 3));
|
||||
let u24, bin = '', r1, r2;
|
||||
for (let i = 0; i < asc.length;) {
|
||||
u24 = b64tab[asc.charAt(i++)] << 18
|
||||
| b64tab[asc.charAt(i++)] << 12
|
||||
| (r1 = b64tab[asc.charAt(i++)]) << 6
|
||||
| (r2 = b64tab[asc.charAt(i++)]);
|
||||
bin += r1 === 64 ? _fromCC(u24 >> 16 & 255)
|
||||
: r2 === 64 ? _fromCC(u24 >> 16 & 255, u24 >> 8 & 255)
|
||||
: _fromCC(u24 >> 16 & 255, u24 >> 8 & 255, u24 & 255);
|
||||
}
|
||||
return bin;
|
||||
};
|
||||
/**
|
||||
* does what `window.atob` of web browsers do.
|
||||
* @param {String} asc Base64-encoded string
|
||||
* @returns {string} binary string
|
||||
*/
|
||||
const _atob = _hasatob ? (asc) => atob(_tidyB64(asc))
|
||||
: _hasBuffer ? (asc) => Buffer.from(asc, 'base64').toString('binary')
|
||||
: atobPolyfill;
|
||||
//
|
||||
const _toUint8Array = _hasBuffer
|
||||
? (a) => _U8Afrom(Buffer.from(a, 'base64'))
|
||||
: (a) => _U8Afrom(_atob(a), c => c.charCodeAt(0));
|
||||
/**
|
||||
* converts a Base64 string to a Uint8Array.
|
||||
*/
|
||||
const toUint8Array = (a) => _toUint8Array(_unURI(a));
|
||||
//
|
||||
const _decode = _hasBuffer
|
||||
? (a) => Buffer.from(a, 'base64').toString('utf8')
|
||||
: _TD
|
||||
? (a) => _TD.decode(_toUint8Array(a))
|
||||
: (a) => btou(_atob(a));
|
||||
const _unURI = (a) => _tidyB64(a.replace(/[-_]/g, (m0) => m0 == '-' ? '+' : '/'));
|
||||
/**
|
||||
* converts a Base64 string to a UTF-8 string.
|
||||
* @param {String} src Base64 string. Both normal and URL-safe are supported
|
||||
* @returns {string} UTF-8 string
|
||||
*/
|
||||
const decode = (src) => _decode(_unURI(src));
|
||||
//
|
||||
const _noEnum = (v) => {
|
||||
return {
|
||||
value: v, enumerable: false, writable: true, configurable: true
|
||||
};
|
||||
};
|
||||
/**
|
||||
* extend String.prototype with relevant methods
|
||||
*/
|
||||
const extendString = function () {
|
||||
const _add = (name, body) => Object.defineProperty(String.prototype, name, _noEnum(body));
|
||||
_add('fromBase64', function () { return decode(this); });
|
||||
_add('toBase64', function (urlsafe) { return encode(this, urlsafe); });
|
||||
_add('toBase64URI', function () { return encode(this, true); });
|
||||
_add('toBase64URL', function () { return encode(this, true); });
|
||||
_add('toUint8Array', function () { return toUint8Array(this); });
|
||||
};
|
||||
/**
|
||||
* extend Uint8Array.prototype with relevant methods
|
||||
*/
|
||||
const extendUint8Array = function () {
|
||||
const _add = (name, body) => Object.defineProperty(Uint8Array.prototype, name, _noEnum(body));
|
||||
_add('toBase64', function (urlsafe) { return fromUint8Array(this, urlsafe); });
|
||||
_add('toBase64URI', function () { return fromUint8Array(this, true); });
|
||||
_add('toBase64URL', function () { return fromUint8Array(this, true); });
|
||||
};
|
||||
/**
|
||||
* extend Builtin prototypes with relevant methods
|
||||
*/
|
||||
const extendBuiltins = () => {
|
||||
extendString();
|
||||
extendUint8Array();
|
||||
};
|
||||
const gBase64 = {
|
||||
version: version,
|
||||
VERSION: VERSION,
|
||||
atob: _atob,
|
||||
atobPolyfill: atobPolyfill,
|
||||
btoa: _btoa,
|
||||
btoaPolyfill: btoaPolyfill,
|
||||
fromBase64: decode,
|
||||
toBase64: encode,
|
||||
encode: encode,
|
||||
encodeURI: encodeURI,
|
||||
encodeURL: encodeURI,
|
||||
utob: utob,
|
||||
btou: btou,
|
||||
decode: decode,
|
||||
fromUint8Array: fromUint8Array,
|
||||
toUint8Array: toUint8Array,
|
||||
extendString: extendString,
|
||||
extendUint8Array: extendUint8Array,
|
||||
extendBuiltins: extendBuiltins,
|
||||
};
|
||||
|
||||
//
|
||||
// export Base64 to the namespace
|
||||
//
|
||||
// ES5 is yet to have Object.assign() that may make transpilers unhappy.
|
||||
// gBase64.Base64 = Object.assign({}, gBase64);
|
||||
gBase64.Base64 = {};
|
||||
Object.keys(gBase64).forEach(k => gBase64.Base64[k] = gBase64[k]);
|
||||
return gBase64;
|
||||
}));
|
||||
@@ -0,0 +1,7 @@
|
||||
<!DOCTYPE html><html><head><script>var _hmt = _hmt || [];
|
||||
(function() {
|
||||
var hm = document.createElement("script");
|
||||
hm.src = "https://hm.baidu.com/hm.js?758a90d7d534804ddd66137da7c9ee69";
|
||||
var s = document.getElementsByTagName("script")[0];
|
||||
s.parentNode.insertBefore(hm, s);
|
||||
})();</script><link rel="preload" href="./xm-select.js" as="script"><link rel="preload" href="./static/docs.js" as="script"><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"><title>xm-select</title><link rel="stylesheet" href="https://www.layuicdn.com/layui-v2.5.5/css/layui.css"><script src="https://www.layuicdn.com/layui-v2.5.5/layui.all.js"></script><script src="https://unpkg.com/axios/dist/axios.min.js"></script></head><body><div id="app"></div><script type="text/javascript" src="./xm-select.js"></script><script type="text/javascript" src="./static/docs.js"></script></body></html>
|
||||
|
After Width: | Height: | Size: 101 KiB |
|
After Width: | Height: | Size: 322 KiB |
@@ -0,0 +1,132 @@
|
||||
@charset "utf-8";
|
||||
/* 以下实际使用若已初始化可删除 .lsm-sidebar height父级需逐级设置为100%*/
|
||||
body,html{height: 100%;background: #E2E2E2}
|
||||
body,ul{margin:0;padding:0}
|
||||
body{font:14px "微软雅黑","宋体","Arial Narrow",HELVETICA;-webkit-text-size-adjust:100%;}
|
||||
li{list-style:none}
|
||||
a{text-decoration:none;}
|
||||
/* 以上实际使用若已初始化可删除 */
|
||||
|
||||
/* lsm-sidebar */
|
||||
.left-side-menu,.lsm-popup.lsm-sidebar ul li, .lsm-container.lsm-mini .lsm-sidebar>ul>li.lsm-sidebar-item>ul>li.lsm-sidebar-item>ul{
|
||||
background: #3b3e47;
|
||||
}
|
||||
|
||||
|
||||
.left-side-menu {-webkit-touch-callout: none;-webkit-user-select: none;-khtml-user-select: none;-moz-user-select: none;-ms-user-select: none; user-select: none; }
|
||||
.left-side-menu{height: calc(100% - 80px);width: 220px;}
|
||||
.lsm-expand-btn{height: 65px;}
|
||||
.lsm-container {height: calc(100% - 65px); transition: all .3s;z-index: 100}
|
||||
|
||||
.lsm-container li>a.active{ background: #c55b03; color: #fff; }
|
||||
|
||||
|
||||
.lsm-sidebar a{display: block;overflow: hidden;padding-left: 20px;line-height: 40px;max-height: 40px;color: #b2b8be;transition: all .3s;}
|
||||
.lsm-container ul:first-child > li> a, .lsm-container ul:first-child > li> a span{ line-height: 55px;max-height: 55px; }
|
||||
.lsm-sidebar a span{margin-left: 30px;}
|
||||
.lsm-sidebar .lsm-sidebar-item .lsm-sidebar-item >ul>li a span{margin-left: 60px;}
|
||||
.lsm-sidebar-item{position: relative;}
|
||||
.lsm-sidebar-item.lsm-sidebar-show{border-bottom: none;}
|
||||
.lsm-sidebar-item ul{display: none;background: rgba(0,0,0,.1);}
|
||||
.lsm-sidebar-item.lsm-sidebar-show ul{display: block;}
|
||||
.lsm-sidebar-item>a:before{content: "";position: absolute;left: 0px;width: 2px;height: 40px;background: #34A0CE;opacity:0;transition: all .3s;}
|
||||
.lsm-container ul:first-child>li.lsm-sidebar-item>a:before{height: 55px;}
|
||||
.lsm-sidebar .lsm-sidebar-icon{font-size: 20px;position: absolute;margin-left:-1px;}
|
||||
/* 此处修改导航图标 可自定义iconfont 替换*/
|
||||
.icon_1::after{content: "\e62b";}
|
||||
.icon_2::after{content: "\e669";}
|
||||
.icon_3::after{content: "\e61d";}
|
||||
.icon_3::after{content: "\e698";}
|
||||
|
||||
.lsm-sidebar-more{float:right;margin-right: 20px;font-size: 12px;transition: transform .3s;}
|
||||
|
||||
/* 导航右侧箭头 换用其他字体需要替换*/
|
||||
.lsm-sidebar-more::after{content: "\e621";}
|
||||
|
||||
|
||||
.lsm-sidebar-show > a > i.my-icon.lsm-sidebar-more{transform:rotate(90deg);}
|
||||
.lsm-sidebar-show,.lsm-sidebar-item>a:hover{color: #FFF;background: rgba(0, 0, 0, 0.2);}
|
||||
.lsm-sidebar-show>a:before,.lsm-sidebar-item>a:hover:before{opacity:1;}
|
||||
.lsm-sidebar-item li>a:hover,.lsm-popup>div>ul>li>a:hover{color: #FFF; background: #6e809c;}
|
||||
.lsm-mini-btn{height: 70px;width: 70px;}
|
||||
.lsm-mini-btn svg{margin: -10px 0 0 -10px;}
|
||||
.lsm-mini-btn input[type="checkbox"]{display: none;}
|
||||
|
||||
.lsm-mini-btn path {
|
||||
fill: none;
|
||||
stroke: #ffffff;
|
||||
stroke-width: 3;
|
||||
stroke-linecap: round;
|
||||
stroke-linejoin: round;
|
||||
--length: 24;
|
||||
--offset: -38;
|
||||
stroke-dasharray: var(--length) var(--total-length);
|
||||
stroke-dashoffset: var(--offset);
|
||||
transition: all .8s cubic-bezier(.645, .045, .355, 1);
|
||||
}
|
||||
|
||||
.lsm-mini-btn circle {fill: #fff3;opacity: 0;}
|
||||
.lsm-mini-btn label {top: 0; right: 0;}
|
||||
.lsm-mini-btn label:hover circle {opacity: 1;}
|
||||
.lsm-mini-btn input:checked+svg .line--1, .lsm-mini-btn input:checked+svg .line--3 {--length: 8.602325267;}
|
||||
.lsm-mini-btn .line--1, .lsm-mini-btn .line--3 {--total-length: 126.38166809082031;}
|
||||
.lsm-mini-btn .line--2 {--total-length: 80;}
|
||||
.lsm-mini-btn input:checked+svg .line--1, .lsm-mini-btn input:checked+svg .line--3 {--offset: -109.1770175568;}
|
||||
|
||||
.lsm-mini .lsm-container, .lsm-mini .lsm-container{width: 60px;}
|
||||
.lsm-container.lsm-mini .lsm-sidebar .lsm-sidebar-icon{/* margin-left:-2px; */}
|
||||
.left-side-menu.lsm-mini ul:first-child>li.lsm-sidebar-item>a span{display: none;}
|
||||
.left-side-menu.lsm-mini ul:first-child>li.lsm-sidebar-item>a> i.lsm-sidebar-more{margin-right: -20px;}
|
||||
|
||||
.lsm-container.lsm-mini .lsm-sidebar>ul>li.lsm-sidebar-item>ul>li.lsm-sidebar-item>ul{
|
||||
display:none;
|
||||
position: absolute;top:0px;left:180px;width: 180px;z-index: 99;
|
||||
bottom: 0px;
|
||||
top: 0px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.left-side-menu.lsm-mini ul:first-child > li > ul{
|
||||
display: none;
|
||||
}
|
||||
.transform { -webkit-transform: scale(1); -ms-transform: scale(1); transform: scale(1); }
|
||||
.lsm-popup div{background: #05161f;}
|
||||
.lsm-popup{
|
||||
display: block;
|
||||
position: absolute;
|
||||
border: 3px solid rgba(60, 71, 76, 0);
|
||||
}
|
||||
|
||||
.lsm-popup > div > a > i.my-icon.lsm-sidebar-more{
|
||||
transform:rotate(90deg);
|
||||
}
|
||||
|
||||
.lsm-popup.second{
|
||||
left: 60px;
|
||||
}
|
||||
.lsm-popup.third{
|
||||
left: 243px;
|
||||
}
|
||||
.lsm-popup.third.lsm-sidebar > div > ul {
|
||||
display: block;
|
||||
}
|
||||
.lsm-popup div {
|
||||
border-radius: 5px;
|
||||
}
|
||||
.lsm-popup .lsm-sidebar-icon{
|
||||
display: none;
|
||||
}
|
||||
.lsm-popup.lsm-sidebar a span{
|
||||
margin-left: 0px;
|
||||
}
|
||||
.lsm-popup.lsm-sidebar > div > ul > li.lsm-sidebar-item>ul{position: absolute;top:0px;left:180px;width: 180px;z-index: 99;}
|
||||
|
||||
.lsm-popup.lsm-sidebar ul {
|
||||
width: 180px;
|
||||
}
|
||||
.lsm-popup.lsm-sidebar ul li{
|
||||
width: 180px;
|
||||
}
|
||||
.lsm-popup.lsm-sidebar ul li:last-child, .lsm-popup>div>ul>li:last-child>a{
|
||||
border-radius: 0 0 5px 5px ;
|
||||
}
|
||||
|
||||
|
After Width: | Height: | Size: 70 KiB |
|
After Width: | Height: | Size: 141 B |
@@ -0,0 +1,16 @@
|
||||
/*! Copyright (c) 2011 Piotr Rochala (http://rocha.la)
|
||||
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
|
||||
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
|
||||
*
|
||||
* Version: 1.3.8
|
||||
*
|
||||
*/
|
||||
(function(e){e.fn.extend({slimScroll:function(f){var a=e.extend({width:"auto",height:"250px",size:"7px",color:"#000",position:"right",distance:"1px",start:"top",opacity:.4,alwaysVisible:!1,disableFadeOut:!1,railVisible:!1,railColor:"#333",railOpacity:.2,railDraggable:!0,railClass:"slimScrollRail",barClass:"slimScrollBar",wrapperClass:"slimScrollDiv",allowPageScroll:!1,wheelStep:20,touchScrollStep:200,borderRadius:"7px",railBorderRadius:"7px"},f);this.each(function(){function v(d){if(r){d=d||window.event;
|
||||
var c=0;d.wheelDelta&&(c=-d.wheelDelta/120);d.detail&&(c=d.detail/3);e(d.target||d.srcTarget||d.srcElement).closest("."+a.wrapperClass).is(b.parent())&&n(c,!0);d.preventDefault&&!k&&d.preventDefault();k||(d.returnValue=!1)}}function n(d,g,e){k=!1;var f=b.outerHeight()-c.outerHeight();g&&(g=parseInt(c.css("top"))+d*parseInt(a.wheelStep)/100*c.outerHeight(),g=Math.min(Math.max(g,0),f),g=0<d?Math.ceil(g):Math.floor(g),c.css({top:g+"px"}));l=parseInt(c.css("top"))/(b.outerHeight()-c.outerHeight());g=
|
||||
l*(b[0].scrollHeight-b.outerHeight());e&&(g=d,d=g/b[0].scrollHeight*b.outerHeight(),d=Math.min(Math.max(d,0),f),c.css({top:d+"px"}));b.scrollTop(g);b.trigger("slimscrolling",~~g);w();p()}function x(){u=Math.max(b.outerHeight()/b[0].scrollHeight*b.outerHeight(),30);c.css({height:u+"px"});var a=u==b.outerHeight()?"none":"block";c.css({display:a})}function w(){x();clearTimeout(B);l==~~l?(k=a.allowPageScroll,C!=l&&b.trigger("slimscroll",0==~~l?"top":"bottom")):k=!1;C=l;u>=b.outerHeight()?k=!0:(c.stop(!0,
|
||||
!0).fadeIn("fast"),a.railVisible&&m.stop(!0,!0).fadeIn("fast"))}function p(){a.alwaysVisible||(B=setTimeout(function(){a.disableFadeOut&&r||y||z||(c.fadeOut("slow"),m.fadeOut("slow"))},1E3))}var r,y,z,B,A,u,l,C,k=!1,b=e(this);if(b.parent().hasClass(a.wrapperClass)){var q=b.scrollTop(),c=b.siblings("."+a.barClass),m=b.siblings("."+a.railClass);x();if(e.isPlainObject(f)){if("height"in f&&"auto"==f.height){b.parent().css("height","auto");b.css("height","auto");var h=b.parent().parent().height();b.parent().css("height",
|
||||
h);b.css("height",h)}else"height"in f&&(h=f.height,b.parent().css("height",h),b.css("height",h));if("scrollTo"in f)q=parseInt(a.scrollTo);else if("scrollBy"in f)q+=parseInt(a.scrollBy);else if("destroy"in f){c.remove();m.remove();b.unwrap();return}n(q,!1,!0)}}else if(!(e.isPlainObject(f)&&"destroy"in f)){a.height="auto"==a.height?b.parent().height():a.height;q=e("<div></div>").addClass(a.wrapperClass).css({position:"relative",overflow:"hidden",width:a.width,height:a.height});b.css({overflow:"hidden",
|
||||
width:a.width,height:a.height});var m=e("<div></div>").addClass(a.railClass).css({width:a.size,height:"100%",position:"absolute",top:0,display:a.alwaysVisible&&a.railVisible?"block":"none","border-radius":a.railBorderRadius,background:a.railColor,opacity:a.railOpacity,zIndex:90}),c=e("<div></div>").addClass(a.barClass).css({background:a.color,width:a.size,position:"absolute",top:0,opacity:a.opacity,display:a.alwaysVisible?"block":"none","border-radius":a.borderRadius,BorderRadius:a.borderRadius,MozBorderRadius:a.borderRadius,
|
||||
WebkitBorderRadius:a.borderRadius,zIndex:99}),h="right"==a.position?{right:a.distance}:{left:a.distance};m.css(h);c.css(h);b.wrap(q);b.parent().append(c);b.parent().append(m);a.railDraggable&&c.bind("mousedown",function(a){var b=e(document);z=!0;t=parseFloat(c.css("top"));pageY=a.pageY;b.bind("mousemove.slimscroll",function(a){currTop=t+a.pageY-pageY;c.css("top",currTop);n(0,c.position().top,!1)});b.bind("mouseup.slimscroll",function(a){z=!1;p();b.unbind(".slimscroll")});return!1}).bind("selectstart.slimscroll",
|
||||
function(a){a.stopPropagation();a.preventDefault();return!1});m.hover(function(){w()},function(){p()});c.hover(function(){y=!0},function(){y=!1});b.hover(function(){r=!0;w();p()},function(){r=!1;p()});b.bind("touchstart",function(a,b){a.originalEvent.touches.length&&(A=a.originalEvent.touches[0].pageY)});b.bind("touchmove",function(b){k||b.originalEvent.preventDefault();b.originalEvent.touches.length&&(n((A-b.originalEvent.touches[0].pageY)/a.touchScrollStep,!0),A=b.originalEvent.touches[0].pageY)});
|
||||
x();"bottom"===a.start?(c.css({top:b.outerHeight()-c.outerHeight()}),n(0,!0)):"top"!==a.start&&(n(e(a.start).position().top,null,!0),a.alwaysVisible||c.hide());window.addEventListener?(this.addEventListener("DOMMouseScroll",v,!1),this.addEventListener("mousewheel",v,!1)):document.attachEvent("onmousewheel",v)}});return this}});e.fn.extend({slimscroll:e.fn.slimScroll})})(jQuery);
|
||||
@@ -0,0 +1,97 @@
|
||||
$(function(){
|
||||
$('.lsm-scroll').slimscroll({
|
||||
height: 'auto',
|
||||
position: 'right',
|
||||
railOpacity: 1,
|
||||
size: "5px",
|
||||
opacity: .4,
|
||||
color: '#fffafa',
|
||||
wheelStep: 5,
|
||||
touchScrollStep: 50
|
||||
});
|
||||
$('.lsm-container ul ul').css("display", "none");
|
||||
// lsm-sidebar收缩展开
|
||||
$('.lsm-sidebar a').on('click',function(){
|
||||
$('.lsm-scroll').slimscroll({
|
||||
height: 'auto',
|
||||
position: 'right',
|
||||
size: "8px",
|
||||
color: '#9ea5ab',
|
||||
wheelStep: 5,
|
||||
touchScrollStep: 50
|
||||
});
|
||||
if (!$('.left-side-menu').hasClass('lsm-mini')) {
|
||||
$(this).parent("li").siblings("li.lsm-sidebar-item").children('ul').slideUp(200);
|
||||
if ($(this).next().css('display') == "none") {
|
||||
//展开未展开
|
||||
// $('.lsm-sidebar-item').children('ul').slideUp(300);
|
||||
$(this).next('ul').slideDown(200);
|
||||
$(this).parent('li').addClass('lsm-sidebar-show').siblings('li').removeClass('lsm-sidebar-show');
|
||||
}else{
|
||||
//收缩已展开
|
||||
$(this).next('ul').slideUp(200);
|
||||
//$('.lsm-sidebar-item.lsm-sidebar-show').removeClass('lsm-sidebar-show');
|
||||
$(this).parent('li').removeClass('lsm-sidebar-show');
|
||||
}
|
||||
}
|
||||
});
|
||||
//lsm-mini
|
||||
$('.lsm-mini-btn svg').on('click',function(){
|
||||
if ($('.lsm-mini-btn input[type="checkbox"]').prop("checked")) {
|
||||
$('.lsm-sidebar-item.lsm-sidebar-show').removeClass('lsm-sidebar-show');
|
||||
$('.lsm-container ul').removeAttr('style');
|
||||
$('.left-side-menu').addClass('lsm-mini');
|
||||
$('.left-side-menu').stop().animate({width : 60},200);
|
||||
}else{
|
||||
$('.left-side-menu').removeClass('lsm-mini');
|
||||
$('.lsm-container ul ul').css("display", "none");
|
||||
$('.left-side-menu').stop().animate({width: 240},200);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$(document).on('mouseover','.lsm-mini .lsm-container ul:first>li',function(){
|
||||
$(".lsm-popup.third").hide();
|
||||
$(".lsm-popup.second").length == 0 && ($(".lsm-container").append("<div class='second lsm-popup lsm-sidebar'><div></div></div>"));
|
||||
$(".lsm-popup.second>div").html($(this).html());
|
||||
$(".lsm-popup.second").show();
|
||||
$(".lsm-popup.third").hide();
|
||||
var top = $(this).offset().top;
|
||||
var d = $(window).height() - $(".lsm-popup.second>div").height();
|
||||
if(d - top <= 0 ){
|
||||
top = d >= 0 ? d - 8 : 0;
|
||||
}
|
||||
$(".lsm-popup.second").stop().animate({"top":top}, 100);
|
||||
});
|
||||
|
||||
$(document).on('mouseover','.second.lsm-popup.lsm-sidebar > div > ul > li',function(){
|
||||
if(!$(this).hasClass("lsm-sidebar-item")){
|
||||
$(".lsm-popup.third").hide();
|
||||
return;
|
||||
}
|
||||
$(".lsm-popup.third").length == 0 && ($(".lsm-container").append("<div class='third lsm-popup lsm-sidebar'><div></div></div>"));
|
||||
$(".lsm-popup.third>div").html($(this).html());
|
||||
$(".lsm-popup.third").show();
|
||||
var top = $(this).offset().top;
|
||||
var d = $(window).height() - $(".lsm-popup.third").height();
|
||||
if(d - top <= 0 ){
|
||||
top = d >= 0 ? d - 8 : 0;
|
||||
}
|
||||
$(".lsm-popup.third").stop().animate({"top":top}, 100);
|
||||
});
|
||||
|
||||
$(document).on('mouseleave','.lsm-mini .lsm-container ul:first, .lsm-mini .slimScrollBar,.second.lsm-popup ,.third.lsm-popup',function(){
|
||||
$(".lsm-popup.second").hide();
|
||||
$(".lsm-popup.third").hide();
|
||||
});
|
||||
|
||||
$(document).on('mouseover','.lsm-mini .slimScrollBar,.second.lsm-popup',function(){
|
||||
$(".lsm-popup.second").show();
|
||||
});
|
||||
$(document).on('mouseover','.third.lsm-popup',function(){
|
||||
$(".lsm-popup.second").show();
|
||||
$(".lsm-popup.third").show();
|
||||
});
|
||||
|
||||
showMenu();
|
||||
});
|
||||
@@ -0,0 +1,11 @@
|
||||
/*!
|
||||
* SweetDropdown: Sweet and versatile dropdowns
|
||||
* v1.0.0, 2017-04-09
|
||||
* http://github.com/adeptoas/sweet-dropdown
|
||||
*
|
||||
* Copyright (c) 2016 Adepto.as AS · Oslo, Norway
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
*
|
||||
* See LICENSE-MIT.txt and LICENSE-GPL.txt
|
||||
*/
|
||||
!function($){var showDropdown;return $.fn.sweetDropdown=function(method,data){switch(method){case"attach":return $(this).attr("data-dropdown",data);case"detach":return $(this).removeAttr("data-dropdown");case"show":return $(this).click();case"hide":return $.sweetDropdown.hideAll(),$(this);case"enable":return $(this).removeClass("dropdown-disabled");case"disable":return $(this).addClass("dropdown-disabled")}},$.sweetDropdown=function(){},$.sweetDropdown.attachAll=function(){return $("body").off("click.dropdown").on("click.dropdown","[data-dropdown]",showDropdown),$("[data-dropdown]").off("click.dropdown").on("click.dropdown",showDropdown),$("html, .sweet-modal-content").off("click.dropdown").on("click.dropdown",$.sweetDropdown.hideAll),$(window).off("resize.dropdown").on("resize.dropdown",$.sweetDropdown.hideAll),!0},$.sweetDropdown.hideAll=function(e,hideException){var animTimeout,el,hideExceptionID,targetGroup,trigger;return null==e&&(e=null),null==hideException&&(hideException=null),targetGroup=e?$(e.target).parents().addBack():null,targetGroup&&targetGroup.hasClass("dropdown-menu")&&!targetGroup.is("A")?void 0:(el=".dropdown-menu",trigger="[data-dropdown]",hideExceptionID="",hideException&&(hideExceptionID=$(hideException).attr("id"),$('[data-dropdown="#'+hideExceptionID+'"]').hasClass("dropdown-open")||(el=".dropdown-menu:not(#"+hideExceptionID+")",trigger='[data-dropdown!="#'+hideExceptionID+'"]')),$("body").find(el).removeClass("dropdown-opened").end().find(trigger).removeClass("dropdown-open"),animTimeout=window.setTimeout(function(){return $("body").find(el).hide().end()},200),!0)},$.sweetDropdown.ANCHOR_POSITIONS=["top-left","top-center","top-right","right-top","right-center","right-bottom","bottom-left","bottom-center","bottom-right","left-top","left-center","left-bottom"],$.sweetDropdown.defaults={anchorPosition:"center"},showDropdown=function(e){var $anchor,$dropdown,$trigger,addAnchorX,addAnchorY,addX,addY,anchorPosition,anchorSide,bottomTrigger,hasAnchor,heightDropdown,heightTrigger,i,isDisabled,isOpen,left,leftTrigger,len,position,positionParts,ref,rightTrigger,top,topTrigger,widthDropdown,widthTrigger;if(null==e&&(e=null),$trigger=$(this),$dropdown=$($trigger.data("dropdown")),$anchor=$dropdown.find(".dropdown-anchor"),hasAnchor=$dropdown.hasClass("dropdown-has-anchor"),isOpen=$trigger.hasClass("dropdown-open"),isDisabled=$trigger.hasClass("dropdown-disabled"),widthDropdown=$dropdown.outerWidth(),widthTrigger=$trigger.outerWidth(),heightDropdown=$dropdown.outerHeight(),heightTrigger=$trigger.outerHeight(),topTrigger=$trigger.position().top,leftTrigger=$trigger.position().left,$trigger.hasClass("dropdown-use-offset")&&(topTrigger=$trigger.offset().top,leftTrigger=$trigger.offset().left),bottomTrigger=topTrigger+heightTrigger,rightTrigger=leftTrigger+widthTrigger,$dropdown.length<1)return console.error("[SweetDropdown] Could not find dropdown: "+$(this).data("dropdown"));if($anchor.length<1&&hasAnchor&&($anchor=$('<div class="dropdown-anchor"></div>'),$dropdown.prepend($anchor)),void 0!==e&&(e.preventDefault(),e.stopPropagation()),isOpen||isDisabled)return!1;for($.sweetDropdown.hideAll(null,$trigger.data("dropdown")),anchorPosition=$.sweetDropdown.defaults.anchorPosition,ref=$.sweetDropdown.ANCHOR_POSITIONS,i=0,len=ref.length;len>i;i++)position=ref[i],$dropdown.hasClass("dropdown-anchor-"+position)&&(anchorPosition=position);if(top=0,left=0,positionParts=anchorPosition.split("-"),anchorSide=positionParts[0],anchorPosition=positionParts[1],"top"===anchorSide||"bottom"===anchorSide)switch(anchorPosition){case"left":left=leftTrigger;break;case"center":left=leftTrigger-widthDropdown/2+widthTrigger/2;break;case"right":left=rightTrigger-widthDropdown}if("left"===anchorSide||"right"===anchorSide)switch(anchorPosition){case"top":top=topTrigger;break;case"center":top=topTrigger-heightDropdown/2+heightTrigger/2;break;case"bottom":top=topTrigger+heightTrigger-heightDropdown}switch(anchorSide){case"top":top=topTrigger+heightTrigger;break;case"right":left=leftTrigger-widthDropdown;break;case"bottom":top=topTrigger-heightDropdown;break;case"left":left=leftTrigger+widthTrigger}return addX=parseInt($dropdown.data("add-x")),addY=parseInt($dropdown.data("add-y")),isNaN(addX)||(left+=addX),isNaN(addY)||(top+=addY),addAnchorX=parseInt($trigger.data("add-anchor-x")),addAnchorY=parseInt($trigger.data("add-anchor-y")),isNaN(addAnchorX)||$anchor.css({marginLeft:addAnchorX}),isNaN(addAnchorY)||$anchor.css({marginTop:addAnchorY}),$dropdown.css({top:top,left:left,display:"block"}),window.setTimeout(function(){return $dropdown.addClass("dropdown-opened")},0),$trigger.addClass("dropdown-open"),$trigger},$(function(){return $.sweetDropdown.attachAll()})}(jQuery);
|
||||
@@ -0,0 +1,103 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>API 文档 [zTree -- jQuery 树插件]</title>
|
||||
<link rel="stylesheet" href="apiCss/common.css" type="text/css">
|
||||
<link rel='stylesheet' href='apiCss/zTreeStyleForApi.css' type='text/css'>
|
||||
<script type="text/javascript">
|
||||
var ie = (function(){
|
||||
var undef,
|
||||
v = 3,
|
||||
div = document.createElement('div'),
|
||||
all = div.getElementsByTagName('i');
|
||||
while (
|
||||
div.innerHTML = '<!--[if gt IE ' + (++v) + ']><i></i><![endif]-->',
|
||||
all[0]
|
||||
);
|
||||
return v > 4 ? v : undef;
|
||||
}()), ie6 = (ie === 6),
|
||||
path = window.location.pathname.replace(/.*\/([^\/\.]*)\..*/g,"$1"),
|
||||
langLib = [];
|
||||
ie = ie<9;
|
||||
if(ie) {
|
||||
document.write('<link rel="stylesheet" href="apiCss/common_ie6.css" type="text/css">');
|
||||
}
|
||||
var lang = "cn",
|
||||
ajaxMsg = "如果你使用的是 Chrome 浏览器,那么请把 API 文档发布到 web 服务目录下访问。\n\n(Chrome 浏览器不支持本地 ajax 访问, 即:file://)";
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="header_wrap" class="header_wrap" style="padding-top: 30px;">
|
||||
<div id="header" class="header round">
|
||||
<div class="light-bulb" alt=""></div>
|
||||
<div class="ieSuggest">浏览本网站建议您使用 Chrome、FireFox、Opera、IE9 等浏览器(只要不是 IE6 7 8 就行), 速度会更快,画面会更炫!</div>
|
||||
<div class="google_plus"><g:plusone></g:plusone></div>
|
||||
<div class="header-text">
|
||||
<h1><em>zTree v3.5.37 API 文档</em></h1><p></p>
|
||||
<p>all.js = core + excheck + exedit ( 不包括 exhide ); 发现错误请及时通知,谢谢。</p>
|
||||
</div>
|
||||
<ul class="shortcuts language" style="top:0;">
|
||||
<li><a href="API_en.html" onclick="window.location.href='API_en.html'"><button class="ico en" title="英文版" type="button"></button><span class=""></span></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div id="content_wrap" class="content_wrap">
|
||||
<div id="content" class="content">
|
||||
<div class="nav_section">
|
||||
<ul>
|
||||
<li class="first">注释:</li>
|
||||
<li><button class="ico16 z_core" onfocus="this.blur();"></button><span>core 核心包</span></li>
|
||||
<li><button class="ico16 z_check" onfocus="this.blur();"></button><span>excheck 扩展</span></li>
|
||||
<li><button class="ico16 z_edit" onfocus="this.blur();"></button><span>exedit 扩展</span></li>
|
||||
<li><button class="ico16 z_hide" onfocus="this.blur();"></button><span>exhide 扩展</span></li>
|
||||
<li class="noline">
|
||||
<button class="ico16 z_search" onfocus="this.blur();" title="Enter 以及 左、右键可以快速定位查找结果"></button>
|
||||
<input type="text" class="searchKey search empty" value=""><input type="text" class="searchResult search" value="">
|
||||
<button class="ico16 searchPrev disabled" onfocus="this.blur();" title="Enter 以及 左、右键可以快速定位查找结果"></button><button class="ico16 searchNext disabled" onfocus="this.blur();" title="Enter 以及 左、右键可以快速定位查找结果"></button>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div id="contentBox" class="contentBox round clearfix">
|
||||
<div id="apiContent" class="apiContent">
|
||||
<div id="api_setting" class="api_setting left">
|
||||
<ul class="api_content_title"><li>setting 配置详解</li></ul>
|
||||
<ul id="settingTree" class="ztree"></ul>
|
||||
</div>
|
||||
<div id="api_function" class="api_function right">
|
||||
<ul class="api_content_title"><li>zTree 方法详解</li></ul>
|
||||
<ul id="functionTree" class="ztree"></ul>
|
||||
<ul class="api_content_title"><li>treeNode 节点数据详解</li></ul>
|
||||
<ul id="treenodeTree" class="ztree"></ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- overlayed -->
|
||||
<div id="overlayDiv" class="baby_overlay">
|
||||
<div id="overlayContent" class="content round clearfix">
|
||||
<div class="overlaySearch">
|
||||
<button class="ico16 z_search" onfocus="this.blur();" title="Enter 以及 左、右键可以快速定位查找结果"></button>
|
||||
<input type="text" class="searchKey search empty" value=""><input type="text" class="searchResult search" value="">
|
||||
<button class="ico16 searchPrev disabled" onfocus="this.blur();" title="Enter 以及 左、右键可以快速定位查找结果"></button><button class="ico16 searchNext disabled" onfocus="this.blur();" title="Enter 以及 左、右键可以快速定位查找结果"></button>
|
||||
</div>
|
||||
<a id="overlayDivCloseBtn" class="close"></a>
|
||||
<div id="overlayDetailDiv" class="details"></div>
|
||||
</div>
|
||||
<div id="overlayDivArrow" class="baby_overlay_arrow"></div>
|
||||
</div>
|
||||
<script type="text/javascript" src="apiCss/jquery-1.6.2.min.js"></script>
|
||||
<script type='text/javascript' src='apiCss/jquery.ztree.core.js'></script>
|
||||
<script type='text/javascript' src='apiCss/api.js'></script>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
apiContent._init();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,102 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>API Document [zTree -- jQuery tree plug-ins.]</title>
|
||||
<link rel="stylesheet" href="apiCss/common.css" type="text/css">
|
||||
<link rel='stylesheet' href='apiCss/zTreeStyleForApi.css' type='text/css'>
|
||||
<script type="text/javascript">
|
||||
var ie = (function(){
|
||||
var undef,
|
||||
v = 3,
|
||||
div = document.createElement('div'),
|
||||
all = div.getElementsByTagName('i');
|
||||
while (
|
||||
div.innerHTML = '<!--[if gt IE ' + (++v) + ']><i></i><![endif]-->',
|
||||
all[0]
|
||||
);
|
||||
return v > 4 ? v : undef;
|
||||
}()), ie6 = (ie === 6),
|
||||
path = window.location.pathname.replace(/.*\/([^\/\.]*)\..*/g,"$1"),
|
||||
langLib = [];
|
||||
ie = ie<9;
|
||||
if(ie) {
|
||||
document.write('<link rel="stylesheet" href="apiCss/common_ie6.css" type="text/css">');
|
||||
}
|
||||
var lang = "en",
|
||||
ajaxMsg = "If you use chrome browser, please copy the API files to local webserver. \n\n( because chrome browser can't allow AJAX access to 'file://' )";
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="header_wrap" class="header_wrap" style="padding-top: 30px;">
|
||||
<div id="header" class="header round">
|
||||
<div class="light-bulb" alt=""></div>
|
||||
<div class="ieSuggest">If you use the Chrome / FireFox / Opera / IE9 browser will be even more dazzling effect!</div>
|
||||
<div class="google_plus"><g:plusone></g:plusone></div>
|
||||
<div class="header-text">
|
||||
<h1><em>zTree v3.5.37 API Document</em></h1><p></p>
|
||||
<p>all.js = core + excheck + exedit ( without exhide ); if you found some mistakes please contact me.</p>
|
||||
</div>
|
||||
<ul class="shortcuts language" style="top:0;">
|
||||
<li><a href="API_cn.html" onclick="window.location.href='API_cn.html'"><button class="ico cn" title="Chinese" type="button"></button><span class=""></span></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div id="content_wrap" class="content_wrap">
|
||||
<div id="content" class="content">
|
||||
<div class="nav_section">
|
||||
<ul>
|
||||
<li class="first">Notes: </li>
|
||||
<li><button class="ico16 z_core" onfocus="this.blur();"></button><span>core package</span></li>
|
||||
<li><button class="ico16 z_check" onfocus="this.blur();"></button><span>excheck pack</span></li>
|
||||
<li><button class="ico16 z_edit" onfocus="this.blur();"></button><span>exedit pack</span></li>
|
||||
<li><button class="ico16 z_hide" onfocus="this.blur();"></button><span>exhide pack</span></li>
|
||||
<li class="noline">
|
||||
<button class="ico16 z_search" onfocus="this.blur();" title="'Enter', 'left' and 'right' key can locate the search results quickly."></button>
|
||||
<input type="text" class="searchKey search empty" value=""><input type="text" class="searchResult search" value="">
|
||||
<button class="ico16 searchPrev disabled" onfocus="this.blur();" title="'Enter', 'left' and 'right' key can locate the search results quickly."></button><button class="ico16 searchNext disabled" onfocus="this.blur();" title="'Enter', 'left' and 'right' key can locate the search results quickly."></button>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div id="contentBox" class="contentBox round clearfix">
|
||||
<div id="apiContent" class="apiContent">
|
||||
<div id="api_setting" class="api_setting left">
|
||||
<ul class="api_content_title"><li>setting details</li></ul>
|
||||
<ul id="settingTree" class="ztree"></ul>
|
||||
</div>
|
||||
<div id="api_function" class="api_function right">
|
||||
<ul class="api_content_title"><li>zTree method details</li></ul>
|
||||
<ul id="functionTree" class="ztree"></ul>
|
||||
<ul class="api_content_title"><li>treeNode data details</li></ul>
|
||||
<ul id="treenodeTree" class="ztree"></ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- overlayed -->
|
||||
<div id="overlayDiv" class="baby_overlay">
|
||||
<div id="overlayContent" class="content round clearfix">
|
||||
<div class="overlaySearch">
|
||||
<button class="ico16 z_search" onfocus="this.blur();" title="'Enter', 'left' and 'right' key can locate the search results quickly."></button>
|
||||
<input type="text" class="searchKey search empty" value=""><input type="text" class="searchResult search" value="">
|
||||
<button class="ico16 searchPrev disabled" onfocus="this.blur();" title="'Enter', 'left' and 'right' key can locate the search results quickly."></button><button class="ico16 searchNext disabled" onfocus="this.blur();" title="'Enter', 'left' and 'right' key can locate the search results quickly."></button>
|
||||
</div>
|
||||
<a id="overlayDivCloseBtn" class="close"></a>
|
||||
<div id="overlayDetailDiv" class="details"></div>
|
||||
</div>
|
||||
<div id="overlayDivArrow" class="baby_overlay_arrow"></div>
|
||||
</div>
|
||||
<script type="text/javascript" src="apiCss/jquery-1.6.2.min.js"></script>
|
||||
<script type='text/javascript' src='apiCss/jquery.ztree.core.js'></script>
|
||||
<script type='text/javascript' src='apiCss/api.js'></script>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
apiContent._init();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,599 @@
|
||||
var apiContent = {
|
||||
zTree_Setting: null,
|
||||
zTree_Node: null,
|
||||
zTree_Function: null,
|
||||
overlayDiv : null,
|
||||
overlayContent : null,
|
||||
overlayDetailDiv : null,
|
||||
overlayCloseBtn: null,
|
||||
overlayArrow: null,
|
||||
contentBoxDiv : null,
|
||||
settingDiv : null,
|
||||
functionDiv : null,
|
||||
overlaySearch: null,
|
||||
searchKey: null,
|
||||
searchResultInput: null,
|
||||
searchPrevBtn: null,
|
||||
searchNextBtn: null,
|
||||
apiCache: {},
|
||||
lastValue: "",
|
||||
searchNodes: [],
|
||||
searchNodesCur: 0,
|
||||
|
||||
_init: function() {
|
||||
this.overlayDiv = $("#overlayDiv");
|
||||
this.overlayContent = $("#overlayContent");
|
||||
this.overlayDetailDiv = $("#overlayDetailDiv");
|
||||
this.overlayCloseBtn = $("#overlayDivCloseBtn");
|
||||
this.overlayArrow = $("#overlayDivArrow");
|
||||
this.contentBoxDiv = $("#contentBox");
|
||||
this.settingDiv = $("#api_setting");
|
||||
this.functionDiv = $("#api_function");
|
||||
this.searchKey = $(".searchKey");
|
||||
this.overlaySearch = $(".overlaySearch");
|
||||
this.searchResultInput = $(".searchResult");
|
||||
this.searchPrevBtn = $(".searchPrev");
|
||||
this.searchNextBtn = $(".searchNext");
|
||||
var setting = {
|
||||
view: {
|
||||
fontCss: this.getFontCss,
|
||||
showLine: false,
|
||||
showIcon: this.showIcon,
|
||||
showTitle: this.getTitle,
|
||||
selectedMulti: false,
|
||||
dblClickExpand: false
|
||||
},
|
||||
data: {
|
||||
key: {
|
||||
title: "tt"
|
||||
},
|
||||
simpleData: {
|
||||
enable:true,
|
||||
idKey: "id",
|
||||
pIdKey: "pId",
|
||||
rootPId: ""
|
||||
}
|
||||
},
|
||||
callback: {
|
||||
onNodeCreated: this.onNodeCreated,
|
||||
beforeClick: this.beforeClick
|
||||
}
|
||||
};
|
||||
var setting_nodes =[
|
||||
{id:1, pId:0, t:"setting", name:"var setting = {", open:true},
|
||||
{id:11, pId:1, t:"treeId", name:"treeId : \"\",", iconSkin:"core", showAPI:true},
|
||||
{id:12, pId:1, t:"treeObj", name:"treeObj : null,", iconSkin:"core", showAPI:true},
|
||||
{id:121, pId:1, name:""},
|
||||
|
||||
{id:20, pId:1, t:"async", name:"async : {", open:true},
|
||||
{id:201, pId:20, t:"autoParam", name:"autoParam : [],", iconSkin:"core", showAPI:true},
|
||||
{id:208, pId:20, t:"contentType", name:"contentType : \"application...\",", iconSkin:"core", showAPI:true},
|
||||
{id:202, pId:20, t:"dataFilter", name:"dataFilter : null,", iconSkin:"core", showAPI:true},
|
||||
{id:203, pId:20, t:"dataType", name:"dataType : \"text\",", iconSkin:"core", showAPI:true},
|
||||
{id:204, pId:20, t:"enable", name:"enable : false,", iconSkin:"core", showAPI:true},
|
||||
{id:205, pId:20, t:"otherParam", name:"otherParam : [],", iconSkin:"core", showAPI:true},
|
||||
{id:206, pId:20, t:"type", name:"type : \"post\",", iconSkin:"core", showAPI:true},
|
||||
{id:209, pId:20, t:"headers", name:"headers : {},", iconSkin:"core", showAPI:true},
|
||||
{id:210, pId:20, t:"xhrFields", name:"xhrFields : {},", iconSkin:"core", showAPI:true},
|
||||
{id:207, pId:20, t:"url", name:"url : \"\"", iconSkin:"core", showAPI:true},
|
||||
{id:21, pId:1, name:"},"},
|
||||
{id:22, pId:1, name:""},
|
||||
|
||||
{id:30, pId:1, t:"callback", name:"callback : {", open:true},
|
||||
{id:3001, pId:30, t:"beforeAsync", name:"beforeAsync : null,", iconSkin:"core", showAPI:true},
|
||||
{id:3002, pId:30, t:"beforeCheck", name:"beforeCheck : null,", iconSkin:"check", showAPI:true},
|
||||
{id:3003, pId:30, t:"beforeClick", name:"beforeClick : null,", iconSkin:"core", showAPI:true},
|
||||
{id:3004, pId:30, t:"beforeCollapse", name:"beforeCollapse : null,", iconSkin:"core", showAPI:true},
|
||||
{id:3004, pId:30, t:"beforeDblClick", name:"beforeDblClick : null,", iconSkin:"core", showAPI:true},
|
||||
{id:3005, pId:30, t:"beforeDrag", name:"beforeDrag : null,", iconSkin:"edit", showAPI:true},
|
||||
{id:3006, pId:30, t:"beforeDragOpen", name:"beforeDragOpen : null,", iconSkin:"edit", showAPI:true},
|
||||
{id:3007, pId:30, t:"beforeDrop", name:"beforeDrop : null,", iconSkin:"edit", showAPI:true},
|
||||
{id:3029, pId:30, t:"beforeEditName", name:"beforeEditName : null,", iconSkin:"edit", showAPI:true},
|
||||
{id:3008, pId:30, t:"beforeExpand", name:"beforeExpand : null,", iconSkin:"core", showAPI:true},
|
||||
{id:3009, pId:30, t:"beforeMouseDown", name:"beforeMouseDown : null,", iconSkin:"core", showAPI:true},
|
||||
{id:3010, pId:30, t:"beforeMouseUp", name:"beforeMouseUp : null,", iconSkin:"core", showAPI:true},
|
||||
{id:3011, pId:30, t:"beforeRemove", name:"beforeRemove : null,", iconSkin:"edit", showAPI:true},
|
||||
{id:3012, pId:30, t:"beforeRename", name:"beforeRename : null,", iconSkin:"edit", showAPI:true},
|
||||
{id:3013, pId:30, t:"beforeRightClick", name:"beforeRightClick : null,", iconSkin:"core", showAPI:true},
|
||||
{id:3014, pId:30, name:""},
|
||||
{id:3015, pId:30, t:"onAsyncError", name:"onAsyncError : null,", iconSkin:"core", showAPI:true},
|
||||
{id:3016, pId:30, t:"onAsyncSuccess", name:"onAsyncSuccess : null,", iconSkin:"core", showAPI:true},
|
||||
{id:3017, pId:30, t:"onCheck", name:"onCheck : null,", iconSkin:"check", showAPI:true},
|
||||
{id:3018, pId:30, t:"onClick", name:"onClick : null,", iconSkin:"core", showAPI:true},
|
||||
{id:3019, pId:30, t:"onCollapse", name:"onCollapse : null,", iconSkin:"core", showAPI:true},
|
||||
{id:3029, pId:30, t:"onDblClick", name:"onDblClick : null,", iconSkin:"core", showAPI:true},
|
||||
{id:3020, pId:30, t:"onDrag", name:"onDrag : null,", iconSkin:"edit", showAPI:true},
|
||||
{id:3030, pId:30, t:"onDragMove", name:"onDragMove : null,", iconSkin:"edit", showAPI:true},
|
||||
{id:3021, pId:30, t:"onDrop", name:"onDrop : null,", iconSkin:"edit", showAPI:true},
|
||||
{id:3022, pId:30, t:"onExpand", name:"onExpand : null,", iconSkin:"core", showAPI:true},
|
||||
{id:3023, pId:30, t:"onMouseDown", name:"onMouseDown : null,", iconSkin:"core", showAPI:true},
|
||||
{id:3024, pId:30, t:"onMouseUp", name:"onMouseUp : null,", iconSkin:"core", showAPI:true},
|
||||
{id:3025, pId:30, t:"onNodeCreated", name:"onNodeCreated : null,", iconSkin:"core", showAPI:true},
|
||||
{id:3026, pId:30, t:"onRemove", name:"onRemove : null,", iconSkin:"edit", showAPI:true},
|
||||
{id:3027, pId:30, t:"onRename", name:"onRename : null,", iconSkin:"edit", showAPI:true},
|
||||
{id:3028, pId:30, t:"onRightClick", name:"onRightClick : null", iconSkin:"core", showAPI:true},
|
||||
{id:31, pId:1, name:"},"},
|
||||
{id:32, pId:1, name:""},
|
||||
|
||||
{id:40, pId:1, t:"check", name:"check : {", open:true},
|
||||
{id:405, pId:40, t:"autoCheckTrigger", name:"autoCheckTrigger : false,", iconSkin:"check", showAPI:true},
|
||||
{id:401, pId:40, t:"chkboxType", name:"chkboxType : {\"Y\": \"ps\", \"N\": \"ps\"},", iconSkin:"check", showAPI:true},
|
||||
{id:402, pId:40, t:"chkStyle", name:"chkStyle : \"checkbox\",", iconSkin:"check", showAPI:true},
|
||||
{id:403, pId:40, t:"enable", name:"enable : false,", iconSkin:"check", showAPI:true},
|
||||
{id:406, pId:40, t:"nocheckInherit", name:"nocheckInherit : false", iconSkin:"check", showAPI:true},
|
||||
{id:407, pId:40, t:"chkDisabledInherit", name:"chkDisabledInherit : false", iconSkin:"check", showAPI:true},
|
||||
{id:404, pId:40, t:"radioType", name:"radioType : \"level\"", iconSkin:"check", showAPI:true},
|
||||
{id:41, pId:1, name:"},"},
|
||||
{id:42, pId:1, name:""},
|
||||
|
||||
{id:50, pId:1, t:"data", name:"data : {", open:true},
|
||||
{id:500, pId:50, t:"keep", name:"keep : {", open:true},
|
||||
{id:5001, pId:500, t:"leaf", name:"leaf : false,", iconSkin:"core", showAPI:true},
|
||||
{id:5002, pId:500, t:"parent", name:"parent : false", iconSkin:"core", showAPI:true},
|
||||
{id:501, pId:50, name:"},"},
|
||||
|
||||
{id:510, pId:50, t:"key", name:"key : {", open:true},
|
||||
{id:5101, pId:510, t:"checked", name:"checked : \"checked\",", iconSkin:"check", showAPI:true},
|
||||
{id:5102, pId:510, t:"children", name:"children : \"children\",", iconSkin:"core", showAPI:true},
|
||||
{id:5106, pId:510, t:"isParent", name:"isParent : \"isParent\",", iconSkin:"core", showAPI:true},
|
||||
{id:5107, pId:510, t:"isHidden", name:"isHidden : \"isHidden\",", iconSkin:"hide", showAPI:true},
|
||||
{id:5103, pId:510, t:"name", name:"name : \"name\",", iconSkin:"core", showAPI:true},
|
||||
{id:5104, pId:510, t:"title", name:"title : \"\"", iconSkin:"core", showAPI:true},
|
||||
{id:5105, pId:510, t:"url", name:"url : \"url\"", iconSkin:"core", showAPI:true},
|
||||
{id:511, pId:50, name:"},"},
|
||||
|
||||
{id:520, pId:50, t:"simpleData", name:"simpleData : {", open:true},
|
||||
{id:5201, pId:520, t:"enable", name:"enable : false,", iconSkin:"core", showAPI:true},
|
||||
{id:5202, pId:520, t:"idKey", name:"idKey : \"id\",", iconSkin:"core", showAPI:true},
|
||||
{id:5203, pId:520, t:"pIdKey", name:"pIdKey : \"pId\",", iconSkin:"core", showAPI:true},
|
||||
{id:5204, pId:520, t:"rootPId", name:"rootPId : null", iconSkin:"core", showAPI:true},
|
||||
{id:521, pId:50, name:"}"},
|
||||
{id:51, pId:1, name:"},"},
|
||||
{id:52, pId:1, name:""},
|
||||
|
||||
{id:60, pId:1, t:"edit", name:"edit : {", open:true},
|
||||
{id:601, pId:60, t:"drag", name:"drag : {", open:true},
|
||||
{id:60111, pId:601, t:"autoExpandTrigger", name:"autoExpandTrigger : true,", iconSkin:"edit", showAPI:true},
|
||||
{id:60101, pId:601, t:"isCopy", name:"isCopy : true,", iconSkin:"edit", showAPI:true},
|
||||
{id:60102, pId:601, t:"isMove", name:"isMove : true,", iconSkin:"edit", showAPI:true},
|
||||
{id:60103, pId:601, t:"prev", name:"prev : true,", iconSkin:"edit", showAPI:true},
|
||||
{id:60104, pId:601, t:"next", name:"next : true,", iconSkin:"edit", showAPI:true},
|
||||
{id:60105, pId:601, t:"inner", name:"inner : true,", iconSkin:"edit", showAPI:true},
|
||||
{id:60107, pId:601, t:"borderMax", name:"borderMax : 10,", iconSkin:"edit", showAPI:true},
|
||||
{id:60108, pId:601, t:"borderMin", name:"borderMin : -5,", iconSkin:"edit", showAPI:true},
|
||||
{id:60106, pId:601, t:"minMoveSize", name:"minMoveSize : 5,", iconSkin:"edit", showAPI:true},
|
||||
{id:60109, pId:601, t:"maxShowNodeNum", name:"maxShowNodeNum : 5,", iconSkin:"edit", showAPI:true},
|
||||
{id:60110, pId:601, t:"autoOpenTime", name:"autoOpenTime : 500", iconSkin:"edit", showAPI:true},
|
||||
{id:602, pId:60, name:"},"},
|
||||
{id:608, pId:60, t:"editNameSelectAll", name:"editNameSelectAll : false,", iconSkin:"edit", showAPI:true},
|
||||
{id:603, pId:60, t:"enable", name:"enable : false,", iconSkin:"edit", showAPI:true},
|
||||
{id:604, pId:60, t:"removeTitle", name:"removeTitle : \"remove\",", iconSkin:"edit", showAPI:true},
|
||||
{id:605, pId:60, t:"renameTitle", name:"renameTitle : \"rename\",", iconSkin:"edit", showAPI:true},
|
||||
{id:606, pId:60, t:"showRemoveBtn", name:"showRemoveBtn : true,", iconSkin:"edit", showAPI:true},
|
||||
{id:607, pId:60, t:"showRenameBtn", name:"showRenameBtn : true", iconSkin:"edit", showAPI:true},
|
||||
{id:61, pId:1, name:"},"},
|
||||
{id:62, pId:1, name:""},
|
||||
|
||||
{id:70, pId:1, t:"view", name:"view : {", open:true},
|
||||
{id:7001, pId:70, t:"addDiyDom", name:"addDiyDom : null,", iconSkin:"core", showAPI:true},
|
||||
{id:7002, pId:70, t:"addHoverDom", name:"addHoverDom : null,", iconSkin:"edit", showAPI:true},
|
||||
{id:7003, pId:70, t:"autoCancelSelected", name:"autoCancelSelected : true,", iconSkin:"core", showAPI:true},
|
||||
{id:7004, pId:70, t:"dblClickExpand", name:"dblClickExpand : true,", iconSkin:"core", showAPI:true},
|
||||
{id:7005, pId:70, t:"expandSpeed", name:"expandSpeed : \"fast\",", iconSkin:"core", showAPI:true},
|
||||
{id:7006, pId:70, t:"fontCss", name:"fontCss : {},", iconSkin:"core", showAPI:true},
|
||||
{id:7012, pId:70, t:"nameIsHTML", name:"nameIsHTML : false,", iconSkin:"core", showAPI:true},
|
||||
{id:7007, pId:70, t:"removeHoverDom", name:"removeHoverDom : null,", iconSkin:"edit", showAPI:true},
|
||||
{id:7008, pId:70, t:"selectedMulti", name:"selectedMulti : true,", iconSkin:"core", showAPI:true},
|
||||
{id:7009, pId:70, t:"showIcon", name:"showIcon : true,", iconSkin:"core", showAPI:true},
|
||||
{id:7010, pId:70, t:"showLine", name:"showLine : true,", iconSkin:"core", showAPI:true},
|
||||
{id:7011, pId:70, t:"showTitle", name:"showTitle : true,", iconSkin:"core", showAPI:true},
|
||||
{id:7012, pId:70, t:"txtSelectedEnable", name:"txtSelectedEnable : false", iconSkin:"core", showAPI:true},
|
||||
{id:71, pId:1, name:"}"},
|
||||
|
||||
{id:2, pId:0, name:"}"}
|
||||
];
|
||||
|
||||
var treenode_nodes =[
|
||||
{id:1, pId:0, t:"treeNode", name:"treeNode : {", open:true},
|
||||
{id:101, pId:1, t:"checked", name:"checked", iconSkin:"check", showAPI:true},
|
||||
{id:102, pId:1, t:"children", name:"children", iconSkin:"core", showAPI:true},
|
||||
{id:128, pId:1, t:"chkDisabled", name:"chkDisabled", iconSkin:"check", showAPI:true},
|
||||
{id:127, pId:1, t:"click", name:"click", iconSkin:"core", showAPI:true},
|
||||
{id:103, pId:1, t:"getCheckStatus", name:"getCheckStatus ()", iconSkin:"check", showAPI:true},
|
||||
{id:135, pId:1, t:"getIndex", name:"getIndex ()", iconSkin:"core", showAPI:true},
|
||||
{id:104, pId:1, t:"getNextNode", name:"getNextNode ()", iconSkin:"core", showAPI:true},
|
||||
{id:105, pId:1, t:"getParentNode", name:"getParentNode ()", iconSkin:"core", showAPI:true},
|
||||
{id:136, pId:1, t:"getPath", name:"getPath ()", iconSkin:"core", showAPI:true},
|
||||
{id:106, pId:1, t:"getPreNode", name:"getPreNode ()", iconSkin:"core", showAPI:true},
|
||||
{id:129, pId:1, t:"halfCheck", name:"halfCheck", iconSkin:"check", showAPI:true},
|
||||
{id:107, pId:1, t:"icon", name:"icon", iconSkin:"core", showAPI:true},
|
||||
{id:108, pId:1, t:"iconClose", name:"iconClose", iconSkin:"core", showAPI:true},
|
||||
{id:109, pId:1, t:"iconOpen", name:"iconOpen", iconSkin:"core", showAPI:true},
|
||||
{id:110, pId:1, t:"iconSkin", name:"iconSkin", iconSkin:"core", showAPI:true},
|
||||
{id:131, pId:1, t:"isHidden", name:"isHidden", iconSkin:"hide", showAPI:true},
|
||||
{id:111, pId:1, t:"isParent", name:"isParent", iconSkin:"core", showAPI:true},
|
||||
{id:132, pId:1, t:"name", name:"name", iconSkin:"core", showAPI:true},
|
||||
{id:112, pId:1, t:"nocheck", name:"nocheck", iconSkin:"check", showAPI:true},
|
||||
{id:113, pId:1, t:"open", name:"open", iconSkin:"core", showAPI:true},
|
||||
{id:133, pId:1, t:"target", name:"target", iconSkin:"core", showAPI:true},
|
||||
{id:134, pId:1, t:"url", name:"url", iconSkin:"core", showAPI:true},
|
||||
{id:114, pId:1, t:"diy", name:"*DIY*", iconSkin:"core", showAPI:true},
|
||||
{id:115, pId:1, name:""},
|
||||
{id:116, pId:1, t:"check_Child_State", name:"[check_Child_State]", iconSkin:"check", showAPI:true},
|
||||
{id:117, pId:1, t:"check_Focus", name:"[check_Focus]", iconSkin:"check", showAPI:true},
|
||||
{id:118, pId:1, t:"checkedOld", name:"[checkedOld]", iconSkin:"check", showAPI:true},
|
||||
{id:119, pId:1, t:"editNameFlag", name:"[editNameFlag]", iconSkin:"edit", showAPI:true},
|
||||
{id:120, pId:1, t:"isAjaxing", name:"[isAjaxing]", iconSkin:"core", showAPI:true},
|
||||
{id:121, pId:1, t:"isFirstNode", name:"[isFirstNode]", iconSkin:"core", showAPI:true},
|
||||
{id:122, pId:1, t:"isHover", name:"[isHover]", iconSkin:"edit", showAPI:true},
|
||||
{id:123, pId:1, t:"isLastNode", name:"[isLastNode]", iconSkin:"core", showAPI:true},
|
||||
{id:124, pId:1, t:"level", name:"[level]", iconSkin:"core", showAPI:true},
|
||||
{id:125, pId:1, t:"parentTId", name:"[parentTId]", iconSkin:"core", showAPI:true},
|
||||
{id:126, pId:1, t:"tId", name:"[tId]", iconSkin:"core", showAPI:true},
|
||||
{id:130, pId:1, t:"zAsync", name:"[zAsync]", iconSkin:"core", showAPI:true},
|
||||
{id:2, pId:0, name:"}"}
|
||||
];
|
||||
|
||||
var function_nodes =[
|
||||
{id:1, pId:0, t:"$.fn.zTree", name:"$.fn.zTree : {", open:true},
|
||||
{id:11, pId:1, t:"init", name:"init (obj, zSetting, zNodes)", iconSkin:"core", showAPI:true},
|
||||
{id:12, pId:1, t:"getZTreeObj", name:"getZTreeObj (treeId)", iconSkin:"core", showAPI:true},
|
||||
{id:14, pId:1, t:"destroy", name:"destroy (treeId)", iconSkin:"core", showAPI:true},
|
||||
{id:13, pId:1, t:"_z", name:"_z : {tools, view, event, data}", iconSkin:"core", showAPI:true},
|
||||
{id:2, pId:0, name:"}"},
|
||||
{id:3, pId:0, name:""},
|
||||
{id:4, pId:0, t:"zTreeObj", name:"zTreeObj : {", open:true},
|
||||
{id:401, pId:4, t:"setting", name:"setting", iconSkin:"core", showAPI:true},
|
||||
{id:402, pId:4, t:"addNodes", name:"addNodes (parentNode, index, newNodes, isSilent)", iconSkin:"core", showAPI:true},
|
||||
{id:403, pId:4, t:"cancelEditName", name:"cancelEditName (newName)", iconSkin:"edit", showAPI:true},
|
||||
{id:404, pId:4, t:"cancelSelectedNode", name:"cancelSelectedNode (node)", iconSkin:"core", showAPI:true},
|
||||
{id:405, pId:4, t:"checkAllNodes", name:"checkAllNodes (checked)", iconSkin:"check", showAPI:true},
|
||||
{id:406, pId:4, t:"checkNode", name:"checkNode (node, checked, checkTypeFlag, callbackFlag)", iconSkin:"check", showAPI:true},
|
||||
{id:407, pId:4, t:"copyNode", name:"copyNode (targetNode, node, moveType, isSilent)", iconSkin:"edit", showAPI:true},
|
||||
{id:436, pId:4, t:"destroy", name:"destroy ()", iconSkin:"core", showAPI:true},
|
||||
{id:408, pId:4, t:"editName", name:"editName (node)", iconSkin:"edit", showAPI:true},
|
||||
{id:409, pId:4, t:"expandAll", name:"expandAll (expandFlag)", iconSkin:"core", showAPI:true},
|
||||
{id:410, pId:4, t:"expandNode", name:"expandNode (node, expandFlag, sonSign, focus, callbackFlag)", iconSkin:"core", showAPI:true},
|
||||
{id:411, pId:4, t:"getChangeCheckedNodes", name:"getChangeCheckedNodes ()", iconSkin:"check", showAPI:true},
|
||||
{id:412, pId:4, t:"getCheckedNodes", name:"getCheckedNodes (checked)", iconSkin:"check", showAPI:true},
|
||||
{id:413, pId:4, t:"getNodeByParam", name:"getNodeByParam (key, value, parentNode)", iconSkin:"core", showAPI:true},
|
||||
{id:414, pId:4, t:"getNodeByTId", name:"getNodeByTId (tId)", iconSkin:"core", showAPI:true},
|
||||
{id:415, pId:4, t:"getNodeIndex", name:"getNodeIndex (node)", iconSkin:"core", showAPI:true},
|
||||
{id:416, pId:4, t:"getNodes", name:"getNodes ()", iconSkin:"core", showAPI:true},
|
||||
{id:431, pId:4, t:"getNodesByFilter", name:"getNodesByFilter (filter, isSingle, parentNode, invokeParam)", iconSkin:"core", showAPI:true},
|
||||
{id:417, pId:4, t:"getNodesByParam", name:"getNodesByParam (key, value, parentNode)", iconSkin:"core", showAPI:true},
|
||||
{id:418, pId:4, t:"getNodesByParamFuzzy", name:"getNodesByParamFuzzy (key, value, parentNode)", iconSkin:"core", showAPI:true},
|
||||
{id:419, pId:4, t:"getSelectedNodes", name:"getSelectedNodes ()", iconSkin:"core", showAPI:true},
|
||||
{id:432, pId:4, t:"hideNode", name:"hideNode (node)", iconSkin:"hide", showAPI:true},
|
||||
{id:433, pId:4, t:"hideNodes", name:"hideNodes (nodes)", iconSkin:"hide", showAPI:true},
|
||||
{id:420, pId:4, t:"moveNode", name:"moveNode (targetNode, node, moveType, isSilent)", iconSkin:"edit", showAPI:true},
|
||||
{id:421, pId:4, t:"reAsyncChildNodes", name:"reAsyncChildNodes (parentNode, reloadType, isSilent, callback)", iconSkin:"core", showAPI:true},
|
||||
{id:437, pId:4, t:"reAsyncChildNodesPromise", name:"reAsyncChildNodesPromise(parentNode, reloadType, isSilent)", iconSkin:"core", showAPI:true},
|
||||
{id:422, pId:4, t:"refresh", name:"refresh ()", iconSkin:"core", showAPI:true},
|
||||
{id:423, pId:4, t:"removeChildNodes", name:"removeChildNodes (parentNode)", iconSkin:"core", showAPI:true},
|
||||
{id:424, pId:4, t:"removeNode", name:"removeNode (node, callbackFlag)", iconSkin:"core", showAPI:true},
|
||||
{id:425, pId:4, t:"selectNode", name:"selectNode (node, addFlag, isSilent)", iconSkin:"core", showAPI:true},
|
||||
{id:430, pId:4, t:"setChkDisabled", name:"setChkDisabled (node, disabled, inheritParent, inheritChildren)", iconSkin:"check", showAPI:true},
|
||||
{id:426, pId:4, t:"setEditable", name:"setEditable (editable)", iconSkin:"edit", showAPI:true},
|
||||
{id:434, pId:4, t:"showNode", name:"showNode (node)", iconSkin:"hide", showAPI:true},
|
||||
{id:435, pId:4, t:"showNodes", name:"showNodes (nodes)", iconSkin:"hide", showAPI:true},
|
||||
{id:427, pId:4, t:"transformToArray", name:"transformToArray (nodes)", iconSkin:"core", showAPI:true},
|
||||
{id:428, pId:4, t:"transformTozTreeNodes", name:"transformTozTreeNodes (simpleNodes)", iconSkin:"core", showAPI:true},
|
||||
{id:429, pId:4, t:"updateNode", name:"updateNode (node, checkTypeFlag)", iconSkin:"core", showAPI:true},
|
||||
{id:5, pId:0, name:"}"}
|
||||
];
|
||||
|
||||
apiContent.zTree_Setting = $.fn.zTree.init($("#settingTree"), $.fn.zTree._z.tools.clone(setting), setting_nodes);
|
||||
apiContent.zTree_Node = $.fn.zTree.init($("#treenodeTree"), $.fn.zTree._z.tools.clone(setting), treenode_nodes);
|
||||
apiContent.zTree_Function = $.fn.zTree.init($("#functionTree"), $.fn.zTree._z.tools.clone(setting), function_nodes);
|
||||
this.bindEvent();
|
||||
|
||||
},
|
||||
bindEvent: function() {
|
||||
$(document).bind("keydown", this.listenKeyDown)
|
||||
this.overlayCloseBtn.bind("click", apiContent.overlayClose);
|
||||
this.searchResultInput.bind("click", function(e) {
|
||||
$(this).prev().get(0).focus();
|
||||
this.blur();
|
||||
}).bind("focus", function(e) {
|
||||
this.blur();
|
||||
});
|
||||
this.searchKey.bind("focus", this.focusKey)
|
||||
.bind("blur", this.blurKey)
|
||||
.bind("propertychange", this.searchNode)
|
||||
.bind("input", this.searchNode);
|
||||
this.searchPrevBtn.bind("click", this.searchPrev);
|
||||
this.searchNextBtn.bind("click", this.searchNext);
|
||||
},
|
||||
setSameKey: function(value) {
|
||||
apiContent.searchKey.attr("value", value);
|
||||
},
|
||||
focusKey: function(e) {
|
||||
if (apiContent.searchKey.hasClass("empty")) {
|
||||
apiContent.searchKey.removeClass("empty");
|
||||
}
|
||||
},
|
||||
blurKey: function(e) {
|
||||
apiContent.setSameKey(e.target.value);
|
||||
if (e.target.value === "") {
|
||||
apiContent.searchKey.addClass("empty");
|
||||
}
|
||||
},
|
||||
listenKeyDown: function(e) {
|
||||
if (e.keyCode=="13" && apiContent.overlayDiv.is(":hidden")) {
|
||||
apiContent.openAPI();
|
||||
} else if (e.keyCode=="37") {
|
||||
apiContent.searchPrev();
|
||||
} else if (e.keyCode=="13" || e.keyCode=="39") {
|
||||
apiContent.searchNext();
|
||||
}
|
||||
},
|
||||
openAPI: function() {
|
||||
if (apiContent.searchNodes.length > 0) {
|
||||
var setting_zTree = $.fn.zTree.getZTreeObj("settingTree"),
|
||||
treenode_zTree = $.fn.zTree.getZTreeObj("treenodeTree"),
|
||||
function_zTree = $.fn.zTree.getZTreeObj("functionTree");
|
||||
if (apiContent.searchNodesCur < 0 || apiContent.searchNodesCur > apiContent.searchNodes.length -1) {
|
||||
apiContent.searchNodesCur = 0;
|
||||
}
|
||||
var node = apiContent.searchNodes[apiContent.searchNodesCur];
|
||||
|
||||
if (node.tId.indexOf("setting") > -1) {
|
||||
setting_zTree.selectNode(node);
|
||||
} else if (node.tId.indexOf("treenode") > -1) {
|
||||
treenode_zTree.selectNode(node);
|
||||
} else {
|
||||
function_zTree.selectNode(node);
|
||||
}
|
||||
apiContent.beforeClick(node.tId.substring(0, node.tId.indexOf("_")), node, true);
|
||||
apiContent.searchCur();
|
||||
}
|
||||
},
|
||||
searchNode: function(e) {
|
||||
var setting_zTree = $.fn.zTree.getZTreeObj("settingTree"),
|
||||
treenode_zTree = $.fn.zTree.getZTreeObj("treenodeTree"),
|
||||
function_zTree = $.fn.zTree.getZTreeObj("functionTree");
|
||||
if (apiContent.curKey == e.target.value) return;
|
||||
apiContent.curKey = e.target.value;
|
||||
var value = $.trim(apiContent.curKey);
|
||||
apiContent.setSameKey(apiContent.curKey);
|
||||
if (apiContent.searchKey.hasClass("empty")) {
|
||||
value = "";
|
||||
apiContent.searchResultInput.removeClass("noResult").attr("value","");
|
||||
}
|
||||
if (apiContent.lastValue === value) return;
|
||||
|
||||
apiContent.updateNodes(false);
|
||||
apiContent.lastValue = value;
|
||||
if (value === "" || value.length < 2) {
|
||||
apiContent.searchNodes = [];
|
||||
apiContent.searchNodesCur = -1;
|
||||
apiContent.searchCur(true);
|
||||
return;
|
||||
}
|
||||
|
||||
var settingNodeList = setting_zTree.getNodesByFilter(apiContent.searchFilter);
|
||||
var functionNodeList = function_zTree.getNodesByFilter(apiContent.searchFilter);
|
||||
var treenodeNodeList = treenode_zTree.getNodesByFilter(apiContent.searchFilter);
|
||||
apiContent.searchNodes = settingNodeList.concat(functionNodeList).concat(treenodeNodeList);
|
||||
apiContent.searchNodesCur = -1;
|
||||
apiContent.searchCur();
|
||||
apiContent.updateNodes(true);
|
||||
},
|
||||
searchFilter: function(node) {
|
||||
var value = $.trim(apiContent.searchKey.get(0).value).toLowerCase();
|
||||
return (node.showAPI && node.name.toLowerCase().indexOf(value) > -1);
|
||||
},
|
||||
searchPrev: function(e) {
|
||||
if (apiContent.searchPrevBtn.hasClass("disabled")) return;
|
||||
apiContent.searchNodesCur--;
|
||||
if (apiContent.searchNodesCur < 0 || apiContent.searchNodesCur > apiContent.searchNodes.length -1) {
|
||||
apiContent.searchNodesCur = apiContent.searchNodes.length -1;
|
||||
}
|
||||
apiContent.openAPI();
|
||||
},
|
||||
searchNext: function(e) {
|
||||
if (apiContent.searchNextBtn.hasClass("disabled")) return;
|
||||
apiContent.searchNodesCur++;
|
||||
apiContent.openAPI();
|
||||
},
|
||||
searchCur: function(init) {
|
||||
var result = apiContent.searchNodes;
|
||||
if (init) {
|
||||
apiContent.searchResultInput.removeClass("noResult").attr("value","");
|
||||
} else if (result.length == 0) {
|
||||
apiContent.searchResultInput.addClass("noResult").attr("value"," [ 0 / 0 ] ");
|
||||
} else {
|
||||
apiContent.searchResultInput.removeClass("noResult").attr("value"," [ " + (apiContent.searchNodesCur > -1 ? apiContent.searchNodesCur+1 : "?")+ " / " + result.length + " ] ");
|
||||
}
|
||||
if (result.length > 0) {
|
||||
apiContent.searchPrevBtn.removeClass("disabled");
|
||||
apiContent.searchNextBtn.removeClass("disabled");
|
||||
} else {
|
||||
apiContent.searchPrevBtn.addClass("disabled");
|
||||
apiContent.searchNextBtn.addClass("disabled");
|
||||
}
|
||||
},
|
||||
updateNodes: function(highlight) {
|
||||
var setting_zTree = $.fn.zTree.getZTreeObj("settingTree"),
|
||||
treenode_zTree = $.fn.zTree.getZTreeObj("treenodeTree"),
|
||||
function_zTree = $.fn.zTree.getZTreeObj("functionTree"),
|
||||
node = null;
|
||||
for( var i=0, l=apiContent.searchNodes.length; i<l; i++) {
|
||||
node = apiContent.searchNodes[i];
|
||||
if (node.level > 0) {
|
||||
node.highlight = highlight;
|
||||
if (node.tId.indexOf("setting") > -1) {
|
||||
setting_zTree.updateNode(node);
|
||||
} else if (node.tId.indexOf("treenode") > -1) {
|
||||
treenode_zTree.updateNode(node);
|
||||
} else {
|
||||
function_zTree.updateNode(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
getFontCss: function(treeId, treeNode) {
|
||||
return (!!treeNode.highlight) ? {color:"#A60000", "font-weight":"bold"} : {color:"#333", "font-weight":"normal"};
|
||||
},
|
||||
getTitle: function(treeId, node) {
|
||||
var t = [], n = node;
|
||||
while (n && !!n.t) {
|
||||
t.push(n.t);
|
||||
n = n.getParentNode();
|
||||
}
|
||||
t = t.reverse();
|
||||
node.tt = t.join('.');
|
||||
return true;
|
||||
},
|
||||
showIcon: function(treeId, node) {
|
||||
return (!!node.iconSkin);
|
||||
},
|
||||
onNodeCreated: function (e, treeId, node) {
|
||||
var a = $("#" + node.tId + "_a");
|
||||
if (node.showAPI) {
|
||||
a.attr("rel", "#overlayDiv");
|
||||
} else {
|
||||
a.css({cursor: "default"});
|
||||
}
|
||||
},
|
||||
beforeClick: function (treeId, node, noClear) {
|
||||
if (!node.showAPI) return false;
|
||||
var o = $("#" + node.tId + "_a");
|
||||
if (!!apiContent.apiCache[node.tId]) {
|
||||
apiContent.tmpDiv.html(apiContent.apiCache[node.tId]);
|
||||
apiContent.overlayShow(o, (apiContent.lastNode === node));
|
||||
} else {
|
||||
apiContent.overlayAjax(treeId, node);
|
||||
}
|
||||
apiContent.lastNode = node;
|
||||
if (node.tId.indexOf("settingTree")>-1) {
|
||||
apiContent.settingDiv.removeClass("right").addClass("left");
|
||||
apiContent.functionDiv.removeClass("left").addClass("right");
|
||||
} else {
|
||||
apiContent.settingDiv.removeClass("left").addClass("right");
|
||||
apiContent.functionDiv.removeClass("right").addClass("left");
|
||||
}
|
||||
|
||||
if (!noClear) {
|
||||
apiContent.clearSelectedNode();
|
||||
}
|
||||
return true;
|
||||
},
|
||||
clearSelectedNode: function() {
|
||||
apiContent.zTree_Setting.cancelSelectedNode();
|
||||
apiContent.zTree_Node.cancelSelectedNode();
|
||||
apiContent.zTree_Function.cancelSelectedNode();
|
||||
},
|
||||
overlayAutoClose: function(e) {
|
||||
var eId = e.target.id, eRel = e.target.getAttribute("rel"), eClass = e.target.className;
|
||||
if (eId === "overlayDiv" || eId === "overlayDivArrow" || eClass.indexOf("searchPrev") > -1 || eClass.indexOf("searchNext") > -1 || !!eRel) return;
|
||||
if (!$(e.target).parents("[rel]").length && !$(e.target).parents("#overlayDiv").length) {
|
||||
apiContent.overlayClose();
|
||||
}
|
||||
},
|
||||
overlayClose: function() {
|
||||
var o = apiContent.overlayDiv;
|
||||
o.stop();
|
||||
apiContent.clearSelectedNode();
|
||||
if (ie) {
|
||||
o.hide();
|
||||
} else {
|
||||
setTimeout(function() {o.fadeTo("fast", 0, function(){o.hide();})}, 200);
|
||||
}
|
||||
$(document).unbind("click", apiContent.overlayAutoClose);
|
||||
},
|
||||
overlayShow: function(target, isSameNode) {
|
||||
var w = $(window), o = apiContent.overlayDiv, a = apiContent.overlayArrow,
|
||||
oc = apiContent.overlayContent, c = apiContent.contentBoxDiv,
|
||||
t = target.offset().top - 30,
|
||||
cMaxLeft = c.offset().left + c.outerWidth({margin:true}) - o.outerWidth({margin:true}) - 10,
|
||||
l = Math.min(cMaxLeft, target.offset().left + target.width() + 40),
|
||||
arrowT = target.offset().top + 16,
|
||||
wMinTop = 100, footerHeight = 50, onlyFade = false,
|
||||
wHeight = w.height(), wScrollTop=w.scrollTop(), wMaxTop = wHeight + wScrollTop - footerHeight;
|
||||
if (!apiContent.overlayMaxTop) {
|
||||
apiContent.overlayMaxTop = apiContent.contentBoxDiv.offset().top + apiContent.contentBoxDiv.height();
|
||||
}
|
||||
o.stop();
|
||||
if (o.css("display") !== "block") {
|
||||
o.css({top: t, left: l});
|
||||
a.css({top:arrowT - t});
|
||||
$(document).bind("click", apiContent.overlayAutoClose);
|
||||
}
|
||||
if (ie) {
|
||||
onlyFade = true;
|
||||
o.show();
|
||||
} else {
|
||||
o.fadeTo("fast", 1);
|
||||
}
|
||||
|
||||
var h = apiContent.tmpDiv.outerHeight({margin:true}) + apiContent.overlaySearch.outerHeight();
|
||||
if ((t + h) > wMaxTop) {
|
||||
t = wMaxTop - h;
|
||||
}
|
||||
if ((t + h) > apiContent.overlayMaxTop) {
|
||||
t = apiContent.overlayMaxTop - h;
|
||||
}
|
||||
t = Math.max(t, wScrollTop, wMinTop);
|
||||
if ((t + h) > ($("body").height()-footerHeight-20)) {
|
||||
o.css("padding-bottom", footerHeight + "px");
|
||||
} else {
|
||||
o.css("padding-bottom", "0");
|
||||
}
|
||||
apiContent.overlayDetailDiv.empty();
|
||||
apiContent.overlayDetailDiv.append(apiContent.tmpDiv.children());
|
||||
if (!onlyFade) {
|
||||
onlyFade = (isSameNode && t === parseInt(o.css("top").replace("px", "")));
|
||||
}
|
||||
|
||||
a.removeClass("reverse");
|
||||
if ( (arrowT - t) > (h-55) ) {
|
||||
a.addClass("reverse");
|
||||
arrowT -= 55;
|
||||
}
|
||||
|
||||
if (onlyFade) {
|
||||
o.css({top: t, left: l});
|
||||
oc.css({height: h});
|
||||
a.css({top:arrowT - t});
|
||||
} else {
|
||||
o.animate({top: t, left: l}, {duration: "normal",easing: "swing", complete:null});
|
||||
oc.animate({height: h}, {duration: "fast",easing: "swing", complete:null});
|
||||
a.animate({top:arrowT - t}, {duration: "normal",easing: "linear", complete:null});
|
||||
}
|
||||
},
|
||||
overlayAjax: function(treeId, node) {
|
||||
var o = $("#" + node.tId + "_a");
|
||||
if (node.isAjax) return;
|
||||
node.isAjax = true;
|
||||
$.ajax({
|
||||
type: "get",
|
||||
url: "" + lang + "/" + node.tt.replace("$.", "") + ".html",
|
||||
data: null,
|
||||
dataType: "text",
|
||||
success: function(msg) {
|
||||
if (!apiContent.tmpDiv) {
|
||||
var tmpDiv = $(document.createElement("div"));
|
||||
tmpDiv.addClass("baby_overlay_tmp");
|
||||
$("body").append(tmpDiv)
|
||||
apiContent.tmpDiv = $(document.createElement("div"));
|
||||
apiContent.tmpDiv.addClass("details");
|
||||
tmpDiv.append(apiContent.tmpDiv);
|
||||
|
||||
} else {
|
||||
apiContent.tmpDiv.empty();
|
||||
}
|
||||
apiContent.tmpDiv.html(msg);
|
||||
apiContent.overlayShow(o, false);
|
||||
apiContent.apiCache[node.tId] = msg;
|
||||
node.isAjax = false;
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
||||
alert(ajaxMsg)
|
||||
if (apiContent.tmpDiv) apiContent.tmpDiv.empty();
|
||||
node.isAjax = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,218 @@
|
||||
/* Resets */
|
||||
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td {
|
||||
margin: 0;padding: 0;border: 0;outline: 0;font-weight: inherit;font-style: inherit;font-size: 100%;font-family: inherit;vertical-align: baseline;}
|
||||
:focus {outline: 0;}
|
||||
body {color: #2f332a;font: 15px/21px Arial, Helvetica, simsun, sans-serif;background: #528036 url(img/background.jpg) no-repeat fixed 0 0;}
|
||||
p {padding-bottom: 20px;}
|
||||
ol, ul {list-style: none;}
|
||||
table {border-collapse: separate;border-spacing: 0;}
|
||||
caption, th, td {text-align: left;font-weight: normal;}
|
||||
strong {font-weight: bold;}
|
||||
em {font-style: italic;}
|
||||
hr {display: none;}
|
||||
.font1 {color: white;background-color: #528036;}
|
||||
.right {float: right;}
|
||||
.left {float: left;}
|
||||
.hide {display: none;}
|
||||
.round {-moz-border-radius: 15px;-webkit-border-radius: 15px;-khtml-border-radius: 15px;border-radius: 15px;}
|
||||
.clear {clear: both;}
|
||||
.clearfix {display: block;}
|
||||
.clearfix:after {content: ".";display: block;clear: both;visibility: hidden;line-height: 0;height: 0;}
|
||||
html[xmlns] .clearfix {display: block;}
|
||||
* html .clearfix {height: 1%;}
|
||||
|
||||
/* Link Styles */
|
||||
a {color: #528036;}
|
||||
a:link, a:visited {text-decoration: none;}
|
||||
a:hover {color: #000;text-decoration: none;}
|
||||
a:active {text-decoration: none;}
|
||||
|
||||
/* Headings */
|
||||
h1, h2, h3, h4, h5, h6 {color: #2f332a;font-weight: bold;font-family: Helvetica, Arial, simsun, sans-serif;padding-bottom: 5px;}
|
||||
h1 {font-size: 36px;line-height: 44px;}
|
||||
h2 {font-size: 20px;line-height: 20px;}
|
||||
h3 {font-size: 14px;line-height: 14px;}
|
||||
h4 {font-size: 14px;font-weight: normal;line-height: 25px;}
|
||||
|
||||
/* Wraps */
|
||||
.header_wrap {position: relative;min-width: 940px;padding: 100px 30px 0 30px;}
|
||||
.content_wrap {position: relative;min-width: 940px;padding: 0 30px 50px 30px;}
|
||||
.footer_wrap {bottom: 0;height: 47px;width: 100%;background-color: #1b1b1b;border-top: 1px solid #749e58;}
|
||||
|
||||
/* Header */
|
||||
.header {position: relative;width: 940px;margin: 0 auto;height: 160px;border: 1px solid white;background: transparent url(img/header-bg.png) repeat-x 0 -50px;}
|
||||
.header-text {padding: 40px 25px 15px 120px;font-size: 18px;line-height: 24px;color: #747d67;font-family: Helvetica, sans-serif;}
|
||||
.header-text img {padding-bottom: 5px;}
|
||||
.shortcuts {white-space: nowrap;text-align: right;position: absolute;top: -45px;right: 5px;}
|
||||
.shortcuts.language {top: -85px;right:0px;}
|
||||
.shortcuts li {display: inline;font-size: 18px;line-height: 28px;font-family: Helvetica, Arial, simsun, sans-serif;padding-bottom: 5px;margin-left: 30px;cursor: pointer;}
|
||||
.shortcuts li button {cursor: pointer;}
|
||||
.shortcuts li span {border-bottom: 1px dotted white;}
|
||||
.shortcuts li span.selected {padding: 2px;background-color: #528036;}
|
||||
.shortcuts li a {color: #fff;}
|
||||
.ieSuggest {display:none;font-size: 12px;color: silver;position: absolute;left: 10px;top: 2px;}
|
||||
.light-bulb {position: absolute;left: -20px;bottom: -35px;width:116px;height:180px;background-image:url(img/lightbulb.png);background-repeat: no-repeat;}
|
||||
|
||||
/* Content */
|
||||
.content {position: relative;width: 940px;margin: 0 auto;}
|
||||
.nav_section {position: relative;height: 20px;font-family: "Myriad Pro", "Trebuchet MS", sans-serif;font-size: 15px;color: #253;padding: 20px 0;}
|
||||
.nav_section ul {position: absolute;right: 10px;}
|
||||
.nav_section ul li {display: inline;line-height: 20px;margin: 0 5px 0 20px;border-bottom: 1px dotted white;}
|
||||
.nav_section ul li.noline {border-bottom: 0;}
|
||||
.nav_section ul li a {color: #fff;}
|
||||
.nav_section ul li a.selected {padding: 2px;background-color: #528036;}
|
||||
.nav_section ul li.first {border: none;}
|
||||
.content .title {margin: 50px 30px 20px 70px;}
|
||||
.content li {margin-bottom: 5px;}
|
||||
.contentBox {position: relative;overflow: hidden;border: 1px solid white;min-height: 200px;line-height: 25px;background: transparent url(img/contact-bg.png) repeat-x 0 0;}
|
||||
|
||||
.zTreeInfo {display:none;width: 940px;position: absolute;}
|
||||
.zTreeInfo p {padding-bottom: 50px;}
|
||||
.zTreeInfo-left {float: left;width: 280px;height:300px;padding: 0 50px 60px 75px;background:url(img/zTreeIntroduction.jpg) no-repeat 30px 30px;}
|
||||
.zTreeInfo-right {position: relative;float: right;width: 475px;padding: 0 50px 60px 0;}
|
||||
.zTreeInfo-right li {font-size: 12px;list-style-type: disc;}
|
||||
|
||||
.license {display:none;width: 940px;position: absolute;}
|
||||
|
||||
.donateInfo {display:block;width: 940px;position: absolute;}
|
||||
|
||||
.links {display:none;width: 940px;position: absolute;}
|
||||
.links .content {float: left;width: 160px;height:200px;padding: 0 10px 10px 2px;text-align: center;}
|
||||
.links .content.first {margin-left: 30px;}
|
||||
|
||||
.contact {display:none;width: 940px;position: absolute;}
|
||||
.contact .myhome { position: absolute; top:10px; left:620px; width:300px; height:266px; background: transparent url(img/myhome.gif) scroll no-repeat 0 0;}
|
||||
|
||||
.siteTag {position: absolute;left: -16px;top: 109px;z-index: 10;width: 65px;height: 46px;padding:0;margin:0 10px 0 0;
|
||||
vertical-align:middle;border:0 none;background: transparent url(img/siteTag.png) scroll no-repeat 0 0;}
|
||||
.siteTag.tag_zTreeInfo {background-position: 0 0}
|
||||
.siteTag.tag_license {background-position: 0 -46px}
|
||||
.siteTag.tag_donate {background-position: 0 -92px}
|
||||
.siteTag.tag_contact {background-position: 0 -138px}
|
||||
|
||||
.apiContent {width: 940px;}
|
||||
.apiContent .right {float: right;padding-right: 100px;}
|
||||
.apiContent .left {float: left;padding-right: 20px;border-right: 1px dotted silver;}
|
||||
.api_setting {position: relative;margin:20px 0 20px 20px;}
|
||||
.api_function {position: relative;margin:20px 0 20px 30px;padding-right: 10px;}
|
||||
.api_content_title {text-align: center;font-weight: bold;}
|
||||
|
||||
.demoContent {width: 940px;}
|
||||
.demoContent .right {float: right;padding: 20px;width: 600px;}
|
||||
.demoContent .left {float: left;padding: 20px;}
|
||||
.demoContent iframe {width:600px;min-height: 530px;}
|
||||
|
||||
.faqContent {width: 940px;}
|
||||
.faqContent .right {float: right;padding: 20px;width: 600px;}
|
||||
.faqContent .left {float: left;padding: 20px;}
|
||||
.faqContent iframe {width:600px;min-height: 300px;}
|
||||
|
||||
.baby_overlay_tmp {position: absolute;top:0; left:-5000px;display:block;visibility: hidden;width:640px;font-size:11px;}
|
||||
.baby_overlay_tmp .details {padding: 20px;}
|
||||
.baby_overlay {display:none;position:absolute;z-index:99;left:0; top:0;width:640px;color:#fff;font-size:11px;}
|
||||
.baby_overlay .content {width:100%; height:100px;overflow: hidden;background: transparent url(img/overlay_bg.png) scroll repeat 0 0;}
|
||||
.baby_overlay .details {padding:0 20px 20px 20px;}
|
||||
.baby_overlay .close {background-image:url(img/close.png);position:absolute; right:5px; top:5px;cursor:pointer;height:36px;width:36px;}
|
||||
.baby_overlay_arrow {background-image:url(img/overlay_arrow.png);background-position:0 0;position:absolute;height:40px;width:40px;left: -40px;}
|
||||
.baby_overlay_arrow.reverse {background-position:0 -40px;}
|
||||
|
||||
/* Footer */
|
||||
.footer {position: relative;min-width: 1000px;font: 14px/24px arial, helvetica, sans-serif;}
|
||||
.footer ul {position:absolute;left: 0px;border:1px solid #393939;background:#262626;padding:12px 0px;line-height: 18px;display: none;list-style: none;}
|
||||
.footer ul li a {display:block;padding: 2px 15px;color: #9c9c9c;text-indent: 0;}
|
||||
.footer ul li a:hover {text-decoration:none;color: #fff;}
|
||||
.footer-logo {position:absolute;margin: 10px 0 0 30px;width:122px; height:24px;top:0; left:0;background: transparent url(img/footer-logo.png) no-repeat 0 0;}
|
||||
.footer_mii {position: absolute;right: 558px;top: 8px;z-index: 10;padding: 4px 0;}
|
||||
.footer_mii a {font-size:10px;color:#649140}
|
||||
.footer_mii a:hover {color:#B6D76F}
|
||||
.footer_siteMap {position: absolute;right: 358px;top: 8px;width: 155px;z-index: 10;padding: 4px 0;}
|
||||
.footer_siteMap .footer_siteMap_header {width:155px;text-indent: -9999px;background: transparent url(img/footer_siteMap.gif) no-repeat 0 0;}
|
||||
.footer_siteMap ul {top:-202px;width:180px;}
|
||||
.footer_siteMap:hover ul {left: 0}
|
||||
.footer_contact {position: absolute;right: 193px;top: 8px;width: 155px;z-index: 10;padding: 4px 0;}
|
||||
.footer_contact .footer_contact_header {width:155px;text-indent: -9999px;background: transparent url(img/footer_contact.gif) no-repeat 0px 0px;}
|
||||
.footer_contact ul {top:-113px;width:153px;}
|
||||
.footer_contact:hover ul {left: 0}
|
||||
.footer_download {position: absolute;right: 60px;top: 8px;width: 123px;z-index: 10;padding: 4px 0;}
|
||||
.footer_download .footer_download_header {width:123px;text-indent: -9999px;background: transparent url(img/footer_download.png) no-repeat 0px 0px;}
|
||||
.footer_download ul {top:-113px;width:140px;}
|
||||
.footer_download:hover ul {left: 0}
|
||||
|
||||
/* button icon */
|
||||
button {vertical-align:middle;border:0 none;background: transparent no-repeat 0 0 scroll;}
|
||||
|
||||
.shortcuts button.ico {width:24px; height:24px;padding:0; margin:0 10px 0 0;background-image:url(img/menuIcon.png)}
|
||||
.shortcuts button.home {background-position: 0 0}
|
||||
.shortcuts button.demo {background-position: 0 -24px}
|
||||
.shortcuts button.api {background-position: 0 -48px}
|
||||
.shortcuts button.faq {background-position: 0 -72px}
|
||||
.shortcuts button.donate {background-position: 0 -144px}
|
||||
.shortcuts button.download {background-position: 0 -96px}
|
||||
.shortcuts button.face {background-position: 0 -120px}
|
||||
.shortcuts button.cn {width:48px; height:24px;padding:0; margin:0 10px 0 0;background-image:url(img/chinese.png)}
|
||||
.shortcuts button.en {width:48px; height:24px;padding:0; margin:0 10px 0 0;background-image:url(img/english.png)}
|
||||
|
||||
.content button.ico {width:24px; height:24px;padding:0; margin:0 10px 0 0;}
|
||||
|
||||
.content button.ico16 {width:16px; height:16px;padding:0; margin:0 5px 0 0;background-image:url("img/apiMenu.png");}
|
||||
button.z_core {margin-top: -4px;background-position:0 0;}
|
||||
button.z_check {margin-top: -4px;background-position:0 -16px;}
|
||||
button.z_edit {margin-top: -4px;background-position:0 -32px;}
|
||||
button.z_hide {margin-top: -4px;background-position:0 -64px;}
|
||||
button.z_search {margin-top: -4px;background-position:0 -48px;}
|
||||
button.searchPrev {margin-top: -4px;background-position:-16px 0;cursor:pointer}
|
||||
button.searchNext {margin-top: -4px;background-position:-16px -16px;cursor:pointer}
|
||||
button.searchPrev.disabled {margin-top: -4px;background-position:-16px -32px;cursor:auto}
|
||||
button.searchNext.disabled {margin-top: -4px;background-position:-16px -48px;cursor:auto}
|
||||
input.search {margin:0;padding:2px 0; border:0;}
|
||||
input.searchKey {width:150px;}
|
||||
input.searchResult {margin-left:-3px;width:65px;text-align:right;background-color:white;color:#707070}
|
||||
input.searchResult.noResult {background-color:#ff6666;color:black}
|
||||
.baby_overlay div.overlaySearch {text-align:right;padding-right:50px;padding-top:12px;}
|
||||
|
||||
/* api overlay*/
|
||||
.apiDetail .topLine {border-top: 1px dashed #376B29;margin-top: 5px;padding-top: 5px;}
|
||||
.apiDetail .highlight_red {color:#A60000;}
|
||||
.apiDetail .highlight_green {color:#A7F43D;}
|
||||
.apiDetail h1, .apiDetail h2, .apiDetail h3, .apiDetail h4, .apiDetail h5, .apiDetail h6 {color: white;padding: 0;}
|
||||
.apiDetail h2 {color: #A7F43D;margin: 5px auto;padding: 5px;font-size: 20px;}
|
||||
.apiDetail h2 span {font-size: 14px;float: right;font-weight: normal;margin: 2px 20px 0 0;vertical-align: bottom;}
|
||||
.apiDetail h2 span.path {float: left;margin: 2px 0 0 0;vertical-align: bottom;}
|
||||
.apiDetail h3 {margin: 5px auto;padding: 5px;font-size: 14px;font-weight: normal;}
|
||||
.apiDetail h3 span.h3_info {margin-left: 20px;font-size: 12px;}
|
||||
.apiDetail h4 {margin: 0 auto;padding: 0 5px;font-size: 12px;font-weight: normal;line-height: 16px;}
|
||||
.apiDetail .desc h4 {color: black;}
|
||||
.apiDetail h4 b{width: 150px;display:inline-block;}
|
||||
.apiDetail h4 span{width: 230px;display:inline-block;}
|
||||
|
||||
.apiDetail pre, .apiDetail .desc {background: #E8FCD6;color: black;margin: 10px;padding: 10px;display: block;}
|
||||
.apiDetail pre {word-wrap: break-word;}
|
||||
.apiDetail p{margin-left: 5px;padding: 0;}
|
||||
.apiDetail .longdesc {margin-top: 5px;}
|
||||
.apiDetail .longdesc p{font-size: 12px;line-height:1.5;margin:3px 0;}
|
||||
.apiDetail .longdesc b{font-size: 14px;}
|
||||
.apiDetail table {border-collapse:collapse;}
|
||||
.apiDetail table td {border:1px solid silver;text-align: center;vertical-align: middle;}
|
||||
.apiDetail table thead td {font-weight: bold}
|
||||
|
||||
.apiDetail button {width:16px; height:16px; vertical-align:middle; border:0 none; cursor: pointer;
|
||||
background-color:transparent; background-repeat:no-repeat; background-attachment: scroll;
|
||||
background-image:url("zTreeStyle/img/zTreeStandard.png");}
|
||||
|
||||
.apiDetail button.chk {width:13px; height:13px; margin:0 3px 2px 0; cursor: auto}
|
||||
.apiDetail button.chk.checkbox_false_full {background-position:0 0}
|
||||
.apiDetail button.chk.checkbox_false_full_focus {background-position:0 -14px}
|
||||
.apiDetail button.chk.checkbox_false_part {background-position:0 -28px}
|
||||
.apiDetail button.chk.checkbox_false_part_focus {background-position:0 -42px}
|
||||
.apiDetail button.chk.checkbox_true_full {background-position:-14px 0}
|
||||
.apiDetail button.chk.checkbox_true_full_focus {background-position:-14px -14px}
|
||||
.apiDetail button.chk.checkbox_true_part {background-position:-14px -28px}
|
||||
.apiDetail button.chk.checkbox_true_part_focus {background-position:-14px -42px}
|
||||
.apiDetail button.chk.radio_false_full {background-position:-28px 0}
|
||||
.apiDetail button.chk.radio_false_full_focus {background-position:-28px -14px}
|
||||
.apiDetail button.chk.radio_false_part {background-position:-28px -28px}
|
||||
.apiDetail button.chk.radio_false_part_focus {background-position:-28px -42px}
|
||||
.apiDetail button.chk.radio_true_full {background-position:-42px 0}
|
||||
.apiDetail button.chk.radio_true_full_focus {background-position:-42px -14px}
|
||||
.apiDetail button.chk.radio_true_part {background-position:-42px -28px}
|
||||
.apiDetail button.chk.radio_true_part_focus {background-position:-42px -42px}
|
||||
@@ -0,0 +1,23 @@
|
||||
* html{
|
||||
/* background-image:url(about:blank);*/
|
||||
background-attachment:fixed;
|
||||
}
|
||||
html pre {word-wrap: break-word}
|
||||
.header {background-image: none;background-color: #F0F6E4;}
|
||||
|
||||
.ieSuggest {display:block;}
|
||||
.shortcuts button.cn {filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='apiCss/img/chinese.png');background-image: none;}
|
||||
.shortcuts button.en {filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='apiCss/img/english.png');background-image: none;}
|
||||
|
||||
.light-bulb {filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='apiCss/img/lightbulb.png');background-image: none;}
|
||||
.contentBox {background-image: none;background-color: #F0F6E4;}
|
||||
.zTreeInfo {background-image: none;background-color: #F0F6E4;}
|
||||
|
||||
.content button.ico16 {*background-image:url("img/apiMenu.gif")}
|
||||
.siteTag {background-image: none;}
|
||||
.apiContent .right {float: right;padding-right: 50px;}
|
||||
|
||||
div.baby_overlay {background-color: #3C6E31;background-image:none;color:#fff;}
|
||||
div.baby_overlay .close {filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='apiCss/img/overlay_close_IE6.gif');background-image: none;}
|
||||
.baby_overlay_arrow {background-image:url(img/overlay_arrow.gif);}
|
||||
.apiDetail button {background-image:url("img/zTreeStandard.gif")}
|
||||
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 3.9 KiB |