71 lines
1.8 KiB
Protocol Buffer
71 lines
1.8 KiB
Protocol Buffer
syntax = "proto3";
|
||
package address;
|
||
option go_package = "./address";
|
||
|
||
|
||
// 地址库
|
||
service Method {
|
||
// 新增地址
|
||
rpc Add(AddressAddRequest) returns (StatusReply) {};
|
||
|
||
// 修改地址
|
||
rpc Set(AddressItem) returns (StatusReply) {};
|
||
|
||
// 获取一条地址
|
||
rpc Get(IdentRequest) returns (AddressItem) {};
|
||
|
||
// 获取地址列表
|
||
rpc List(FetchRequest) returns (AddressListReply) {};
|
||
|
||
// 删除一个地址
|
||
rpc Del(AddressDelRequest) returns (StatusReply) {};
|
||
}
|
||
|
||
message AddressItem {
|
||
int64 id = 1; // ID
|
||
string phone = 2; // 手机号
|
||
string country = 3; // 国家
|
||
string province = 4; // 省
|
||
string city = 5; // 市
|
||
string area = 6; // 区
|
||
string detail = 7; // 详情地址
|
||
string contact = 8; // 联系人
|
||
int32 status = 9; // 状态 -1为删除,1为正常,2为设置成默认
|
||
}
|
||
|
||
message AddressAddRequest {
|
||
string phone = 1; // 手机号
|
||
string country = 2; // 国家
|
||
string province = 3; // 省
|
||
string city = 4; // 市
|
||
string area = 5; // 区
|
||
string detail = 6; // 详情地址
|
||
string contact = 7; // 联系人
|
||
int32 status = 8; // 状态 -1为删除,1为正常,2为设置成默认
|
||
}
|
||
|
||
message FetchRequest {
|
||
int64 page_no=1; // 页数
|
||
int64 page_size=2; // 每页记录数
|
||
map<string,string> params=3; // 条件参数,key=val,eg key:category_id=?,vlaue=11
|
||
}
|
||
|
||
message IdentRequest{
|
||
int64 id = 1; // 唯一ID
|
||
string identity = 2; // 唯一码
|
||
}
|
||
|
||
message StatusReply{
|
||
int64 status = 1; // 状态码
|
||
string identity=2; // 标识码
|
||
string message=3; //状态说明
|
||
int64 timeseq=4; // 响应时间序列
|
||
}
|
||
|
||
message AddressListReply {
|
||
repeated AddressItem data = 1; // 地址列表
|
||
}
|
||
|
||
message AddressDelRequest {
|
||
repeated int64 id = 1; // ID
|
||
} |