Compare commits
55 Commits
Author | SHA1 | Date |
---|---|---|
|
ebb6df163e | |
|
650a716810 | |
|
a7ade9ccb7 | |
|
5680cc09e2 | |
|
f2c88d66a4 | |
|
a98cdac41e | |
|
a89bb8ecb0 | |
|
3d2e22d0f3 | |
|
f3f340f1e8 | |
|
8b7ebd9de7 | |
|
6bbff95334 | |
|
06cadbe055 | |
|
edc3830b5a | |
|
03a01cd61c | |
|
88eb9b90a2 | |
|
0703bef68b | |
|
43159e6a4d | |
|
c9dee61361 | |
|
508fa50eef | |
|
3e7fbf3489 | |
|
a39cfa21b5 | |
|
7dec7afc23 | |
|
e782d477c5 | |
|
1060e348a2 | |
|
f81b1cc078 | |
|
9a11ade8bd | |
|
3f1fccdb59 | |
|
6581a39d41 | |
|
4b4094acad | |
|
cc40fb4823 | |
|
be845024ab | |
|
0ab120db9c | |
|
ad93af9686 | |
|
6c9e0d260b | |
|
f7575b8cde | |
|
04708fa109 | |
|
ee5549ebb0 | |
|
508215c188 | |
|
c046f73911 | |
|
016dc6f8e9 | |
|
cfb8a3b89d | |
|
93e1b74a1c | |
|
40836ee219 | |
|
a6ec2fef28 | |
|
6c4badc62b | |
|
18631af95c | |
|
7bb0740694 | |
|
a7998050ae | |
|
065f82d46f | |
|
647f0b5dea | |
|
6727c7b986 | |
|
c26b555b01 | |
|
4b42fd8c0f | |
|
a033df5e73 | |
|
e7c8c43ab8 |
|
@ -0,0 +1,4 @@
|
|||
/target
|
||||
.idea
|
||||
/docker/logs
|
||||
/docker/.env
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RunConfigurationProducerService">
|
||||
<option name="ignoredProducers">
|
||||
<set>
|
||||
<option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" />
|
||||
</set>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
10
README.md
10
README.md
|
@ -14,6 +14,16 @@ Spring Boot 2.4.4、Mysql 5.7+、Mybatis-plus、~~ElasticSearch 7.15.2~~
|
|||
|
||||
2.3 将系统通过maven指令 mvn package 将系统打包成jar包,使用java -jar jar包名字启动服务 启动后端口为8080
|
||||
|
||||
2.4 docker运行
|
||||
```
|
||||
# 复制配置文件
|
||||
cp ./docker/.env.example ./docker/.env
|
||||
# 填写配置文件
|
||||
vim ./docker/.env
|
||||
# 启动
|
||||
../docker/start_docker_compose.sh
|
||||
```
|
||||
|
||||
3.业务模块:
|
||||
|
||||
(1)用户模块
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
# nacos
|
||||
NACOS_CONTAINER_NAME=
|
||||
NACOS_IP=
|
||||
NACOS_PORT=
|
||||
NACOS_USERNAME=
|
||||
NACOS_PASSWORD=
|
||||
|
||||
# mysql
|
||||
MYSQL_CONTAINER_NAME=
|
||||
MYSQL_IP=
|
||||
MYSQL_PORT=
|
||||
MYSQL_DATABASE=
|
||||
MYSQL_USERNAME=
|
||||
MYSQL_PASSWORD=
|
||||
|
||||
# local port
|
||||
SOFTBOT_LOCAL_PORT=
|
||||
|
||||
# microservice network name
|
||||
MICROSERVICES_NETWORK_NAME=
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
FROM openjdk:8-jdk
|
||||
ADD target/softbot.jar /data/softbot.jar
|
||||
WORKDIR /data
|
||||
ENTRYPOINT ["sh","-c","java -jar $JAVA_OPTS softbot.jar $NACOS_OPTS $MYSQL_OPTS --spring.profiles.active=prod"]
|
|
@ -0,0 +1,29 @@
|
|||
version: '3'
|
||||
services:
|
||||
gitlink-softbot:
|
||||
container_name: softbot
|
||||
image: softbot:1.0.0
|
||||
build:
|
||||
context: ../
|
||||
dockerfile: docker/Dockerfile
|
||||
volumes:
|
||||
- ./logs:/data/logs
|
||||
external_links:
|
||||
- ${NACOS_CONTAINER_NAME}
|
||||
- ${MYSQL_CONTAINER_NAME}
|
||||
ports:
|
||||
- "${SOFTBOT_LOCAL_PORT}:8081"
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
- NACOS_OPTS=--nacos_ip=${NACOS_IP} --nacos_port=${NACOS_PORT} --nacos_username=${NACOS_USERNAME} --nacos_password=${NACOS_PASSWORD}
|
||||
- MYSQL_OPTS=--mysql_ip=${MYSQL_IP} --mysql_port=${MYSQL_PORT} --mysql_username=${MYSQL_USERNAME} --mysql_password=${MYSQL_PASSWORD} --mysql_database=${MYSQL_DATABASE}
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
memory: 800M
|
||||
restart: always
|
||||
|
||||
networks:
|
||||
microservices_network:
|
||||
external:
|
||||
name: ${MICROSERVICES_NETWORK_NAME}
|
|
@ -0,0 +1,5 @@
|
|||
#!/bin/bash
|
||||
# 编译项目
|
||||
mvn -f ../pom.xml clean package -DskipTests
|
||||
# 启动docker-compose
|
||||
docker-compose -f docker-compose.yml up -d --build --force-recreate
|
47
pom.xml
47
pom.xml
|
@ -21,6 +21,12 @@
|
|||
<java.version>1.8</java.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
<version>2021.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.validation</groupId>
|
||||
<artifactId>validation-api</artifactId>
|
||||
|
@ -45,22 +51,13 @@
|
|||
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||
<version>1.2.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>5.5.0</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger2 -->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger2</artifactId>
|
||||
<version>2.9.2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger-ui -->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
|
@ -134,32 +131,40 @@
|
|||
<!-- <scope>test</scope>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>2.9.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger2</artifactId>
|
||||
<version>2.9.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.jetbrains</groupId>
|
||||
<artifactId>annotations</artifactId>
|
||||
<version>RELEASE</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<!-- 重试相关依赖包 -->
|
||||
<dependency>
|
||||
<groupId>org.jetbrains</groupId>
|
||||
<artifactId>annotations</artifactId>
|
||||
<version>RELEASE</version>
|
||||
<scope>compile</scope>
|
||||
<groupId>org.springframework.retry</groupId>
|
||||
<artifactId>spring-retry</artifactId>
|
||||
<version>1.2.4.RELEASE</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.aspectj</groupId>
|
||||
<artifactId>aspectjweaver</artifactId>
|
||||
<version>1.9.4</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>20.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>clothing-manage</finalName>
|
||||
<finalName>softbot</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
|
|
@ -3,9 +3,15 @@ package com.gitlink.softbot;
|
|||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.retry.annotation.EnableRetry;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
|
||||
@SpringBootApplication
|
||||
@MapperScan("com.gitlink.softbot.dao")
|
||||
@EnableAsync
|
||||
@EnableRetry
|
||||
@EnableDiscoveryClient
|
||||
public class SoftBotApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
package com.gitlink.softbot.annotation;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
|
||||
@Target(ElementType.METHOD) // 作用到方法上
|
||||
@Retention(RetentionPolicy.RUNTIME) // 运行时有效
|
||||
public @interface NoRepeatSubmit {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
package com.gitlink.softbot.annotation;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import com.google.common.cache.Cache;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 内存缓存配置类
|
||||
*/
|
||||
|
||||
@Configuration
|
||||
public class UrlCache {
|
||||
@Bean
|
||||
public Cache<String, Integer> getCache() {
|
||||
return CacheBuilder.newBuilder().expireAfterWrite(2L, TimeUnit.SECONDS).build();// 缓存有效期为2秒
|
||||
}
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package com.gitlink.softbot.annotation.aop;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.gitlink.softbot.annotation.NoRepeatSubmit;
|
||||
import com.gitlink.softbot.global.exception.BotException;
|
||||
import com.gitlink.softbot.global.vo.Result;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.aspectj.lang.annotation.Pointcut;
|
||||
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.google.common.cache.Cache;
|
||||
|
||||
/**
|
||||
* @Description: aop解析注解-配合google的Cache缓存机制
|
||||
* @Author: Zoutao
|
||||
* @Date: 2020/4/14
|
||||
*/
|
||||
@Aspect
|
||||
@Component
|
||||
public class NoRepeatSubmitAop {
|
||||
|
||||
private Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
@Autowired
|
||||
private Cache<String, Integer> cache;
|
||||
|
||||
@Pointcut("@annotation(noRepeatSubmit)")
|
||||
public void pointCut(NoRepeatSubmit noRepeatSubmit) {
|
||||
}
|
||||
|
||||
@Around("pointCut(noRepeatSubmit)")
|
||||
public Object around(ProceedingJoinPoint pjp, NoRepeatSubmit noRepeatSubmit) {
|
||||
Result<String> result = new Result<>();
|
||||
try {
|
||||
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
||||
String sessionId = RequestContextHolder.getRequestAttributes().getSessionId();
|
||||
HttpServletRequest request = attributes.getRequest();
|
||||
String key = sessionId + "-" + request.getServletPath();
|
||||
if (cache.getIfPresent(key) == null) {// 如果缓存中有这个url视为重复提交
|
||||
Object o = pjp.proceed();
|
||||
cache.put(key, 0);
|
||||
return o;
|
||||
} else {
|
||||
logger.error("重复请求,请稍后再试!");
|
||||
return result.build(500).build("重复请求,请稍后再试!");
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
logger.error("验证重复提交时出现未知异常!");
|
||||
return result.build(500).build("验证重复提交时出现未知异常!");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
//package com.gitlink.softbot.config;
|
||||
//
|
||||
//import org.springframework.context.annotation.Bean;
|
||||
//import org.springframework.context.annotation.Configuration;
|
||||
//import org.springframework.web.cors.CorsConfiguration;
|
||||
//import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
|
||||
//import org.springframework.web.filter.CorsFilter;
|
||||
//
|
||||
///**
|
||||
// * ClassName CrossConfig
|
||||
// *
|
||||
// * @author ZengWei
|
||||
// * Date 2021/7/15
|
||||
// */
|
||||
//
|
||||
//@Configuration
|
||||
//public class CrossConfig {
|
||||
// private CorsConfiguration buildConfig() {
|
||||
// CorsConfiguration corsConfiguration = new CorsConfiguration();
|
||||
// corsConfiguration.addAllowedOrigin("*");
|
||||
// corsConfiguration.addAllowedHeader("*");
|
||||
// corsConfiguration.addAllowedMethod("*");
|
||||
// corsConfiguration.setMaxAge(3600L); // 预检请求的有效期,单位为秒。
|
||||
// corsConfiguration.setAllowCredentials(true);// 是否支持安全证书(必需参数)
|
||||
// return corsConfiguration;
|
||||
// }
|
||||
//
|
||||
// @Bean
|
||||
// public CorsFilter corsFilter() {
|
||||
// UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
|
||||
// source.registerCorsConfiguration("/**", buildConfig());
|
||||
// return new CorsFilter(source);
|
||||
// }
|
||||
//}
|
|
@ -0,0 +1,63 @@
|
|||
package com.gitlink.softbot.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
|
||||
|
||||
@Configuration
|
||||
@EnableAsync
|
||||
public class MyThreadPoolConfig {
|
||||
|
||||
|
||||
@Bean("addWebhookTaskExecutor")
|
||||
public Executor addWebhookTaskExecutor() {
|
||||
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
executor.setCorePoolSize(10);
|
||||
executor.setMaxPoolSize(20);
|
||||
// 设置队列容量
|
||||
executor.setQueueCapacity(200);
|
||||
// 设置线程活跃时间(秒)
|
||||
executor.setKeepAliveSeconds(60);
|
||||
executor.setThreadNamePrefix("AddWebhook_Async-Service-");
|
||||
// 设置拒绝策略
|
||||
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
|
||||
executor.initialize();
|
||||
return executor;
|
||||
}
|
||||
|
||||
@Bean("deleteWebhookTaskExecutor")
|
||||
public Executor deleteWebhookTaskExecutor() {
|
||||
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
executor.setCorePoolSize(5);
|
||||
executor.setMaxPoolSize(10);
|
||||
// 设置队列容量
|
||||
executor.setQueueCapacity(100);
|
||||
// 设置线程活跃时间(秒)
|
||||
executor.setKeepAliveSeconds(60);
|
||||
executor.setThreadNamePrefix("DELETEWebhook_Async-Service-");
|
||||
// 设置拒绝策略
|
||||
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
|
||||
executor.initialize();
|
||||
return executor;
|
||||
}
|
||||
|
||||
@Bean("updateWebhookTaskExecutor")
|
||||
public Executor updateWebhookTaskExecutor() {
|
||||
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
executor.setCorePoolSize(5);
|
||||
executor.setMaxPoolSize(10);
|
||||
// 设置队列容量
|
||||
executor.setQueueCapacity(100);
|
||||
// 设置线程活跃时间(秒)
|
||||
executor.setKeepAliveSeconds(60);
|
||||
executor.setThreadNamePrefix("UpdateWebhook_Async-Service-");
|
||||
// 设置拒绝策略
|
||||
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
|
||||
executor.initialize();
|
||||
return executor;
|
||||
}
|
||||
}
|
|
@ -24,11 +24,6 @@ public class MarketController {
|
|||
IMarketService marketService;
|
||||
|
||||
|
||||
@GetMapping("/tt")
|
||||
public String tt(){
|
||||
return "asd";
|
||||
}
|
||||
|
||||
/***
|
||||
* 通过功能类型查询MarketBot
|
||||
* @param func
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.gitlink.softbot.controller.user;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.gitlink.softbot.annotation.NoRepeatSubmit;
|
||||
import com.gitlink.softbot.global.exception.BotException;
|
||||
import com.gitlink.softbot.global.vo.Response;
|
||||
import com.gitlink.softbot.global.vo.Result;
|
||||
|
@ -8,6 +10,7 @@ import com.gitlink.softbot.utils.AuthOperate;
|
|||
import com.gitlink.softbot.utils.GitLinkApi;
|
||||
import com.gitlink.softbot.vo.*;
|
||||
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.gitlink.softbot.vo.BotInputVO;
|
||||
import javax.annotation.Resource;
|
||||
|
@ -156,7 +159,7 @@ public class UserController {
|
|||
* @return
|
||||
*/
|
||||
@PostMapping("installMarketBot")
|
||||
public Result<?> installMarketBot(@RequestBody InstallMarketBotRequest installMarketBotRequest) throws BotException{
|
||||
public Result<?> installMarketBot(@RequestBody InstallMarketBotRequest installMarketBotRequest) throws BotException, JsonProcessingException {
|
||||
Result<?> result = new Result<>();
|
||||
userService.installMarketBot(installMarketBotRequest);
|
||||
return result.build(200).build("install bot success!");
|
||||
|
@ -180,7 +183,8 @@ public class UserController {
|
|||
* @return
|
||||
*/
|
||||
@PostMapping("/updateInstallBot")
|
||||
public Result<?> updateInstallBot(@Valid @RequestBody UpdateInstallBotRequest updateInstallBotRequest) throws BotException{
|
||||
@NoRepeatSubmit
|
||||
public Result<?> updateInstallBot(@Valid @RequestBody UpdateInstallBotRequest updateInstallBotRequest) throws Exception{
|
||||
Result<?> result = new Result<>();
|
||||
userService.updateInstallBot(updateInstallBotRequest);
|
||||
return result.build(200).build("update bot success!");
|
||||
|
@ -204,8 +208,8 @@ public class UserController {
|
|||
* @return
|
||||
*/
|
||||
@GetMapping("/getInstallBot")
|
||||
public Result<?> getInstallBot(@RequestParam("user_id") Integer userId, @RequestParam("bot_id") Integer botId,@RequestParam("login") String login) throws BotException{
|
||||
GetInstallBotRequest getInstallBotRequest = new GetInstallBotRequest(userId, login,botId);
|
||||
public Result<?> getInstallBot(@RequestParam("user_id") Integer userId, @RequestParam("bot_id") Integer botId,@RequestParam("login") String login, @RequestParam("repoIds") String repoIds) throws BotException{
|
||||
GetInstallBotRequest getInstallBotRequest = new GetInstallBotRequest(userId, login, botId , repoIds);
|
||||
Result<?> result = new Result<>();
|
||||
GetInstallBotResponse getInstallBotResponse = userService.getInstallBot(getInstallBotRequest);
|
||||
return result.build(200).build(getInstallBotResponse).build("get installBot success!");
|
||||
|
@ -290,16 +294,16 @@ public class UserController {
|
|||
|
||||
/**
|
||||
* 判断是否安装该bot
|
||||
* @param userId
|
||||
* @param repoIds
|
||||
* @param botId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/judgeIsIntallBot")
|
||||
public Result<?> judgeIsInstallBot(@RequestParam("user_id") Integer userId,@RequestParam("bot_id") Integer botId){
|
||||
public Result<?> judgeIsInstallBot(@RequestParam("repoIds") String repoIds, @RequestParam("bot_id") Integer botId){
|
||||
|
||||
Boolean b = userService.judgeIsInstallBot(userId,botId);
|
||||
Result<Boolean> result = new Result<>();
|
||||
return result.build(b).build(200).build("success!");
|
||||
JudgeIsInstallBotResponse judgeIsInstallBotResponse = userService.judgeIsInstallBot(repoIds,botId);
|
||||
Result<JudgeIsInstallBotResponse> result = new Result<>();
|
||||
return result.build(judgeIsInstallBotResponse).build(200).build("success!");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -308,9 +312,12 @@ public class UserController {
|
|||
* @return
|
||||
*/
|
||||
@GetMapping("/getAllInstallBots")
|
||||
public Result<?> getAllInstallBots(@RequestParam("user_id") Integer userId){
|
||||
GetAllInstallBotsResponse getAllInstallBotsResponse = userService.getAllInstallBots(userId);
|
||||
public Result<?> getAllInstallBots(@RequestParam("user_id") Integer userId, @RequestParam(value = "repoIds", required = false) String repoIds){
|
||||
Result<GetAllInstallBotsResponse> result = new Result<>();
|
||||
if(userId == null && (repoIds == null || "".equals(repoIds))) {
|
||||
return result.build("传入参数不能全空").build(500).build("fail!");
|
||||
}
|
||||
GetAllInstallBotsResponse getAllInstallBotsResponse = userService.getAllInstallBots(userId, repoIds);
|
||||
return result.
|
||||
build(getAllInstallBotsResponse).
|
||||
build(200).
|
||||
|
|
|
@ -57,4 +57,6 @@ public class Bot {
|
|||
@TableField(fill = FieldFill.INSERT)
|
||||
private Date createTime;
|
||||
|
||||
private String oauthCallbackUrl;
|
||||
|
||||
}
|
||||
|
|
|
@ -29,6 +29,8 @@ public class BotLimitEvent {
|
|||
|
||||
private Integer readWritePr;
|
||||
|
||||
private Integer readWriteIssue;
|
||||
|
||||
private Integer authCategory;
|
||||
|
||||
private Integer event;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.gitlink.softbot.entity.db;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
|
||||
|
@ -40,6 +41,12 @@ public class InstallBot {
|
|||
//添加webhookId
|
||||
private Integer webhookId;
|
||||
|
||||
//仓库拥有者login(组织/个人)
|
||||
private String repoOwner;
|
||||
|
||||
@JsonIgnore
|
||||
private String webhookResponseMsg;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Date createTime;
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ import com.gitlink.softbot.dao.db.BotLimitMapper;
|
|||
import com.gitlink.softbot.entity.db.*;
|
||||
import com.gitlink.softbot.global.exception.BotException;
|
||||
import com.gitlink.softbot.service.market.IMarketService;
|
||||
import com.gitlink.softbot.service.user.impl.UserService;
|
||||
import com.gitlink.softbot.utils.GitLinkApi;
|
||||
import com.gitlink.softbot.vo.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
@ -53,6 +54,9 @@ public class MarketService implements IMarketService {
|
|||
@Autowired
|
||||
GitLinkApi api;
|
||||
|
||||
@Autowired
|
||||
UserService userService;
|
||||
|
||||
@Override
|
||||
public MarketBotPagesVO getMarketBotByNameLike(String keyword,Integer pageIndex,Integer pageSize){
|
||||
log.info("执行Bot通过上市名称模糊查询,keyword:{},pageIndex:{},pageSize:{}",keyword,pageIndex,pageSize);
|
||||
|
@ -217,6 +221,9 @@ public class MarketService implements IMarketService {
|
|||
public GetBotDetailResponse getBotDetail(Integer userId, Integer botId) {
|
||||
Bot bot = botMapper.selectOne(Wrappers.<Bot>lambdaQuery()
|
||||
.eq(Bot::getId,botId));
|
||||
if(bot == null) {
|
||||
return new GetBotDetailResponse();
|
||||
}
|
||||
MarketBot marketBot = marketBotMapper.selectOne(Wrappers.<MarketBot>lambdaQuery()
|
||||
.eq(MarketBot::getBotId,botId));
|
||||
List<BotLimitEvent> botLimitEvents = botLimitMapper.selectList(new QueryWrapper<BotLimitEvent>()
|
||||
|
@ -232,7 +239,7 @@ public class MarketService implements IMarketService {
|
|||
// 设置开发者名称
|
||||
getBotDetailResponse.setDeveloperName(api.getUserNameByUid(registerBot.getDeveloperId().toString()));
|
||||
getBotDetailResponse.setDeveloperLogin(registerBot.getDeveloperLogin());
|
||||
getBotDetailResponse.setLimitAndEvents(getLimitFromLimitEvents(botLimitEvents));
|
||||
getBotDetailResponse.setLimitAndEvents(userService.getLimitFromLimitEvents(botLimitEvents));
|
||||
return getBotDetailResponse;
|
||||
}
|
||||
|
||||
|
@ -290,46 +297,4 @@ public class MarketService implements IMarketService {
|
|||
marketBotPagesVO1.setPageSize(pageSize);
|
||||
return marketBotPagesVO1;
|
||||
}
|
||||
|
||||
private LimitVO getLimitFromLimitEvents(List<BotLimitEvent> botLimitEvents){
|
||||
LimitVO limitVO = new LimitVO();
|
||||
//无权限情况下
|
||||
if (botLimitEvents.size()==1&&botLimitEvents.get(0).getEvent()==5){
|
||||
limitVO.setEventPr("");
|
||||
limitVO.setEventCode("");
|
||||
limitVO.setJurisDictionCode(2);
|
||||
limitVO.setJurisDictionPr(2);
|
||||
}
|
||||
StringBuffer codeStr = new StringBuffer();
|
||||
StringBuffer prStr = new StringBuffer();
|
||||
|
||||
botLimitEvents.forEach(botLimitEvent -> {
|
||||
if (botLimitEvent.getEvent()>=3){
|
||||
prStr.append(botLimitEvent.getEvent());
|
||||
prStr.append(",");
|
||||
limitVO.setJurisDictionPr(botLimitEvent.getReadWritePr());
|
||||
}else {
|
||||
codeStr.append(botLimitEvent.getEvent());
|
||||
codeStr.append(",");
|
||||
limitVO.setJurisDictionCode(botLimitEvent.getReadWriteCode());
|
||||
}
|
||||
});
|
||||
|
||||
if (codeStr.length()>1){
|
||||
codeStr.deleteCharAt(codeStr.length()-1);
|
||||
}else {
|
||||
limitVO.setJurisDictionCode(2);
|
||||
}
|
||||
if (prStr.length()>1){
|
||||
prStr.deleteCharAt(prStr.length()-1);
|
||||
}else {
|
||||
limitVO.setJurisDictionPr(2);
|
||||
}
|
||||
|
||||
limitVO.setEventPr(prStr.toString());
|
||||
limitVO.setEventCode(codeStr.toString());
|
||||
|
||||
log.info("limitVO:{}",limitVO);
|
||||
return limitVO;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
package com.gitlink.softbot.service.user;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.gitlink.softbot.global.exception.BotException;
|
||||
import com.gitlink.softbot.vo.*;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
||||
|
||||
public interface IUserService {
|
||||
|
@ -24,11 +25,11 @@ public interface IUserService {
|
|||
//根据BotId返回Bot信息
|
||||
MarketBotVO getMarketBotById(Integer botId) throws BotException;
|
||||
//安装Bot
|
||||
void installMarketBot(InstallMarketBotRequest installMarketBotRequest) throws BotException;
|
||||
void installMarketBot(InstallMarketBotRequest installMarketBotRequest) throws BotException, JsonProcessingException;
|
||||
//安装Bot
|
||||
void unInstallMarketBot(UnInstallMarketBotRequest unInstallMarketBotRequest) throws BotException;
|
||||
//用户配置安装的Bot
|
||||
void updateInstallBot(UpdateInstallBotRequest updateInstallBotRequest) throws BotException;
|
||||
void updateInstallBot(UpdateInstallBotRequest updateInstallBotRequest) throws Exception;
|
||||
//删除安装的Bot
|
||||
void deleteInstallBot(DeleteInstallBotRequest deleteInstallBotRequest) throws BotException;
|
||||
//修改上市bot
|
||||
|
@ -50,9 +51,9 @@ public interface IUserService {
|
|||
//拒绝接收转让Bot
|
||||
void refuseTransferBot(RefuseTransferBotRequest refuseTransferBotRequest) throws BotException;
|
||||
//判断是否安装过此bot
|
||||
boolean judgeIsInstallBot(Integer userId,Integer botId);
|
||||
JudgeIsInstallBotResponse judgeIsInstallBot(String repoIds, Integer botId);
|
||||
|
||||
GetAllInstallBotsResponse getAllInstallBots(Integer userId);
|
||||
GetAllInstallBotsResponse getAllInstallBots(Integer userId, String repoIds);
|
||||
|
||||
GetStoreAllInstallBotResponse getStoreAllInstallBots(Integer storeId);
|
||||
|
||||
|
|
|
@ -0,0 +1,77 @@
|
|||
package com.gitlink.softbot.service.user.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.gitlink.softbot.dao.db.InstallMapper;
|
||||
import com.gitlink.softbot.entity.db.BotLimitEvent;
|
||||
import com.gitlink.softbot.entity.db.InstallBot;
|
||||
import com.gitlink.softbot.global.vo.Response;
|
||||
import com.gitlink.softbot.utils.GitLinkApi;
|
||||
import com.gitlink.softbot.utils.response.AddWebhookResponse;
|
||||
import com.gitlink.softbot.vo.Webhook;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.retry.annotation.Backoff;
|
||||
import org.springframework.retry.annotation.Recover;
|
||||
import org.springframework.retry.annotation.Retryable;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class AsyncAddWebhookService {
|
||||
|
||||
@Resource
|
||||
@Lazy
|
||||
private UserService userService;
|
||||
|
||||
@Autowired
|
||||
private GitLinkApi api;
|
||||
|
||||
@Resource
|
||||
private InstallMapper installMapper;
|
||||
|
||||
@Async("addWebhookTaskExecutor")
|
||||
@Retryable(value = RuntimeException.class, maxAttempts = 3, backoff = @Backoff(delay = 2000,multiplier = 1.5))
|
||||
public void asyncAddWebhookAndRetry(Integer currentUserId, List<BotLimitEvent> botLimitEvents, InstallBot installBot) throws RuntimeException, JsonProcessingException {
|
||||
Webhook webhook = userService.getWebhook(botLimitEvents, installBot.getInstallerId());
|
||||
|
||||
//先获取webhookId构造webhook
|
||||
Object[] objects = new Object[]{installBot.getRepoOwner(), installBot.getStoreRepo()};
|
||||
Response response = api.addWebhook(currentUserId, objects, webhook);
|
||||
JSONObject object = JSONObject.parseObject(response.getData().toString());
|
||||
if (response.getCode().equals("error") || (object.get("status")!=null&&!object.get("status").equals(0))) {
|
||||
installBot.setWebhookId(-1); //添加webhook失败
|
||||
object.put("webhook_operation_msg", "create webhook fail");
|
||||
installBot.setWebhookResponseMsg(object.toJSONString());
|
||||
installMapper.updateById(installBot);
|
||||
throw new RuntimeException("添加webhook异常");
|
||||
}
|
||||
if (response.getCode().equals("ok")) {
|
||||
//回写WebhookId
|
||||
AddWebhookResponse addWebhookResponse = JSON.parseObject(response.getData().toString(),AddWebhookResponse.class);
|
||||
installBot.setWebhookId(addWebhookResponse.getId());
|
||||
object.put("webhook_operation_msg", "create webhook success");
|
||||
installBot.setWebhookResponseMsg(object.toJSONString());
|
||||
int updateNum = installMapper.updateById(installBot);
|
||||
//bot安装数据更新webhook_id字段失败时,删除仓库webhook
|
||||
if (updateNum == 0) {
|
||||
api.deleteWebhook(currentUserId, objects, addWebhookResponse.getId());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 最终重试失败处理
|
||||
*/
|
||||
@Recover
|
||||
public void recover(RuntimeException e){
|
||||
log.info("调用添加webhook请求,重试3次后依旧失败");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
package com.gitlink.softbot.service.user.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.gitlink.softbot.dao.db.InstallMapper;
|
||||
import com.gitlink.softbot.entity.db.BotLimitEvent;
|
||||
import com.gitlink.softbot.entity.db.InstallBot;
|
||||
import com.gitlink.softbot.global.vo.Response;
|
||||
import com.gitlink.softbot.utils.GitLinkApi;
|
||||
import com.gitlink.softbot.vo.Webhook;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.retry.annotation.Backoff;
|
||||
import org.springframework.retry.annotation.Recover;
|
||||
import org.springframework.retry.annotation.Retryable;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class AsyncDeleteWebhookService {
|
||||
|
||||
@Resource
|
||||
private UserService userService;
|
||||
|
||||
@Autowired
|
||||
private GitLinkApi api;
|
||||
|
||||
@Resource
|
||||
private InstallMapper installMapper;
|
||||
|
||||
@Async("deleteWebhookTaskExecutor")
|
||||
@Retryable(value = RuntimeException.class, maxAttempts = 3, backoff = @Backoff(delay = 2000,multiplier = 1.5))
|
||||
public void asyncDeleteWebhookAndRetry(Integer currentUserId, InstallBot installBot) throws RuntimeException {
|
||||
|
||||
Object[] objects = new Object[]{installBot.getRepoOwner(), installBot.getStoreRepo()};
|
||||
Response response = api.deleteWebhook(currentUserId, objects, installBot.getWebhookId());
|
||||
JSONObject object = JSONObject.parseObject(response.getData().toString());
|
||||
if (response.getCode().equals("error") || (object.get("status")!=null&&!object.get("status").equals(0)&&!object.get("status").equals(404))) {
|
||||
installBot.setWebhookId(-3); //删除webhook失败
|
||||
object.put("webhook_operation_msg", "delete webhook fail");
|
||||
installBot.setWebhookResponseMsg(object.toJSONString());
|
||||
installMapper.updateById(installBot);
|
||||
throw new RuntimeException("删除webhook异常");
|
||||
}
|
||||
if (response.getCode().equals("ok")) {
|
||||
object.put("webhook_operation_msg", "delete webhook success");
|
||||
installBot.setWebhookResponseMsg(object.toJSONString());
|
||||
installMapper.updateById(installBot);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 最终重试失败处理
|
||||
*/
|
||||
@Recover
|
||||
public void recover(RuntimeException e){
|
||||
log.info("调用删除webhook请求,重试3次后依旧失败");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
package com.gitlink.softbot.service.user.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.gitlink.softbot.dao.db.InstallMapper;
|
||||
import com.gitlink.softbot.entity.db.BotLimitEvent;
|
||||
import com.gitlink.softbot.entity.db.InstallBot;
|
||||
import com.gitlink.softbot.global.vo.Response;
|
||||
import com.gitlink.softbot.utils.GitLinkApi;
|
||||
import com.gitlink.softbot.utils.response.AddWebhookResponse;
|
||||
import com.gitlink.softbot.vo.Webhook;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.retry.annotation.Backoff;
|
||||
import org.springframework.retry.annotation.Recover;
|
||||
import org.springframework.retry.annotation.Retryable;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class AsyncUpdateWebhookService {
|
||||
|
||||
@Resource
|
||||
private UserService userService;
|
||||
|
||||
@Autowired
|
||||
private GitLinkApi api;
|
||||
|
||||
@Resource
|
||||
private InstallMapper installMapper;
|
||||
|
||||
@Async("updateWebhookTaskExecutor")
|
||||
@Retryable(value = RuntimeException.class, maxAttempts = 3, backoff = @Backoff(delay = 2000,multiplier = 1.5))
|
||||
public void asyncUpdateWebhookAndRetry(Integer currentUserId, List<BotLimitEvent> botLimitEvents, InstallBot installBot) throws RuntimeException, JsonProcessingException {
|
||||
Webhook webhook = userService.getWebhook(botLimitEvents, installBot.getInstallerId());
|
||||
|
||||
//先获取webhookId构造webhook
|
||||
Object[] objects = new Object[]{installBot.getRepoOwner(), installBot.getStoreRepo()};
|
||||
Response response = api.updateWebhook(currentUserId, objects, installBot.getWebhookId(), webhook);
|
||||
JSONObject object = JSONObject.parseObject(response.getData().toString());
|
||||
if (response.getCode().equals("error") || (object.get("status")!=null&&!object.get("status").equals(0))) {
|
||||
installBot.setWebhookId(-2); //更新webhook失败
|
||||
object.put("webhook_operation_msg", "update webhook fail");
|
||||
installBot.setWebhookResponseMsg(object.toJSONString());
|
||||
installMapper.updateById(installBot);
|
||||
throw new RuntimeException("更新webhook异常");
|
||||
}
|
||||
if (response.getCode().equals("ok")) {
|
||||
object.put("webhook_operation_msg", "update webhook success");
|
||||
installBot.setWebhookResponseMsg(object.toJSONString());
|
||||
installMapper.updateById(installBot);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 最终重试失败处理
|
||||
*/
|
||||
@Recover
|
||||
public void recover(RuntimeException e){
|
||||
log.info("调用更新webhook请求,重试3次后依旧失败");
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -121,6 +121,14 @@ public class GitLinkApi {
|
|||
return response;
|
||||
}
|
||||
|
||||
public Response updateCallbackUrl(Integer uid, Integer botId) {
|
||||
Map<String, String> inputParams = new HashMap<>();
|
||||
inputParams.put("uid", uid.toString());
|
||||
Object[] params = new Object[]{botId.toString()};
|
||||
Response response = RestTemplateUtil.httpRequest(restTemplate, HttpMethod.POST, URL+"/app", params, "/update_callback_url" , inputParams, null ,getHeader());
|
||||
return response;
|
||||
}
|
||||
|
||||
// public Response activeBotAuth(Integer uid, Integer botId){
|
||||
// Map<String, String> inputParams = new HashMap<>();
|
||||
// inputParams.put("uid", uid.toString());
|
||||
|
|
|
@ -2,6 +2,8 @@ package com.gitlink.softbot.utils;
|
|||
|
||||
|
||||
import com.gitlink.softbot.global.vo.Response;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.http.*;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
|
@ -16,7 +18,7 @@ import java.util.Objects;
|
|||
|
||||
public class RestTemplateUtil {
|
||||
|
||||
//private static Logger logger = (Logger) LoggerFactory.getLogger(RestTemplateUtil.class);
|
||||
private static Logger logger = (Logger) LoggerFactory.getLogger(RestTemplateUtil.class);
|
||||
/**
|
||||
* @Description 私有构造函数
|
||||
*/
|
||||
|
@ -83,7 +85,8 @@ public class RestTemplateUtil {
|
|||
params.setAll(inputParams);
|
||||
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(url);
|
||||
URI uri = builder.queryParams(params).build().encode().toUri();
|
||||
//System.out.println(uri);
|
||||
logger.info("远程接口调用地址: " + url);
|
||||
logger.info("entity: " + entity);
|
||||
ResponseEntity<String> resp = customRestTemplate.exchange(uri, method, entity, String.class);
|
||||
return handleResult(resp);
|
||||
}
|
||||
|
|
|
@ -50,6 +50,10 @@ public class BotInputVO implements Serializable {
|
|||
//TODO 前端改协议
|
||||
private String botUrl;
|
||||
|
||||
//oauth授权回调地址
|
||||
@NotNull(message = "oauthCallbackUrl is required")
|
||||
private String oauthCallbackUrl;
|
||||
|
||||
/**
|
||||
* 权限与事件
|
||||
*/
|
||||
|
|
|
@ -42,6 +42,8 @@ public class BotOutputVO implements Serializable {
|
|||
*/
|
||||
private Integer state;
|
||||
|
||||
private String OauthCallbackUrl;
|
||||
|
||||
/**
|
||||
* 是否转让 0未转让 ,1转让
|
||||
*/
|
||||
|
|
|
@ -26,4 +26,7 @@ public class DeleteInstallBotRequest {
|
|||
@NotNull(message = "botId is required")
|
||||
private Integer botId;
|
||||
private String password;
|
||||
|
||||
@NotNull(message = "repoIds is required")
|
||||
private String storeRepoIds;
|
||||
}
|
||||
|
|
|
@ -76,4 +76,9 @@ public class GetBotDetailResponse {
|
|||
* 权限与事件
|
||||
*/
|
||||
LimitVO limitAndEvents;
|
||||
|
||||
/**
|
||||
* 安装次数
|
||||
*/
|
||||
private Integer installNum;
|
||||
}
|
||||
|
|
|
@ -23,4 +23,6 @@ public class GetInstallBotRequest implements Serializable {
|
|||
private String login;
|
||||
@NotNull(message = "botId is required")
|
||||
private Integer botId;
|
||||
|
||||
private String repoIds;
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ public class GetInstallBotResponse implements Serializable {
|
|||
private String marketName;
|
||||
private Integer state;
|
||||
private String logo;
|
||||
private Integer isPublic;
|
||||
private Integer registerId;
|
||||
private String registerLogin;
|
||||
private String registerName;
|
||||
|
|
|
@ -31,4 +31,6 @@ public class InstallBotInfo {
|
|||
Integer state;
|
||||
|
||||
LimitVO limitVO;
|
||||
|
||||
String storeRepoIds;
|
||||
}
|
||||
|
|
|
@ -26,4 +26,5 @@ public class InstallMarketBotRequest implements Serializable {
|
|||
private List<Integer> storeList;
|
||||
//TODO 前端修改
|
||||
private Map<Integer,String> repoMap;
|
||||
private Map<Integer, String> repoOwnerMap;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
package com.gitlink.softbot.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonNaming;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class)
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class JudgeIsInstallBotResponse {
|
||||
|
||||
private List<String> installRepoIds;
|
||||
|
||||
private List<String> uninstallRepoIds;
|
||||
}
|
|
@ -23,9 +23,14 @@ public class Limit{
|
|||
//请求读写权限(0:只读1:读写2:无权限)
|
||||
private Integer readWritePr;
|
||||
|
||||
//权限类型(0:代码仓库权限1:合并请求权限)
|
||||
//请求读写权限(0:只读1:读写2:无权限)
|
||||
private Integer readWriteIssue;
|
||||
|
||||
//权限类型(0:代码仓库权限1:合并请求权限3:疑修事件权限)
|
||||
private Integer authCategory;
|
||||
|
||||
//代码0:0:git推送到存储库1:创建分支或标签2:删除分支或标签 请求1: 3:合并请求被打开4:合并请求被分配
|
||||
// (代码0:0:git推送到存储库1:创建分支或标签2:删除分支或标签)
|
||||
// (请求1: 3:合并请求被打开4:合并请求被分配) 5:无权限
|
||||
// (疑修3: 6:PR评论被创建、编辑或删除 7:ISSUE已打开、已关闭、已重新打开或编辑 8:ISSUE已被指派或取消指派 9:ISSUE标记被更新或清除 10:ISSUE评论被创建、编辑或删除)
|
||||
private Integer event;
|
||||
}
|
|
@ -26,13 +26,23 @@ public class LimitVO {
|
|||
*/
|
||||
private Integer jurisDictionPr;
|
||||
|
||||
/**
|
||||
* 请求权限 0:只读1:读写2:无权限
|
||||
*/
|
||||
private Integer jurisDictionIssue;
|
||||
|
||||
/**
|
||||
* 代码事件0,1,2,
|
||||
*/
|
||||
private String eventCode;
|
||||
|
||||
/**
|
||||
* 请求事件3,4
|
||||
* 请求事件3,4,6
|
||||
*/
|
||||
private String eventPr;
|
||||
|
||||
/**
|
||||
* 请求事件7,8,9,10
|
||||
*/
|
||||
private String eventIssue;
|
||||
}
|
||||
|
|
|
@ -28,7 +28,14 @@ public class UpdateInstallBotRequest implements Serializable {
|
|||
@NotNull(message = "state is required")
|
||||
private Integer state;
|
||||
private String password;
|
||||
//待安装仓库id列表
|
||||
private List<Integer> storeList;
|
||||
|
||||
//已安装仓库id列表
|
||||
private List<Integer> installedStoreList;
|
||||
|
||||
//前端修改 storeId-repo
|
||||
private Map<Integer,String> repoMap;
|
||||
|
||||
private Map<Integer, String> repoOwnerMap;
|
||||
}
|
||||
|
|
|
@ -25,4 +25,10 @@ public class Webhook {
|
|||
private String branch_filter;
|
||||
|
||||
private Object[] events;
|
||||
|
||||
private String type;
|
||||
|
||||
public String getType() {
|
||||
return "softbot";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,35 @@
|
|||
server:
|
||||
port: 8080
|
||||
port: 8081
|
||||
es-url:
|
||||
127.0.0.1:9200
|
||||
spring:
|
||||
|
||||
config:
|
||||
activate:
|
||||
on-profile: dev
|
||||
|
||||
application:
|
||||
# 应用名称
|
||||
name: softbot
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
username: nacos
|
||||
password: nacos
|
||||
|
||||
|
||||
datasource:
|
||||
username: root
|
||||
password: wu180532 #tonglin0711
|
||||
url: jdbc:mysql://localhost:3306/soft_bot?useUnicode=true&characterEncoding=UTF-8
|
||||
password: 123456 #tonglin0711
|
||||
url: jdbc:mysql://localhost:3306/testforgeplus?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
dbcp2:
|
||||
test-on-borrow: false
|
||||
test-while-idle: true
|
||||
time-between-eviction-runs-millis: 3600000
|
||||
|
||||
elasticsearch:
|
||||
rest:
|
||||
uris: http://127.0.0.1:9200
|
||||
|
@ -20,7 +42,9 @@ spring:
|
|||
|
||||
poll-interval: 3000
|
||||
quiet-period: 1000
|
||||
|
||||
jackson:
|
||||
time-zone: GMT+8
|
||||
date-format: yyyy-MM-dd HH:mm:ss
|
||||
mvc:
|
||||
view:
|
||||
prefix: /WEB-INF/jsp/
|
||||
|
@ -38,6 +62,7 @@ spring:
|
|||
timeout: 10000
|
||||
password: 123456
|
||||
|
||||
|
||||
mybatis-plus:
|
||||
configuration:
|
||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
|
@ -0,0 +1,81 @@
|
|||
server:
|
||||
port: 8081
|
||||
es-url:
|
||||
127.0.0.1:9200
|
||||
|
||||
spring:
|
||||
|
||||
config:
|
||||
activate:
|
||||
on-profile: dev
|
||||
|
||||
application:
|
||||
# 应用名称
|
||||
name: softbot
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: ${nacos_ip}:${nacos_port}
|
||||
username: ${nacos_username}
|
||||
password: ${nacos_password}
|
||||
|
||||
datasource:
|
||||
username: ${mysql_username}
|
||||
password: ${mysql_password}
|
||||
url: jdbc:mysql://${mysql_ip}:${mysql_port}/${mysql_database}?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
dbcp2:
|
||||
test-on-borrow: false
|
||||
test-while-idle: true
|
||||
time-between-eviction-runs-millis: 3600000
|
||||
|
||||
elasticsearch:
|
||||
rest:
|
||||
uris: http://127.0.0.1:9200
|
||||
|
||||
jackson:
|
||||
time-zone: GMT+8
|
||||
date-format: yyyy-MM-dd HH:mm:ss
|
||||
mvc:
|
||||
view:
|
||||
prefix: /WEB-INF/jsp/
|
||||
suffix: .jsp
|
||||
thymeleaf:
|
||||
prefix: classpath:/templates/
|
||||
suffix: .html
|
||||
encoding: UTF-8
|
||||
redis:
|
||||
database: 0
|
||||
host: 101.35.140.79
|
||||
port: 6379
|
||||
# password:
|
||||
# 连接超时时间
|
||||
timeout: 10000
|
||||
password: 123456
|
||||
|
||||
mybatis-plus:
|
||||
configuration:
|
||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
mapper-locations: classpath:mapper/*.xml
|
||||
|
||||
|
||||
mybatis:
|
||||
mapper-locations: classpath:mapper/*.xml
|
||||
type-aliases-package: com.gitlink.softbot.entity
|
||||
configuration:
|
||||
map-underscore-to-camel-case: true
|
||||
|
||||
#showSql
|
||||
logging:
|
||||
level:
|
||||
com:
|
||||
example:
|
||||
mapper : debug
|
||||
elasticsearch:
|
||||
url: localhost:9200
|
||||
|
||||
gitlink:
|
||||
url: https://testforgeplus.trustie.net
|
||||
token: eyJraWQiOiJUaEVSLVl3Ukg4TWYwOHM0UnJLUDYzXzZLWmVET2NZckZXcmdzN2VUVWdrIiwiYWxnIjoiSFM1MTIifQ.eyJpc3MiOiJHaXRMaW5rIiwiaWF0IjoxNjc1NzYyMDkwLCJqdGkiOiI0MzA1ZDUwZC01ZGRkLTQ0MzUtODMyNS1iZDczYmVhMWMxYjciLCJ1c2VyIjp7ImlkIjpudWxsLCJsb2dpbiI6bnVsbCwibWFpbCI6bnVsbH19.hpHCJeU4Jyz-DM2NBUdB-tQW_E0-tu9H3LoGhsJ7kPHkSsdXJCII0jxhyPb9gwDsgd8SnlRZF8tZDDjnZSoztQ
|
||||
|
|
@ -1,67 +1,10 @@
|
|||
server:
|
||||
port: 8080
|
||||
es-url:
|
||||
127.0.0.1:9200
|
||||
port: 8081
|
||||
|
||||
spring:
|
||||
datasource:
|
||||
username: root
|
||||
password: wu180532 #tonglin0711
|
||||
url: jdbc:mysql://localhost:3306/soft_bot?useUnicode=true&characterEncoding=UTF-8
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
elasticsearch:
|
||||
rest:
|
||||
uris: http://127.0.0.1:9200
|
||||
devtools:
|
||||
restart:
|
||||
|
||||
enabled: true
|
||||
|
||||
additional-paths: src/main/java
|
||||
|
||||
poll-interval: 3000
|
||||
quiet-period: 1000
|
||||
jackson:
|
||||
time-zone: GMT+8
|
||||
date-format: yyyy-MM-dd HH:mm:ss
|
||||
mvc:
|
||||
view:
|
||||
prefix: /WEB-INF/jsp/
|
||||
suffix: .jsp
|
||||
thymeleaf:
|
||||
prefix: classpath:/templates/
|
||||
suffix: .html
|
||||
encoding: UTF-8
|
||||
redis:
|
||||
database: 0
|
||||
host: 101.35.140.79
|
||||
port: 6379
|
||||
# password:
|
||||
# 连接超时时间
|
||||
timeout: 10000
|
||||
password: 123456
|
||||
|
||||
mybatis-plus:
|
||||
configuration:
|
||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
mapper-locations: classpath:mapper/*.xml
|
||||
|
||||
|
||||
mybatis:
|
||||
mapper-locations: classpath:mapper/*.xml
|
||||
type-aliases-package: com.gitlink.softbot.entity
|
||||
configuration:
|
||||
map-underscore-to-camel-case: true
|
||||
|
||||
#showSql
|
||||
logging:
|
||||
level:
|
||||
com:
|
||||
example:
|
||||
mapper : debug
|
||||
elasticsearch:
|
||||
url: localhost:9200
|
||||
|
||||
gitlink:
|
||||
url: https://testforgeplus.trustie.net
|
||||
token: eyJraWQiOiJUaEVSLVl3Ukg4TWYwOHM0UnJLUDYzXzZLWmVET2NZckZXcmdzN2VUVWdrIiwiYWxnIjoiSFM1MTIifQ.eyJpc3MiOiJHaXRMaW5rIiwiaWF0IjoxNjc1NzYyMDkwLCJqdGkiOiI0MzA1ZDUwZC01ZGRkLTQ0MzUtODMyNS1iZDczYmVhMWMxYjciLCJ1c2VyIjp7ImlkIjpudWxsLCJsb2dpbiI6bnVsbCwibWFpbCI6bnVsbH19.hpHCJeU4Jyz-DM2NBUdB-tQW_E0-tu9H3LoGhsJ7kPHkSsdXJCII0jxhyPb9gwDsgd8SnlRZF8tZDDjnZSoztQ
|
||||
|
||||
application:
|
||||
# 应用名称
|
||||
name: softbot
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: dev
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
-- ----------------------------
|
||||
-- 表bot中添加字段 oauth_callback_url : oauth回调地址)
|
||||
-- ----------------------------
|
||||
ALTER TABLE `bot` ADD COLUMN (`oauth_callback_url` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'oauth回调地址');
|
|
@ -0,0 +1,8 @@
|
|||
-- 表bot_limit_event中添加字段 read_write_issue:疑修读写权限
|
||||
ALTER TABLE `bot_limit_event` ADD COLUMN `read_write_issue` TINYINT(4) NOT NULL DEFAULT 2 COMMENT '0:只读 1:读写 2:无权限' AFTER read_write_pr;
|
||||
|
||||
-- 表bot_limit_event中拓展字段event枚举 6:PR评论被创建、编辑或删除 7:ISSUE已打开、已关闭、已重新打开或编辑 8:ISSUE已被指派或取消指派 9:ISSUE标记被更新或清除 10:ISSUE评论被创建、编辑或删除
|
||||
ALTER TABLE `bot_limit_event` MODIFY COLUMN `event` TINYINT(4) NOT NULL COMMENT '0:git推送到存储库 1:创建分支或标签 2:删除分支或标签 3:PR被打开或重新打开 4:PR被分配 5:无权限 6:PR评论被创建、编辑或删除 7:ISSUE已打开、已关闭、已重新打开或编辑 8:ISSUE已被指派或取消指派 9:ISSUE标记被更新或清除 10:ISSUE评论被创建、编辑或删除';
|
||||
|
||||
-- 表bot_limit_event中拓展字段auth_category枚举 3:疑修事件权限
|
||||
ALTER TABLE `bot_limit_event` MODIFY COLUMN `auth_category` TINYINT(4) NOT NULL COMMENT '0:代码仓库权限 1:合并请求权限 3:疑修事件权限';
|
|
@ -0,0 +1,4 @@
|
|||
-- ----------------------------
|
||||
-- 表install_bot中添加字段 repo_owner:仓库拥有者login(组织/个人)
|
||||
-- ----------------------------
|
||||
ALTER TABLE `install_bot` ADD COLUMN (`repo_owner` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT '仓库拥有者login(组织/个人)');
|
|
@ -0,0 +1,4 @@
|
|||
-- ----------------------------
|
||||
-- 表install_bot中添加字段 webhook_response_msg:webhook请求返回信息
|
||||
-- ----------------------------
|
||||
ALTER TABLE `install_bot` ADD COLUMN `webhook_response_msg` TEXT DEFAULT NULL COMMENT 'webhook请求返回信息' AFTER `webhook_id`;
|
|
@ -39,7 +39,7 @@ CREATE TABLE `bot` (
|
|||
`private_key` text,
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
UNIQUE KEY `name` (`bot_name`) USING BTREE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=802 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of bot
|
||||
|
@ -195,3 +195,156 @@ CREATE TABLE `transfer_bot` (
|
|||
-- ----------------------------
|
||||
-- Records of transfer_bot
|
||||
-- ----------------------------
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `bot`;
|
||||
CREATE TABLE `bot` (
|
||||
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||
`bot_name` varchar(255) NOT NULL COMMENT 'bot名称',
|
||||
`bot_des` longtext COMMENT 'bot描述',
|
||||
`webhook` varchar(255) NOT NULL COMMENT 'bot回调url',
|
||||
`is_public` tinyint DEFAULT NULL COMMENT '0:私有1:公开',
|
||||
`logo` varchar(255) DEFAULT NULL COMMENT 'logo',
|
||||
`state` tinyint DEFAULT NULL COMMENT '0:挂起1:工作',
|
||||
`client_id` varchar(255) DEFAULT NULL COMMENT '客户端id(后台生成)',
|
||||
`client_secret` varchar(255) DEFAULT NULL COMMENT '客户端密钥(后台生成)',
|
||||
`web_url` varchar(255) DEFAULT NULL COMMENT '主页网址',
|
||||
`category` varchar(255) DEFAULT NULL COMMENT '类型',
|
||||
`install_num` int DEFAULT '0' COMMENT '下载数量',
|
||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`uid` int DEFAULT NULL,
|
||||
`owner_id` int DEFAULT NULL,
|
||||
`private_key` text,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `name` (`bot_name`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
|
||||
|
||||
-- Records of bot
|
||||
INSERT INTO `bot` VALUES
|
||||
('783', 'botnameegdret', 'miaoshusd', 'http://localhost:10000', '1', 'asdasdasfdg', '0', 'qwer', 'ert', 'botnameegdret', '疑修管理', '6', '2023-03-07 17:42:13', '2023-03-07 17:42:13', NULL, '84993', NULL),
|
||||
('791', 'botnameegdretui', 'miaoshusd', 'www.hauhahasd.com', '1', 'asdasdasfdg', '0', 'qwer', 'ert', 'botnameegdretui', '疑修管理', '1', '2023-03-07 17:23:28', '2023-03-06 23:05:28', NULL, '84993', NULL),
|
||||
('792', 'botnameegdretop', 'miaoshusd', 'www.hauhahasd.com', '0', 'asdasdasfdg', '0', 'qwer', 'ert', 'botnameegdretop', NULL, '0', '2023-03-06 23:05:29', '2023-03-06 23:05:29', NULL, '84993', NULL);
|
||||
|
||||
-- Table structure for bot_category
|
||||
DROP TABLE IF EXISTS `bot_category`;
|
||||
CREATE TABLE `bot_category` (
|
||||
`id` int NOT NULL,
|
||||
`category` varchar(255) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- Records of bot_category
|
||||
INSERT INTO `bot_category` VALUES
|
||||
('1', '疑修管理'),
|
||||
('2', '合并请求管理'),
|
||||
('3', '代码审阅'),
|
||||
('4', '代码质量'),
|
||||
('5', '依赖管理'),
|
||||
('6', '构建'),
|
||||
('7', '测试'),
|
||||
('8', '部署'),
|
||||
('9', '文档管理'),
|
||||
('10', '其他');
|
||||
|
||||
-- Table structure for bot_limit_event
|
||||
DROP TABLE IF EXISTS `bot_limit_event`;
|
||||
CREATE TABLE `bot_limit_event` (
|
||||
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||
`bot_id` int NOT NULL COMMENT 'bot的唯一标识',
|
||||
`read_write_code` tinyint NOT NULL COMMENT '0:只读1:读写2:无权限',
|
||||
`read_write_pr` tinyint NOT NULL COMMENT '0:只读1:读写2:无权限',
|
||||
`auth_category` tinyint NOT NULL COMMENT '0:代码仓库权限1:合并请求权限2:无权限',
|
||||
`event` tinyint NOT NULL COMMENT '0:git推送到存储库1:创建分支或标签2:删除分支或标签3:合并请求被打开或重新打开4:合并请求被分配5:无权限',
|
||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=33 DEFAULT CHARSET=utf8;
|
||||
|
||||
-- Records of bot_limit_event
|
||||
INSERT INTO `bot_limit_event` VALUES
|
||||
('18', '783', '0', '1', '0', '1', '2022-10-05 19:21:53', '2022-10-05 19:21:53'),
|
||||
('19', '791', '0', '1', '0', '1', '2022-10-07 20:19:22', '2022-10-07 20:19:22'),
|
||||
('20', '792', '1', '2', '0', '2', '2022-12-29 18:34:26', '2022-12-29 18:34:26'),
|
||||
('21', '793', '1', '2', '0', '1', '2022-12-29 18:42:26', '2022-12-29 18:42:26'),
|
||||
('23', '794', '1', '2', '0', '1', '2022-12-29 18:45:54', '2022-12-29 18:45:54'),
|
||||
('27', '799', '1', '2', '0', '1', '2022-12-29 19:30:05', '2022-12-29 19:30:05'),
|
||||
('28', '799', '2', '1', '1', '2', '2022-12-29 19:30:05', '2022-12-29 19:30:05');
|
||||
|
||||
-- Table structure for install_bot
|
||||
DROP TABLE IF EXISTS `install_bot`;
|
||||
CREATE TABLE `install_bot` (
|
||||
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||
`bot_id` int NOT NULL COMMENT 'bot唯一标识',
|
||||
`installer_id` int NOT NULL COMMENT '安装者唯一标识',
|
||||
`store_id` int NOT NULL COMMENT '仓库唯一标识',
|
||||
`state` tinyint NOT NULL COMMENT '0:挂起1:工作2:卸载',
|
||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`installer_login` varchar(255) NOT NULL,
|
||||
`store_repo` varchar(255) NOT NULL,
|
||||
`webhook_id` int DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=33 DEFAULT CHARSET=utf8;
|
||||
|
||||
-- Table structure for market_bot
|
||||
DROP TABLE IF EXISTS `market_bot`;
|
||||
CREATE TABLE `market_bot` (
|
||||
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||
`bot_id` int NOT NULL COMMENT 'bot唯一 标识',
|
||||
`market_name` varchar(255) DEFAULT NULL COMMENT '上市名称',
|
||||
`market_desc` varchar(255) DEFAULT NULL COMMENT '上市简介',
|
||||
`market_intro` longtext COMMENT '详细介绍',
|
||||
`first_func` varchar(255) NOT NULL COMMENT '主要功能',
|
||||
`second_func` varchar(255) DEFAULT NULL COMMENT '次要功能',
|
||||
`webhook` varchar(255) DEFAULT NULL COMMENT '回调url',
|
||||
`is_receive_ag1` tinyint DEFAULT '0' COMMENT '0:接收协议1:不接受收开发者协议',
|
||||
`is_receive_ag2` tinyint DEFAULT '0' COMMENT '0:接收协议1:不接受平台协议',
|
||||
`market_time` datetime DEFAULT NULL COMMENT '上市时间',
|
||||
`logo` varchar(255) DEFAULT NULL COMMENT '头像',
|
||||
`install_num` int DEFAULT '0' COMMENT '安装次数',
|
||||
`category` varchar(255) DEFAULT NULL COMMENT '类型',
|
||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `唯一` (`bot_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=55 DEFAULT CHARSET=utf8;
|
||||
|
||||
-- Records of market_bot
|
||||
INSERT INTO `market_bot` VALUES ('49', '783', 'qwe', 'asd', null, '代码审阅', '疑修管理', 'sad', '1', '1', '2023-03-06 21:07:01', 'sd', '6', 'asd', '2023-03-06 21:07:01', '2023-03-07 17:40:57');
|
||||
INSERT INTO `market_bot` VALUES ('54', '791', 'asder', 'asd', 'asdasd', '其他', '', 'www.asd.com', '0', '0', '2023-03-06 21:06:58', 'asd', '1', 'xcv', '2023-03-06 21:06:58', '2023-03-07 17:23:28');
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `register_bot`;
|
||||
CREATE TABLE `register_bot` (
|
||||
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||
`bot_id` int NOT NULL COMMENT 'bot唯一标识',
|
||||
`developer_id` int NOT NULL COMMENT 'bot开发者唯一标识',
|
||||
`create_time` datetime NOT NULL COMMENT '创建时间',
|
||||
`update_time` datetime NOT NULL COMMENT '更新时间',
|
||||
`developer_login` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `bot_id` (`bot_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;
|
||||
|
||||
-- Records of register_bot
|
||||
INSERT INTO `register_bot` (id, bot_id, developer_id, create_time, update_time, developer_login) VALUES
|
||||
(3, 783, 84993, '2023-03-07 09:46:37', '2023-03-07 09:46:37', 'durian'),
|
||||
(4, 791, 84993, '2023-03-07 09:46:37', '2023-03-07 09:46:37', 'durian'),
|
||||
(5, 792, 84993, '2023-03-07 09:46:35', '2023-03-07 09:46:35', 'durian');
|
||||
|
||||
-- Table structure for `transfer_bot`
|
||||
DROP TABLE IF EXISTS `transfer_bot`;
|
||||
CREATE TABLE `transfer_bot` (
|
||||
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||
`bot_id` int NOT NULL COMMENT 'bot唯一标识',
|
||||
`transfer_from_id` int NOT NULL COMMENT '转让者唯一标识',
|
||||
`transfer_to_id` int NOT NULL COMMENT '接收者唯一标识',
|
||||
`is_success` tinyint NOT NULL COMMENT '0:转让失败,1:转让成功 2:待接收',
|
||||
`transfer_time` datetime NOT NULL COMMENT '转让时间',
|
||||
`create_time` datetime NOT NULL COMMENT '创建时间',
|
||||
`update_time` datetime NOT NULL COMMENT '更新时间',
|
||||
`from_login` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
|
||||
`to_login` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
|
||||
|
|
|
@ -39,7 +39,7 @@ public class GitLinkApiTest {
|
|||
|
||||
@Test
|
||||
public void activeBotAuthTest(){
|
||||
Response response = api.activeBotAuth(84993,800,"auth_active");
|
||||
Response response = api.activeBotAuth(84993,802,"auth_active");
|
||||
System.out.println(response.getData());
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ public class GitLinkApiTest {
|
|||
|
||||
@Test
|
||||
public void addWebhook() throws JsonProcessingException {
|
||||
webhooks = new Webhook(true, "json", "GET", "123456", "http://localhost:10000", "*", new Object[]{"push"});
|
||||
webhooks = new Webhook(true, "json", "GET", "123456", "http://localhost:10000", "*", new Object[]{"push"}, "softbot");
|
||||
Object[] params = new Object[]{"xxq250", "ruoyi-vue-pro"};
|
||||
Response response = api.addWebhook(85175,params,webhooks);
|
||||
System.out.println(response.getData());
|
||||
|
@ -65,7 +65,7 @@ public class GitLinkApiTest {
|
|||
|
||||
@Test
|
||||
public void updateWebhook() throws JsonProcessingException {
|
||||
webhooks = new Webhook(false, "json", "GET", "123456", "http://localhost:10000", "*", new Object[]{"push"});
|
||||
webhooks = new Webhook(false, "json", "GET", "123456", "http://localhost:10000", "*", new Object[]{"push"}, "softbot");
|
||||
Object[] params = new Object[]{"xxq250", "ruoyi-vue-pro"};
|
||||
Response response = api.updateWebhook(85175,params,1082,webhooks);
|
||||
System.out.println(response.getData());
|
||||
|
|
|
@ -38,7 +38,7 @@ class RestTemplateUtilTests {
|
|||
@BeforeEach
|
||||
public void setUp() {
|
||||
mapper = new ObjectMapper();
|
||||
webhooks = new Webhook(true, "json", "GET", "123456", "http://localhost:10000", "*", new Object[]{"push"});
|
||||
webhooks = new Webhook(true, "json", "GET", "123456", "http://localhost:10000", "*", new Object[]{"push"}, "softbot");
|
||||
headParams = new HashMap<>();
|
||||
headParams.put("Authorization", "Bearer "+TOKEN);
|
||||
}
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue