124 lines
4.4 KiB
Protocol Buffer
124 lines
4.4 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
package product;
|
|
option go_package="./product";
|
|
|
|
import "buf/validate/validate.proto";
|
|
import "google/api/annotations.proto";
|
|
|
|
service Product {
|
|
rpc Add(AddReq) returns (AddResp) {
|
|
option (google.api.http) = {
|
|
post: "/admin/v3/product"
|
|
body: "*"
|
|
};
|
|
}
|
|
rpc Edit(EditReq) returns (EditResp) {
|
|
option (google.api.http) = {
|
|
put: "/admin/v3/product"
|
|
body: "*"
|
|
};
|
|
}
|
|
rpc Items(ItemsReq) returns (ItemsResp) {
|
|
option (google.api.http) = {
|
|
get: "/admin/v3/product"
|
|
};
|
|
}
|
|
}
|
|
|
|
message ItemsReq {
|
|
string name = 1 [(buf.validate.field).string = {max_len: 256}];
|
|
uint32 page = 2 [(buf.validate.field) = {
|
|
ignore: IGNORE_IF_ZERO_VALUE,
|
|
uint32: {gte: 1}
|
|
}];
|
|
uint32 page_size = 3 [(buf.validate.field) = {
|
|
ignore: IGNORE_IF_ZERO_VALUE,
|
|
uint32: {gte: 1, lte: 100}
|
|
}];
|
|
}
|
|
|
|
message ItemsResp {
|
|
repeated Item items = 1;
|
|
}
|
|
|
|
message AddReq {
|
|
string name = 1 [(buf.validate.field).string = {min_len: 1, max_len: 256}];
|
|
string subhead = 2 [(buf.validate.field).string = {max_len: 255}];
|
|
string content = 3 [(buf.validate.field).string = {min_len: 1}];
|
|
uint32 sales_model = 4 [(buf.validate.field) = {
|
|
ignore: IGNORE_IF_ZERO_VALUE,
|
|
uint32: {in: [1, 2]}
|
|
}];
|
|
string model_code = 5 [(buf.validate.field).string = {max_len: 255}];
|
|
double price = 6 [(buf.validate.field).double = {gte: 0}];
|
|
double store_price = 7 [(buf.validate.field) = {ignore: IGNORE_IF_ZERO_VALUE, double: {gte: 0}}];
|
|
double sale_price = 8 [(buf.validate.field).double = {gte: 0}];
|
|
double share_price = 9 [(buf.validate.field).double = {gte: 0}];
|
|
double agent_price = 10 [(buf.validate.field).double = {gte: 0}];
|
|
string sale_reward = 11 [(buf.validate.field).string = {max_len: 255}];
|
|
string images = 12 [(buf.validate.field).string = {min_len: 1, max_len: 512}];
|
|
double weight = 13 [(buf.validate.field).double = {gte: 0}];
|
|
string cubage = 14 [(buf.validate.field).string = {max_len: 255}];
|
|
string waybill = 15 [(buf.validate.field).string = {max_len: 255}];
|
|
int32 period_validity = 16 [(buf.validate.field).int32 = {gte: 0}];
|
|
uint32 norms_number = 17 [(buf.validate.field) = {
|
|
ignore: IGNORE_IF_ZERO_VALUE,
|
|
uint32: {gte: 1}
|
|
}];
|
|
double box_number = 18 [(buf.validate.field).double = {gte: 0}];
|
|
uint32 type = 19 [(buf.validate.field) = {
|
|
ignore: IGNORE_IF_ZERO_VALUE,
|
|
uint32: {in: [1, 2, 3]}
|
|
}];
|
|
uint32 number = 20;
|
|
uint32 try_number = 21 [(buf.validate.field) = {
|
|
ignore: IGNORE_IF_ZERO_VALUE,
|
|
uint32: {gte: 1}
|
|
}];
|
|
string publish_time = 22 [(buf.validate.field).string = {max_len: 32}];
|
|
string label = 23 [(buf.validate.field).string = {max_len: 255}];
|
|
uint32 is_buy = 24 [(buf.validate.field) = {
|
|
ignore: IGNORE_IF_ZERO_VALUE,
|
|
uint32: {in: [1, 2]}
|
|
}];
|
|
uint32 is_index = 25 [(buf.validate.field) = {
|
|
ignore: IGNORE_IF_ZERO_VALUE,
|
|
uint32: {in: [1, 2]}
|
|
}];
|
|
string index_image = 26 [(buf.validate.field).string = {max_len: 255}];
|
|
|
|
// 删除字段方式
|
|
// reserved 2;
|
|
}
|
|
|
|
message AddResp {
|
|
}
|
|
|
|
message EditReq {
|
|
int64 id = 1 [(buf.validate.field).int64 = {gt: 0}];
|
|
string name = 2 [(buf.validate.field).string = {min_len: 1, max_len: 256}];
|
|
string subhead = 3 [(buf.validate.field).string = {max_len: 255}];
|
|
string content = 4 [(buf.validate.field).string = {min_len: 1}];
|
|
string waybill = 5 [(buf.validate.field).string = {max_len: 255}];
|
|
float weight = 6 [(buf.validate.field).float = {gte: 0}];
|
|
string cubage = 7 [(buf.validate.field).string = {max_len: 255}];
|
|
string images = 8 [(buf.validate.field).string = {min_len: 1, max_len: 512}];
|
|
int32 period_validity = 9 [(buf.validate.field).int32 = {gte: 0}];
|
|
string publish_time = 10 [(buf.validate.field).string = {max_len: 32}];
|
|
string label = 11 [(buf.validate.field).string = {max_len: 255}];
|
|
uint32 is_buy = 12 [(buf.validate.field) = {
|
|
ignore: IGNORE_IF_ZERO_VALUE,
|
|
uint32: {in: [1, 2]}
|
|
}];
|
|
uint32 is_index = 13 [(buf.validate.field) = {
|
|
ignore: IGNORE_IF_ZERO_VALUE,
|
|
uint32: {in: [1, 2]}
|
|
}];
|
|
string index_image = 14 [(buf.validate.field).string = {max_len: 255}];
|
|
}
|
|
|
|
message EditResp {
|
|
int64 id = 1;
|
|
}
|