增加torna 接口作者推送

This commit is contained in:
Forget 2021-05-10 10:32:14 +08:00
parent d9c97b96fa
commit b5a4aacae2
4 changed files with 16 additions and 4 deletions

View File

@ -90,6 +90,7 @@ public class TornaBuilder {
*/ */
public static void buildTorna(List<ApiDoc> apiDocs, ApiConfig apiConfig) { public static void buildTorna(List<ApiDoc> apiDocs, ApiConfig apiConfig) {
TornaApi tornaApi = new TornaApi(); TornaApi tornaApi = new TornaApi();
tornaApi.setAuthor(StringUtil.isEmpty(apiConfig.getAuthor()) ? System.getProperty("user.name") : apiConfig.getAuthor());
Apis api; Apis api;
List<Apis> apisList = new ArrayList<>(); List<Apis> apisList = new ArrayList<>();
//添加接口数据 //添加接口数据

View File

@ -2,6 +2,7 @@ package com.power.doc.builder.rpc;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.power.common.util.OkHttp3Util; import com.power.common.util.OkHttp3Util;
import com.power.common.util.StringUtil;
import com.power.doc.builder.ProjectDocConfigBuilder; import com.power.doc.builder.ProjectDocConfigBuilder;
import com.power.doc.constants.TornaConstants; import com.power.doc.constants.TornaConstants;
import com.power.doc.model.ApiConfig; import com.power.doc.model.ApiConfig;
@ -52,9 +53,9 @@ public class RpcTornaBuilder {
List<RpcApiDoc> apiDocList = docBuildTemplate.getApiData(configBuilder); List<RpcApiDoc> apiDocList = docBuildTemplate.getApiData(configBuilder);
buildTorna(apiDocList, config); buildTorna(apiDocList, config);
} }
public static void buildTorna(List<RpcApiDoc> apiDocs, ApiConfig apiConfig) { public static void buildTorna(List<RpcApiDoc> apiDocs, ApiConfig apiConfig) {
TornaApi tornaApi = new TornaApi(); TornaApi tornaApi = new TornaApi();
tornaApi.setAuthor(StringUtil.isEmpty(apiConfig.getAuthor()) ? System.getProperty("user.name") : apiConfig.getAuthor());
Apis api; Apis api;
List<Apis> apisList = new ArrayList<>(); List<Apis> apisList = new ArrayList<>();
//添加接口数据 //添加接口数据
@ -64,7 +65,7 @@ public class RpcTornaBuilder {
TornaUtil.setDebugEnv(apiConfig,tornaApi); TornaUtil.setDebugEnv(apiConfig,tornaApi);
api.setItems(buildDubboApis(a.getList())); api.setItems(buildDubboApis(a.getList()));
api.setIsFolder(TornaConstants.YES); api.setIsFolder(TornaConstants.YES);
api.setAuthor(apiConfig.getAuthor()); api.setAuthor(a.getAuthor());
api.setDubboInfo(new DubboInfo().builder() api.setDubboInfo(new DubboInfo().builder()
.setAuthor(a.getAuthor()) .setAuthor(a.getAuthor())
.setProtocol(a.getProtocol()) .setProtocol(a.getProtocol())

View File

@ -40,6 +40,15 @@ public class TornaApi {
*/ */
List<DebugEnv> debugEnvs; List<DebugEnv> debugEnvs;
List<Apis> apis; List<Apis> apis;
String author;
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public List<DebugEnv> getDebugEnvs() { public List<DebugEnv> getDebugEnvs() {
return debugEnvs; return debugEnvs;

View File

@ -35,11 +35,12 @@ public class ApiDocTest {
ApiConfig config = new ApiConfig(); ApiConfig config = new ApiConfig();
config.setServerUrl("http://127.0.0.1:8899"); config.setServerUrl("http://127.0.0.1:8899");
//config.setStrict(true); //config.setStrict(true);
config.setOpenUrl("http://127.0.0.1:8899/api"); config.setOpenUrl("http://demo.torna.cn/api");
config.setAppKey("20201216788835306945118208"); config.setAppKey("20201216788835306945118208");
config.setAppToken("c16931fa6590483fb7a4e85340fcbfef"); config.setAppToken("258e853573d44ef4a3e2caebdcafbc0f");
config.setSecret("W.ZyGMOB9Q0UqujVxnfi@.I#V&tUUYZR"); config.setSecret("W.ZyGMOB9Q0UqujVxnfi@.I#V&tUUYZR");
config.setDebugEnvName("测试环境"); config.setDebugEnvName("测试环境");
config.setAuthor("test");
config.setDebugEnvUrl("http://127.0.0.1"); config.setDebugEnvUrl("http://127.0.0.1");
//config.setTornaDebug(true); //config.setTornaDebug(true);