实现集成的IP库/初步完成IP库制作API

This commit is contained in:
刘祥超
2022-08-21 20:36:56 +08:00
parent ed0f627ae4
commit 0e311496b6
19 changed files with 6400 additions and 4522 deletions

View File

@@ -5,14 +5,19 @@ package pb;
message IPLibraryFile {
int64 id = 1;
int64 fileId = 2;
bool isFinished = 3;
int64 createdAt = 4;
repeated string countryNames = 5;
repeated Province provinces = 6;
repeated City cities = 7;
repeated Town towns = 8;
repeated string providerNames = 9;
string name = 2;
int64 fileId = 3;
string template = 4;
repeated string emptyValues = 5;
int64 generatedFileId = 6;
int64 generatedAt = 7;
bool isFinished = 8;
int64 createdAt = 9;
repeated string countryNames = 10;
repeated Province provinces = 11;
repeated City cities = 12;
repeated Town towns = 13;
repeated string providerNames = 14;
message Province {
string countryName = 1;

View File

@@ -3,6 +3,7 @@ option go_package = "./pb";
package pb;
// 国家/地区
message RegionCountry {
int64 id = 1;
string name = 2;

View File

@@ -34,14 +34,10 @@ service IPLibraryService {
};
// 查询某个IP信息
rpc lookupIPRegion (LookupIPRegionRequest) returns (LookupIPRegionResponse) {
option deprecated = true;
};
rpc lookupIPRegion (LookupIPRegionRequest) returns (LookupIPRegionResponse);
// 查询一组IP信息
rpc lookupIPRegions (LookupIPRegionsRequest) returns (LookupIPRegionsResponse) {
option deprecated = true;
};
rpc lookupIPRegions (LookupIPRegionsRequest) returns (LookupIPRegionsResponse);
}
// 创建IP库

View File

@@ -11,9 +11,11 @@ import "models/model_region_city.proto";
import "models/model_region_town.proto";
import "models/model_region_provider.proto";
// IP库文件管理
service IPLibraryFileService {
// 查找所有已完成的IP库文件
rpc findAllFinishedIPLibraryFiles(FindAllFinishedIPLibraryFilesRequest) returns (FindAllFinishedIPLibraryFilesResponse);
// 查找所有未完成的IP库文件
rpc findAllUnfinishedIPLibraryFiles(FindAllUnfinishedIPLibraryFilesRequest) returns (FindAllUnfinishedIPLibraryFilesResponse);
@@ -40,6 +42,21 @@ service IPLibraryFileService {
// 生成IP库文件
rpc generateIPLibraryFile(GenerateIPLibraryFileRequest) returns (RPCSuccess);
// 设置某个IP库为已完成
rpc updateIPLibraryFileFinished(UpdateIPLibraryFileFinishedRequest) returns (RPCSuccess);
// 删除IP库文件
rpc deleteIPLibraryFile(DeleteIPLibraryFileRequest) returns (RPCSuccess);
}
// 查找所有已完成的IP库文件
message FindAllFinishedIPLibraryFilesRequest {
}
message FindAllFinishedIPLibraryFilesResponse {
repeated IPLibraryFile ipLibraryFiles = 1;
}
// 查找所有未完成的IP库文件
@@ -62,14 +79,15 @@ message FindIPLibraryFileResponse {
// 创建IP库文件
message CreateIPLibraryFileRequest {
string template = 1;
repeated string emptyValues = 2;
int64 fileId = 3;
bytes countriesJSON = 4;
bytes provincesJSON = 5;
bytes citiesJSON = 6;
bytes townsJSON = 7;
bytes providersJSON = 8;
string name = 1;
string template = 2;
repeated string emptyValues = 3;
int64 fileId = 4;
bytes countriesJSON = 5;
bytes provincesJSON = 6;
bytes citiesJSON = 7;
bytes townsJSON = 8;
bytes providersJSON = 9;
}
message CreateIPLibraryFileResponse {
@@ -155,4 +173,14 @@ message CheckProvidersWithIPLibraryFileIdResponse {
// 生成IP库文件
message GenerateIPLibraryFileRequest {
int64 ipLibraryFileId = 1;
}
// 设置某个IP库为已完成
message UpdateIPLibraryFileFinishedRequest {
int64 ipLibraryFileId = 1;
}
// 删除IP库文件
message DeleteIPLibraryFileRequest {
int64 ipLibraryFileId = 1;
}

View File

@@ -6,7 +6,7 @@ package pb;
import "models/model_region_country.proto";
import "models/rpc_messages.proto";
// 国家相关服务
// 国家/地区相关服务
service RegionCountryService {
// 查找所有的国家/地区列表
rpc findAllEnabledRegionCountries (FindAllEnabledRegionCountriesRequest) returns (FindAllEnabledRegionCountriesResponse) {