proto/service/resource.proto

234 lines
6.4 KiB
Protocol Buffer
Raw Normal View History

2023-12-04 10:21:07 +00:00
syntax = "proto3"; //版本声明使用v3版本
package resource;
option go_package = "gitlab.fusenpack.com/backend/resource;service";
// 导入google/api/annotations.proto 注释依赖
import "google/api/annotations.proto";
import "service/basic.proto";
import "google/protobuf/struct.proto";
import "google/protobuf/any.proto";
//定义服务
2023-12-06 08:18:22 +00:00
service resource {
2023-12-07 07:49:16 +00:00
// 删除资源详情
rpc ResourceDelete(ResourceDeleteReq) returns (ResourceDeleteRes) {}
// 更新资源详情
rpc ResourceSave(ResourceSaveReq) returns (ResourceSaveRes) {}
2023-12-06 08:18:22 +00:00
2023-12-04 10:21:07 +00:00
// 获取资源详情
2023-12-07 07:49:16 +00:00
rpc ResourceInfo(ResourceInfoReq) returns (ResourceInfoRes) {}
2023-12-05 08:12:13 +00:00
// 获取资源列表
2023-12-07 07:49:16 +00:00
rpc ResourceList(ResourceListReq) returns (ResourceListRes) {}
2023-12-06 08:18:22 +00:00
// 后端上传--单文件
2023-12-06 10:34:22 +00:00
rpc UploadFileBackend(UploadFileBackendReq) returns (UploadFileBackendRes) {}
2023-12-06 08:18:22 +00:00
// 后端上传--分片上传
2023-12-06 10:34:22 +00:00
rpc UploadFileBackendFragment(UploadFileBackendFragmentReq) returns (UploadFileBackendFragmentRes) {}
// logo合图
rpc LogoCombine(LogoCombineReq) returns (LogoCombineRes) {}
2023-12-07 07:49:16 +00:00
// logo基础信息
rpc LogoInfoSet(LogoInfoSetReq) returns (LogoInfoSetRes) {}
// logo裁剪处理
rpc LogoCropping(LogoCroppingReq) returns (LogoCroppingRes) {}
}
/* 更新资源详情 */
message ResourceSaveReq {
optional ResourceFilter filter=1;
optional ResourceFilter save=2;
}
message ResourceSaveRes {}
/* 更新资源详情 */
/* 删除资源详情 */
message ResourceDeleteReq {
optional ResourceFilter filter=1;
int64 delete_type = 12; // 删除类型1=删除数据库 2=删除s3 3=删除数据库+s3
int64 delete_limit = 13; // 删除数量
}
message ResourceDeleteRes {}
/* 删除资源详情 */
/* logo裁剪处理 */
message LogoCroppingReq {
string is_remove_bg=1;
string logo_file=2;
string width=3;
string height=4;
string proportion=5;
int64 handle_type = 100; // 类型1=缓存 2=重新 3=临时
int64 user_id = 101;
int64 guest_id = 102;
}
message LogoCroppingRes {
string resource_id=1;
string resource_url=2;
bool ismax_proportion=3;
repeated string img_color=4;
}
/* logo裁剪处理 */
/* logo基础信息 */
message LogoInfoSetReq {
string logo_url=1;
string version=2;
int64 is_all_template=3;
}
message LogoInfoSetRes {
string info =1;
2023-12-06 10:34:22 +00:00
}
2023-12-07 07:49:16 +00:00
/* logo基础信息 */
2023-12-06 10:34:22 +00:00
/* logo合图 */
message LogoCombineReq {
int64 product_template_v2_info_id =1;
string product_template_v2_info_material_img =2;
string product_template_v2_info_template_info =3;
string template_tag =4;
string website=5;
string slogan=6;
string address=7;
string phone=8;
string qrcode=9;
string logo_url=10;
string resolution=11;
TemplateTagColor template_tag_color=12;
string logo_metadata=13;
repeated TemplateTagGroups template_tag_groups=14;
2023-12-07 07:49:16 +00:00
int64 handle_type = 100; // 类型1=缓存 2=重新 3=临时
2023-12-06 10:34:22 +00:00
int64 user_id = 101;
int64 guest_id = 102;
}
message TemplateTagColor {
repeated Color color =1;
int64 index = 2;
}
message Color {
repeated string names = 1;
}
message TemplateTagGroups {
string tag =1;
string name =2;
string value =3;
int64 fixed =4;
2023-12-05 08:12:13 +00:00
}
2023-12-06 10:34:22 +00:00
message LogoCombineRes {
2023-12-07 07:49:16 +00:00
string resource_id = 4;
string resource_url = 6;
int64 diff_time_logo_combine=15; // 合图算法时间
int64 diff_time_upload_file=16; // 合图上传时间
2023-12-06 10:34:22 +00:00
}
/* logo合图 */
2023-12-06 08:18:22 +00:00
/* 后端上传--分片上传 */
message UploadFileBackendFragmentReq {
string file_name = 1; // 文件名
2023-12-07 07:49:16 +00:00
bytes file_content = 3; // 文件流
bytes file_header = 4; // 文件头
string file_data = 5; // base64
int64 chunk_number = 6; // 当前分片号:1、2、3
int64 total_chunks = 7; // 总分片数:3
int64 api_type = 10; // 请求类型1=对外2=对内
int64 upload_bucket = 11; // 上传桶类型1=持久2=缓存
2023-12-06 08:18:22 +00:00
string file_key = 12; // 哈希
string source = 13;// 来源
string metadata = 14; // json格式
int64 refresh = 15; // 是否覆盖
string resource_id = 16; // 资源ID
string backup_type = 17; // 资源备份oss
string upload_type = 18; // 上传方式s3
2023-12-07 07:49:16 +00:00
int64 CacheType = 100; // 缓存类型0=不缓存 1=存储数据库
int64 user_id = 101;
int64 guest_id = 102;
2023-12-06 08:18:22 +00:00
}
message UploadFileBackendFragmentRes {
string resource_type = 5;
string resource_id = 4;
string resource_url = 6;
}
/* 后端上传--分片上传 */
/* 后端上传--单文件 */
message UploadFileBackendReq {
string file_name = 1; // 文件名
bytes file_content = 2; // 文件流
bytes file_header = 3; // 文件头
string file_data = 6; // base64
2023-12-07 07:49:16 +00:00
int64 api_type = 10; // 请求类型1=对外2=对内
int64 upload_bucket = 11; // 上传桶类型1=持久2=缓存
2023-12-06 08:18:22 +00:00
string file_key = 12; // 哈希
string source = 13;// 来源
string metadata = 14; // json格式
int64 refresh = 15; // 是否覆盖
string resource_id = 16; // 资源ID
string backup_type = 17; // 资源备份oss
string upload_type = 18; // 上传方式s3
2023-12-07 07:49:16 +00:00
int64 CacheType = 100; // 缓存类型0=不缓存 1=存储数据库
int64 user_id = 101;
int64 guest_id = 102;
2023-12-06 08:18:22 +00:00
}
message UploadFileBackendRes{
string resource_type = 5;
string resource_id = 4;
string resource_url = 6;
}
/* 后端上传--文件流--单文件 */
2023-12-05 08:12:13 +00:00
/* 获取资源列表 */
2023-12-07 07:49:16 +00:00
message ResourceListReq{
optional ResourceFilter filter=1;
2023-12-05 08:12:13 +00:00
2023-12-05 09:31:28 +00:00
optional int64 current_page =101;
optional int64 per_page =102;
optional string order_by = 103;
2023-12-04 10:21:07 +00:00
}
2023-12-07 07:49:16 +00:00
message ResourceListRes{
2023-12-06 10:34:22 +00:00
repeated basic.ResourceInfo list=1;
basic.Meta meta =2;
}
2023-12-05 08:12:13 +00:00
/* 获取资源列表 */
2023-12-04 10:21:07 +00:00
/* 获取资源详情 */
2023-12-07 07:49:16 +00:00
message ResourceInfoReq{
optional ResourceFilter filter=1;
}
message ResourceInfoRes{
basic.ResourceInfo info =1;
}
message ResourceFilter {
2023-12-04 10:21:07 +00:00
optional string resource_id = 1;
optional int64 guest_id =2;
optional int64 user_id =3;
optional string resource_type = 4;
optional string resource_url = 5;
optional string version = 6;
optional int64 api_type = 7;
optional string bucket_name = 8;
optional string source = 9;
2023-12-07 07:49:16 +00:00
optional google.protobuf.Struct filters= 10; // 其他过滤条件
optional ResourceIds resource_ids =11; // 资源ID列表
optional string metadata = 12;
2023-12-04 10:21:07 +00:00
}
2023-12-07 07:49:16 +00:00
message ResourceIds {
repeated string resource_id = 1;
2023-12-06 10:34:22 +00:00
}
2023-12-04 10:21:07 +00:00
/* 获取资源详情 */