Files
lone-services/rpc/product/product.proto
T
2026-10-09 13:21:59 +08:00

389 lines
8.2 KiB
Protocol Buffer
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
syntax = "proto3";
package product;
option go_package="lone-services/rpc/product";
import "google/api/annotations.proto";
import "google/protobuf/empty.proto";
service Product {
rpc Create(CreateReq) returns (Response) {
option (google.api.http) = {
post: "/admin/v3/product"
body: "*"
};
}
rpc Info(InfoReq) returns (Response) {
option (google.api.http) = {
get: "/admin/v3/product/info"
body: "*"
};
}
rpc Items(ItemsReq) returns (Response) {
option (google.api.http) = {
get: "/admin/v3/product"
body: "*"
};
}
rpc Names(NamesReq) returns (Response) {
option (google.api.http) = {
get: "/admin/v3/product/names"
body: "*"
};
}
rpc Status(StatusReq) returns (Response) {
option (google.api.http) = {
put: "/admin/v3/product/status"
body: "*"
};
}
rpc Sort(SortReq) returns (Response) {
option (google.api.http) = {
put: "/admin/v3/product/sort"
body: "*"
};
}
// 审核列表: status: 1: 一审, 2: 二审
rpc Verify(VerifyReq) returns (Response) {
option (google.api.http) = {
get: "/admin/v3/product/verify"
body: "*"
};
}
// 一审通过/驳回
rpc VerifyFirst(VerifyStatusReq) returns (Response) {
option (google.api.http) = {
put: "/admin/v3/product/verify/first"
body: "*"
};
}
// 二审通过/驳回
rpc VerifySecond(VerifyStatusReq) returns (Response) {
option (google.api.http) = {
put: "/admin/v3/product/verify/second"
body: "*"
};
}
// 编辑申请
rpc EditApply(EditApplyReq) returns (Response) {
option (google.api.http) = {
post: "/admin/v3/product/edit/apply"
body: "*"
};
}
// 编辑基础信息
rpc EditBase(EditBaseReq) returns (Response) {
option (google.api.http) = {
put: "/admin/v3/product/base"
body: "*"
};
}
// 编辑敏感信息(进入一审)
rpc EditSusceptible(EditSusceptibleReq) returns (Response) {
option (google.api.http) = {
put: "/admin/v3/product/susceptible"
body: "*"
};
}
// TODO: 临时接口,企微编辑申请审批对接后删除
rpc EditApplyPass(EditApplyPassReq) returns (Response) {
option (google.api.http) = {
put: "/admin/v3/product/edit/apply/pass"
body: "*"
};
}
// 增加库存
rpc NumberAdd(NumberAddReq) returns (Response) {
option (google.api.http) = {
put: "/admin/v3/product/number"
body: "*"
};
}
rpc ApiItems(ApiItemsReq) returns (Response) {
option (google.api.http) = {
get: "/api/v3/product"
body: "*"
};
}
rpc ApiInfo(ApiInfoReq) returns (Response) {
option (google.api.http) = {
get: "/api/v3/product/info"
body: "*"
};
}
// 增减库存
rpc Number(NumberReq) returns (google.protobuf.Empty);
// 批量增减库存
rpc NumberItems(NumberItemsReq) returns (google.protobuf.Empty);
// 获取单个产品详情
rpc InfoById(InfoByIdReq) returns (Item);
// 获取多个产品详情
rpc ItemsByIds(ItemsByIdsReq) returns (ItemsByIdsData);
rpc InternalItems(InternalItemsReq) returns (ItemsByIdsData);
}
message Response {
int32 code = 1;
string msg = 2;
string data = 3;
}
message InfoByIdReq {
int64 id = 1;
}
message ItemsByIdsReq {
repeated int64 ids = 1;
}
message ItemsByIdsData {
repeated Item items = 1;
}
message CreateReq {
string name = 1;
string subhead = 2;
string content = 3;
uint32 sales_model = 4;
string model_code = 5;
double price = 6;
double store_price = 7;
double sale_price = 8;
double share_price = 9;
double agent_price = 10;
string sale_reward = 11;
repeated string images = 12;
double weight = 13;
string cubage = 14;
string waybill = 15;
int32 period_validity = 16;
uint32 norms_number = 17;
double box_number = 18;
uint32 type = 19;
uint32 number = 20;
uint32 try_number = 21;
string publish_time = 22;
string label = 23;
uint32 is_buy = 24;
uint32 is_index = 25;
string index_image = 26;
}
message InfoReq {
int64 id = 1;
}
message ItemsReq {
string name = 1;
uint32 page = 2;
uint32 page_size = 3;
}
// 内部产品列表;status、type 为空则不加对应筛选条件
message InternalItemsReq {
repeated uint32 status = 1;
repeated uint32 type = 2;
}
message NamesReq {}
message StatusReq {
int64 id = 1;
uint32 status = 2;
string reason = 3;
}
message SortReq {
int64 id = 1;
uint32 sort = 2;
}
// status: 1: 一审列表, 2: 二审列表
message VerifyReq {
uint32 status = 1;
uint32 page = 2;
uint32 page_size = 3;
}
// id 为 verify 表主键;status: 1: 通过, 2: 驳回
message VerifyStatusReq {
int64 id = 1;
uint32 status = 2;
string reason = 3;
}
message EditApplyReq {
int64 id = 1;
string reason = 2;
}
// TODO: 临时,企微对接后删除
message EditApplyPassReq {
int64 id = 1;
}
message EditBaseReq {
int64 id = 1;
string name = 2;
string subhead = 3;
string content = 4;
string waybill = 5;
double weight = 6;
string cubage = 7;
repeated string images = 8;
int32 period_validity = 9;
string publish_time = 10;
string label = 11;
uint32 is_buy = 12;
uint32 is_index = 13;
string index_image = 14;
}
message EditSusceptibleReq {
int64 id = 1;
string model_code = 2;
double price = 3;
double store_price = 4;
double sale_price = 5;
double share_price = 6;
double agent_price = 7;
string sale_reward = 8;
uint32 norms_number = 9;
double box_number = 10;
uint32 type = 11;
}
// type: 1 增加, 2 减少;number 为变更数量
message NumberReq {
int64 id = 1;
uint32 type = 2;
uint32 number = 3;
}
message NumberItem {
int64 id = 1;
uint32 number = 2;
}
// type: 1 增加, 2 减少
message NumberItemsReq {
uint32 type = 1;
repeated NumberItem items = 2;
}
message NumberAddReq {
int64 id = 1;
uint32 number = 2;
}
message ApiItemsReq {
string name = 1;
}
message ApiInfoReq {
int64 id = 1;
}
// C 端产品字段(对齐老 ProductWebInfo)
message ApiItem {
int64 id = 1;
string name = 2;
string subhead = 3;
string content = 4;
string model_code = 5;
double price = 6;
double store_price = 7;
double sale_price = 8;
repeated string images = 9;
string label = 10;
uint32 is_buy = 11;
int32 period_validity = 12;
uint32 is_index = 13;
string index_image = 14;
uint32 type = 15;
uint32 norms_number = 16;
uint32 number = 17;
uint32 is_permit = 18;
}
message ItemsData {
int64 count = 1;
repeated Item items = 2;
}
message VerifyItemsData {
int64 count = 1;
repeated VerifyItem items = 2;
}
message VerifyParams {
int64 id = 1;
string model_code = 2;
double price = 3;
double store_price = 4;
double sale_price = 5;
double share_price = 6;
double agent_price = 7;
string sale_reward = 8;
uint32 type = 9;
uint32 norms_number = 10;
double box_number = 11;
int64 verify_id = 12;
}
message VerifyItem {
string name = 1;
uint32 sales_model = 2;
VerifyParams new = 3;
VerifyParams old = 4;
}
message NameItem {
int64 id = 1;
string name = 2;
}
message Item {
int64 id = 1;
string name = 2;
string subhead = 3;
string content = 4;
string model_code = 5;
double price = 6;
double store_price = 7;
double sale_price = 8;
double share_price = 9;
double agent_price = 10;
string sale_reward = 11;
uint32 sales_model = 12;
string waybill = 13;
uint32 status = 14;
double weight = 15;
uint32 is_index = 16;
string index_image = 17;
string cubage = 18;
string label = 19;
repeated string images = 20;
uint32 is_buy = 21;
int32 period_validity = 22;
string publish_time = 23;
uint32 type = 24;
uint32 norms_number = 25;
double box_number = 26;
uint32 sort = 27;
uint32 number = 28;
uint32 verify_status = 29;
int64 verify_id = 30;
string verify_name = 31;
int64 verify_second_id = 32;
string verify_second_name = 33;
string reason = 34;
string admin_name = 35;
uint32 edit = 36;
}