parent
							
								
									43f0c9a5c4
								
							
						
					
					
						commit
						be03878e94
					
				@ -0,0 +1,49 @@ | 
				
			|||||||
 | 
					# Wusthelper-backend | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					武科大助手后端项目 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					应该是第三代后端了吧。 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					新的重写过的后端,其实在这版正式出来之前已经有很多个实验性的原型版本了,但是都因为效果不如意胎死腹中给砍了,没有继续写下去(其实这个readme也是曾经最早的一个原型版本改来的) | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					这代后端结构与前面的有很大不同,使用了真·多模块的方式运行部署,部分独立模块以不同的程序运行,子模块部署在内网时,可以自动注册frpc进行服务远程转发,主服务和子服务通过http进行通信调用,各模块可以部署在不同的服务器或容器中,当然,也可以挤在一起跑。 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					因为基于http的json通信,因此可以跨语言语言进行调用这些子服务,若某个模块使用某种语言有比较大的优势(如网关服务可用go或node等进行开发),可以尝试直接用其他语言进行替换,只需要开发时遵循文档即可 | 
				
			||||||
 | 
					~~(虽然现在并没有什么文档之类的(但是以后会补上来的啦))~~。 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					当某模块更新或下线时,可以在不重启整个项目的情况下进行更新,同时如果有多个实例部署,可及时切换到可用节点上,从而避免整个项目的完全重启而导致服务完全中断,只要对外api网关模块仍在运行,就可使用仍在运行的模块继续提供一定的服务,提高可用性,同时由于各个模块被拆分,因此相较于以前更为轻量,在模块更新或重启时也能更快的恢复服务 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					该项目意在探索新技术,同时提高后端服务的可用性 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@lensferno | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					--- | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## 环境要求 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					包管理和构建: | 
				
			||||||
 | 
					Maven 3.8.2+ | 
				
			||||||
 | 
					- 后续可能会看情况转用Gradle | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Java版本: | 
				
			||||||
 | 
					Java 17+ | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					--- | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## 项目模块结构 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### agent-service | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					--- | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## 关于Mywust库的导入问题 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					--- | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## 文档 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					详见[doc](/doc) | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					--- | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					就先这样吧,手累了 | 
				
			||||||
@ -1,4 +1,4 @@ | 
				
			|||||||
package cn.wustlinghang; | 
					package cn.wustlinghang.data; | 
				
			||||||
 | 
					
 | 
				
			||||||
public class Main { | 
					public class Main { | 
				
			||||||
    public static void main(String[] args) { | 
					    public static void main(String[] args) { | 
				
			||||||
@ -0,0 +1,38 @@ | 
				
			|||||||
 | 
					target/ | 
				
			||||||
 | 
					!.mvn/wrapper/maven-wrapper.jar | 
				
			||||||
 | 
					!**/src/main/**/target/ | 
				
			||||||
 | 
					!**/src/test/**/target/ | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### IntelliJ IDEA ### | 
				
			||||||
 | 
					.idea/modules.xml | 
				
			||||||
 | 
					.idea/jarRepositories.xml | 
				
			||||||
 | 
					.idea/compiler.xml | 
				
			||||||
 | 
					.idea/libraries/ | 
				
			||||||
 | 
					*.iws | 
				
			||||||
 | 
					*.iml | 
				
			||||||
 | 
					*.ipr | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### Eclipse ### | 
				
			||||||
 | 
					.apt_generated | 
				
			||||||
 | 
					.classpath | 
				
			||||||
 | 
					.factorypath | 
				
			||||||
 | 
					.project | 
				
			||||||
 | 
					.settings | 
				
			||||||
 | 
					.springBeans | 
				
			||||||
 | 
					.sts4-cache | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### NetBeans ### | 
				
			||||||
 | 
					/nbproject/private/ | 
				
			||||||
 | 
					/nbbuild/ | 
				
			||||||
 | 
					/dist/ | 
				
			||||||
 | 
					/nbdist/ | 
				
			||||||
 | 
					/.nb-gradle/ | 
				
			||||||
 | 
					build/ | 
				
			||||||
 | 
					!**/src/main/**/build/ | 
				
			||||||
 | 
					!**/src/test/**/build/ | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### VS Code ### | 
				
			||||||
 | 
					.vscode/ | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### Mac OS ### | 
				
			||||||
 | 
					.DS_Store | 
				
			||||||
@ -0,0 +1,98 @@ | 
				
			|||||||
 | 
					<?xml version="1.0" encoding="UTF-8"?> | 
				
			||||||
 | 
					<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> | 
				
			||||||
 | 
					    <parent> | 
				
			||||||
 | 
					        <groupId>cn.wustlinghang.wusthelper</groupId> | 
				
			||||||
 | 
					        <artifactId>backend-main</artifactId> | 
				
			||||||
 | 
					        <version>${revision}</version> | 
				
			||||||
 | 
					    </parent> | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <artifactId>backend-web</artifactId> | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <properties> | 
				
			||||||
 | 
					        <maven.compiler.source>17</maven.compiler.source> | 
				
			||||||
 | 
					        <maven.compiler.target>17</maven.compiler.target> | 
				
			||||||
 | 
					        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        <springboot.version>3.1.1</springboot.version> | 
				
			||||||
 | 
					        <snakeyaml.version>2.0</snakeyaml.version> | 
				
			||||||
 | 
					        <feign.version>4.0.3</feign.version> | 
				
			||||||
 | 
					    </properties> | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <dependencyManagement> | 
				
			||||||
 | 
					        <dependencies> | 
				
			||||||
 | 
					            <!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-dependencies --> | 
				
			||||||
 | 
					            <dependency> | 
				
			||||||
 | 
					                <groupId>org.springframework.boot</groupId> | 
				
			||||||
 | 
					                <artifactId>spring-boot-dependencies</artifactId> | 
				
			||||||
 | 
					                <version>${springboot.version}</version> | 
				
			||||||
 | 
					                <type>pom</type> | 
				
			||||||
 | 
					                <scope>import</scope> | 
				
			||||||
 | 
					            </dependency> | 
				
			||||||
 | 
					        </dependencies> | 
				
			||||||
 | 
					    </dependencyManagement> | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <dependencies> | 
				
			||||||
 | 
					        <!-- 清除springboot的依赖引入的漏洞警告,直接提升版本消除 --> | 
				
			||||||
 | 
					        <dependency> | 
				
			||||||
 | 
					            <groupId>org.yaml</groupId> | 
				
			||||||
 | 
					            <artifactId>snakeyaml</artifactId> | 
				
			||||||
 | 
					            <version>${snakeyaml.version}</version> | 
				
			||||||
 | 
					        </dependency> | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        <dependency> | 
				
			||||||
 | 
					            <groupId>org.springframework.boot</groupId> | 
				
			||||||
 | 
					            <artifactId>spring-boot-starter-validation</artifactId> | 
				
			||||||
 | 
					        </dependency> | 
				
			||||||
 | 
					        <dependency> | 
				
			||||||
 | 
					            <groupId>org.springframework.boot</groupId> | 
				
			||||||
 | 
					            <artifactId>spring-boot-starter-web</artifactId> | 
				
			||||||
 | 
					        </dependency> | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        <dependency> | 
				
			||||||
 | 
					            <groupId>org.springframework.cloud</groupId> | 
				
			||||||
 | 
					            <artifactId>spring-cloud-starter-openfeign</artifactId> | 
				
			||||||
 | 
					            <version>${feign.version}</version> | 
				
			||||||
 | 
					        </dependency> | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        <dependency> | 
				
			||||||
 | 
					            <groupId>com.mysql</groupId> | 
				
			||||||
 | 
					            <artifactId>mysql-connector-j</artifactId> | 
				
			||||||
 | 
					            <scope>runtime</scope> | 
				
			||||||
 | 
					        </dependency> | 
				
			||||||
 | 
					        <dependency> | 
				
			||||||
 | 
					            <groupId>org.projectlombok</groupId> | 
				
			||||||
 | 
					            <artifactId>lombok</artifactId> | 
				
			||||||
 | 
					            <optional>true</optional> | 
				
			||||||
 | 
					            <scope>provided</scope> | 
				
			||||||
 | 
					        </dependency> | 
				
			||||||
 | 
					        <dependency> | 
				
			||||||
 | 
					            <groupId>org.springframework.boot</groupId> | 
				
			||||||
 | 
					            <artifactId>spring-boot-starter-test</artifactId> | 
				
			||||||
 | 
					            <scope>test</scope> | 
				
			||||||
 | 
					        </dependency> | 
				
			||||||
 | 
					    </dependencies> | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <build> | 
				
			||||||
 | 
					        <plugins> | 
				
			||||||
 | 
					            <plugin> | 
				
			||||||
 | 
					                <groupId>org.graalvm.buildtools</groupId> | 
				
			||||||
 | 
					                <artifactId>native-maven-plugin</artifactId> | 
				
			||||||
 | 
					            </plugin> | 
				
			||||||
 | 
					            <plugin> | 
				
			||||||
 | 
					                <groupId>org.springframework.boot</groupId> | 
				
			||||||
 | 
					                <artifactId>spring-boot-maven-plugin</artifactId> | 
				
			||||||
 | 
					                <configuration> | 
				
			||||||
 | 
					                    <excludes> | 
				
			||||||
 | 
					                        <exclude> | 
				
			||||||
 | 
					                            <groupId>org.projectlombok</groupId> | 
				
			||||||
 | 
					                            <artifactId>lombok</artifactId> | 
				
			||||||
 | 
					                        </exclude> | 
				
			||||||
 | 
					                    </excludes> | 
				
			||||||
 | 
					                </configuration> | 
				
			||||||
 | 
					            </plugin> | 
				
			||||||
 | 
					        </plugins> | 
				
			||||||
 | 
					    </build> | 
				
			||||||
 | 
					</project> | 
				
			||||||
@ -1,7 +0,0 @@ | 
				
			|||||||
package cn.wustlinghang; | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public class Main { | 
					 | 
				
			||||||
    public static void main(String[] args) { | 
					 | 
				
			||||||
        System.out.println("Hello world!"); | 
					 | 
				
			||||||
    } | 
					 | 
				
			||||||
} | 
					 | 
				
			||||||
@ -1,6 +1,4 @@ | 
				
			|||||||
package cn.wustlinghang.wusthelper.internal.graduate.exception; | 
					package cn.wustlinghang.wusthelper.internal.rpc.exception; | 
				
			||||||
 | 
					 | 
				
			||||||
import cn.wustlinghang.wusthelper.rpc.exception.RpcException; | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.StringJoiner; | 
					import java.util.StringJoiner; | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -1,6 +1,4 @@ | 
				
			|||||||
package cn.wustlinghang.wusthelper.internal.physics.exception; | 
					package cn.wustlinghang.wusthelper.internal.rpc.exception; | 
				
			||||||
 | 
					 | 
				
			||||||
import cn.wustlinghang.wusthelper.rpc.exception.RpcException; | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.StringJoiner; | 
					import java.util.StringJoiner; | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -1,4 +1,4 @@ | 
				
			|||||||
package cn.wustlinghang.wusthelper.rpc.exception; | 
					package cn.wustlinghang.wusthelper.internal.rpc.exception; | 
				
			||||||
 | 
					
 | 
				
			||||||
public class RpcException extends RuntimeException { | 
					public class RpcException extends RuntimeException { | 
				
			||||||
    protected final int code; | 
					    protected final int code; | 
				
			||||||
@ -1,4 +1,4 @@ | 
				
			|||||||
package cn.wustlinghang.wusthelper.rpc.response; | 
					package cn.wustlinghang.wusthelper.internal.rpc.response; | 
				
			||||||
 | 
					
 | 
				
			||||||
public record RpcResponse<T>(int code, String msg, T data) { | 
					public record RpcResponse<T>(int code, String msg, T data) { | 
				
			||||||
    public static <T> RpcResponse<T> success(T data) { | 
					    public static <T> RpcResponse<T> success(T data) { | 
				
			||||||
@ -1,4 +1,4 @@ | 
				
			|||||||
package cn.wustlinghang.wusthelper.rpc.util; | 
					package cn.wustlinghang.wusthelper.internal.rpc.util; | 
				
			||||||
 | 
					
 | 
				
			||||||
public class EnumUtil { | 
					public class EnumUtil { | 
				
			||||||
    public static <E extends Enum<E>> boolean equal(int value, Enum<E> e) { | 
					    public static <E extends Enum<E>> boolean equal(int value, Enum<E> e) { | 
				
			||||||
@ -1,20 +0,0 @@ | 
				
			|||||||
package cn.wustlinghang.wusthelper.rpc.request; | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import lombok.Data; | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import java.util.HashMap; | 
					 | 
				
			||||||
import java.util.Map; | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@Data | 
					 | 
				
			||||||
public class RpcRequest { | 
					 | 
				
			||||||
    private final Map<String, String> arg; | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public RpcRequest() { | 
					 | 
				
			||||||
        this.arg = new HashMap<>(); | 
					 | 
				
			||||||
    } | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public RpcRequest addArg(String key, String value) { | 
					 | 
				
			||||||
        this.arg.put(key, value); | 
					 | 
				
			||||||
        return this; | 
					 | 
				
			||||||
    } | 
					 | 
				
			||||||
} | 
					 | 
				
			||||||
@ -1 +1 @@ | 
				
			|||||||
Subproject commit a18aa81d71123f54e959866e93c7ceb56b03ade4 | 
					Subproject commit 965562b69e35d445fb5c58b2e2afd9cdf27d3146 | 
				
			||||||
@ -1,8 +0,0 @@ | 
				
			|||||||
package cn.wustlinghang.wusthelper.internal.library.services; | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import jakarta.enterprise.context.ApplicationScoped; | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@ApplicationScoped | 
					 | 
				
			||||||
public class ParseService { | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
} | 
					 | 
				
			||||||
Some files were not shown because too many files have changed in this diff Show More
					Loading…
					
					
				
		Reference in new issue