399 lines
11 KiB
Protocol Buffer
399 lines
11 KiB
Protocol Buffer
|
syntax = "proto3";
|
|||
|
package org;
|
|||
|
option go_package = "./;org";
|
|||
|
|
|||
|
// /Users/edy/go/src/org/proto/org.proto START
|
|||
|
|
|||
|
|
|||
|
message Identity {
|
|||
|
string identity = 1;
|
|||
|
}
|
|||
|
|
|||
|
message Empty {}
|
|||
|
service Org{
|
|||
|
|
|||
|
rpc List(CompanyListRequest) returns (CompanyListReply) {}
|
|||
|
rpc Get(Identity) returns (CompanyItem) {}
|
|||
|
// Add 企业代为创建企业
|
|||
|
rpc Add(CompanyItem) returns (Identity) {}
|
|||
|
rpc Modify(CompanyItem) returns (Identity) {}
|
|||
|
|
|||
|
rpc DeliveryAddressList(DeliveryAddressListRequest) returns (DeliveryAddressListReply) {}
|
|||
|
rpc DeliveryAddressModify(DeliveryAddressItem) returns (Identity) {}
|
|||
|
rpc DeliveryAddressDelete(Identity) returns (Empty) {}
|
|||
|
|
|||
|
rpc CollectionInformation (Empty) returns (CollectionInformationItem) {}
|
|||
|
rpc CollectionInformationModify(CollectionInformationItem) returns (Identity) {}
|
|||
|
|
|||
|
rpc Login(LoginRequest) returns (LoginReply) {}
|
|||
|
rpc Register(RegisterRequest) returns (RegisterReply) {}
|
|||
|
|
|||
|
// ChangeChoicedCompany 切换登录企业
|
|||
|
rpc ChangeChoicedCompany(ChangeChoicedCompanyRequest) returns (ChangeChoicedCompanyReply) {}
|
|||
|
|
|||
|
// CheckPhoneOrAccountExists 检查phone/account 是否已注册过
|
|||
|
rpc CheckPhoneOrAccountExists(CheckPhoneOrAccountExistsRequest) returns (CheckPhoneOrAccountExistsReply){}
|
|||
|
|
|||
|
// ForgetPassword 忘记密码
|
|||
|
rpc ForgetPassword (ForgetPasswordRequest) returns (ForgetPasswordReply) {}
|
|||
|
// ResetPassword 重置密码
|
|||
|
rpc ResetPassword (ResetPasswordRequest) returns (ResetPasswordReply) {}
|
|||
|
|
|||
|
// InvitationCreate 创建邀请
|
|||
|
rpc InvitationCreate (InvitationCreateReqest) returns (InvitationCreateReply) {}
|
|||
|
// InvitationInformation 邀请信息
|
|||
|
rpc InvitationInformation (InvitationInformationRequest) returns (InvitationInformationReply) {}
|
|||
|
// InvitationJoin 接收邀请
|
|||
|
rpc InvitationJoin (InvitationJoinRequest) returns (InvitationJoinReply) {}
|
|||
|
// InvitationJoinConfirmed 公司邀请确认
|
|||
|
rpc InvitationJoinConfirmed (InvitationJoinConfirmedRequest) returns (Empty) {}
|
|||
|
|
|||
|
}
|
|||
|
message InvitationCreateReqest {
|
|||
|
int32 genre = 1; // 类型: 1 员工邀请, 2 企业邀请
|
|||
|
int32 role = 2;// 员工邀请时有效: 1 工作人员 2 管理员
|
|||
|
int32 company_genre = 3; //企业邀请时有效: 1 供货企业 2 分销企业
|
|||
|
}
|
|||
|
message InvitationJoinConfirmedRequest {
|
|||
|
string identity = 1;
|
|||
|
string name = 2;
|
|||
|
string unicode = 3;
|
|||
|
}
|
|||
|
|
|||
|
message InvitationJoinReply {
|
|||
|
// 当公司邀请时,返回关联的可用的公司列表信息
|
|||
|
repeated InvitationJoinReplyItem companys = 1;
|
|||
|
string token = 2;
|
|||
|
}
|
|||
|
|
|||
|
message InvitationJoinReplyItem {
|
|||
|
string identity = 1;
|
|||
|
string name = 2;
|
|||
|
string logo = 3; // 企业Logo
|
|||
|
string profile = 4;// 企业头像
|
|||
|
int32 genre = 5; // 角色类型: 1 工作人员, 2 管理人员
|
|||
|
string unicode = 6;
|
|||
|
}
|
|||
|
message InvitationJoinRequest {
|
|||
|
string request_id = 1;
|
|||
|
string name = 2;
|
|||
|
string phone = 3;
|
|||
|
string verify_code = 4;
|
|||
|
}
|
|||
|
message InvitationInformationRequest {
|
|||
|
string request_id = 1;
|
|||
|
}
|
|||
|
message InvitationInformationReply {
|
|||
|
int32 genre = 1; // 类型: 1 员工邀请, 2 企业邀请
|
|||
|
string creator_name = 2;
|
|||
|
string company_name = 3;
|
|||
|
int32 company_genre = 4; //企业邀请时有效: 1 供货企业 2 分销企业
|
|||
|
}
|
|||
|
|
|||
|
message InvitationCreateReply {
|
|||
|
string request_id = 1;
|
|||
|
}
|
|||
|
message ResetPasswordRequest {
|
|||
|
string account = 1;
|
|||
|
string password = 2;
|
|||
|
string password_conformed = 3;
|
|||
|
}
|
|||
|
|
|||
|
message ResetPasswordReply {
|
|||
|
// string token = 1;
|
|||
|
}
|
|||
|
message ForgetPasswordRequest {
|
|||
|
string phone = 1;
|
|||
|
string verify_code = 2;
|
|||
|
}
|
|||
|
|
|||
|
message ForgetPasswordReply {
|
|||
|
string token = 1;
|
|||
|
string account = 2; // 表示账号是否为空
|
|||
|
}
|
|||
|
|
|||
|
message CheckPhoneOrAccountExistsRequest {
|
|||
|
string phone = 1;
|
|||
|
string account = 2;
|
|||
|
}
|
|||
|
message CheckPhoneOrAccountExistsReply {
|
|||
|
bool exists = 1;
|
|||
|
}
|
|||
|
|
|||
|
message ChangeChoicedCompanyRequest {
|
|||
|
string company_identity = 1;
|
|||
|
}
|
|||
|
|
|||
|
message ChangeChoicedCompanyReply {
|
|||
|
string token = 1;
|
|||
|
}
|
|||
|
message LoginRequest {
|
|||
|
string account = 1;
|
|||
|
string password = 2;
|
|||
|
string phone = 3;
|
|||
|
string verify_code = 4;
|
|||
|
int32 login_genre = 5; // 登陆类型: 1 账密; 2 手机验证码
|
|||
|
}
|
|||
|
|
|||
|
message LoginReply {
|
|||
|
string token = 1;
|
|||
|
string identity = 2;
|
|||
|
repeated LoginReplyCompanyItem list = 3;
|
|||
|
string has_choiced_company_identity = 4;
|
|||
|
string name = 5;
|
|||
|
string account = 6;
|
|||
|
int32 status = 7;
|
|||
|
string created_at = 8;
|
|||
|
}
|
|||
|
|
|||
|
message LoginReplyCompanyItem {
|
|||
|
string identity = 1;
|
|||
|
string name = 2;
|
|||
|
string logo = 3; // 企业Logo
|
|||
|
string profile = 4;// 企业头像
|
|||
|
int32 genre = 5; // 角色类型: 1 工作人员, 2 管理人员
|
|||
|
}
|
|||
|
|
|||
|
message RegisterRequest{
|
|||
|
string name = 1;
|
|||
|
string phone = 2;
|
|||
|
string verify_code = 3;
|
|||
|
string account = 4;
|
|||
|
string password = 5;
|
|||
|
string password_confirmed = 6;
|
|||
|
}
|
|||
|
|
|||
|
message RegisterReply {
|
|||
|
string token = 1;
|
|||
|
string identity = 2;
|
|||
|
string name = 3;
|
|||
|
string account = 4;
|
|||
|
}
|
|||
|
|
|||
|
message CompanyListRequest {
|
|||
|
int64 page_no = 1; // 页数
|
|||
|
int64 page_size = 2; // 每页记录数
|
|||
|
string name = 3; // 企业名称
|
|||
|
int32 status = 4; // 认证状态: 1 已注册、2 已认证
|
|||
|
int32 relation_genre = 5; // 关联关系类型: 1 供货企业、2 分销企业、
|
|||
|
int32 relation_status = 6; // 关联关系状态
|
|||
|
string registered_start_at = 7; // 注册时间-开始,格式:2006-01-02 15:04:05
|
|||
|
string registered_end_at = 8; // 注册时间-结束格式:2006-01-02 15:04:05
|
|||
|
|
|||
|
bool with_statistics = 9;// 是否需要查询统计信息
|
|||
|
}
|
|||
|
|
|||
|
message CompanyListReply {
|
|||
|
repeated CompanyItem list = 1;
|
|||
|
int64 count = 2;
|
|||
|
CompanyStatisticsData statistics = 3;
|
|||
|
}
|
|||
|
|
|||
|
message CompanyItem {
|
|||
|
int32 id = 1;
|
|||
|
string identity = 2;
|
|||
|
string name = 3;// 企业名称
|
|||
|
string unicode = 4;// 信用代码
|
|||
|
string logo = 5; // 企业Logo
|
|||
|
string profile = 6;// 企业头像
|
|||
|
int32 genre = 7; // 企业类型: 1 企业、2 资金方、3 物流企业 etc.
|
|||
|
string registered_at = 8; // 注册时间
|
|||
|
string authorized_at = 9;// 认证时间
|
|||
|
int32 status = 10;// 认证状态: 1 已注册、2 已认证
|
|||
|
int32 relation_genre = 11;// 关联关系类型: 1分销企业、2 供货企业 3 直营企业 4 直营个人
|
|||
|
int32 relation_status = 12;// 关联关系状态: 1 正常(表示关系可用)、2 已停用(表示关系不可用)
|
|||
|
string contact_name = 13;// 联系人
|
|||
|
string contact_phone = 14;// 联系电话
|
|||
|
string contact_address = 15;// 联系地址(补充地址)
|
|||
|
string province_identity = 16;//省级identity
|
|||
|
string city_identity = 17;// 市级identity
|
|||
|
string district_identity = 18;// 区级identity
|
|||
|
|
|||
|
LoginMessage login_message = 19;
|
|||
|
}
|
|||
|
|
|||
|
// 登录关联信息
|
|||
|
message LoginMessage {
|
|||
|
string account = 1; // 登录账号
|
|||
|
string password = 2; // 登录密码
|
|||
|
string password_confirmed = 3; // 确认密码密码,仅注册/修改需要
|
|||
|
string phone = 4;
|
|||
|
string verify_code = 5;
|
|||
|
string name = 6;
|
|||
|
}
|
|||
|
|
|||
|
message CompanyStatisticsData {
|
|||
|
int64 total = 1; // 总的企业数
|
|||
|
int64 available = 2; // 可用的企业数
|
|||
|
int64 disable = 3;// 停用企业数
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
message DeliveryAddressListRequest {
|
|||
|
int64 page_no = 1; // 页数
|
|||
|
int64 page_size = 2; // 每页记录数
|
|||
|
string contact_name = 3;
|
|||
|
string contact_phone = 4;
|
|||
|
}
|
|||
|
|
|||
|
message DeliveryAddressListReply{
|
|||
|
repeated DeliveryAddressItem list = 1;
|
|||
|
int64 count =2;
|
|||
|
}
|
|||
|
|
|||
|
message DeliveryAddressItem {
|
|||
|
string identity = 1;
|
|||
|
string contact_name = 2;// 联系人
|
|||
|
string contact_phone = 3;// 联系电话
|
|||
|
string contact_address = 4;// 联系地址(补充地址)
|
|||
|
string province_identity = 5;//省级identity
|
|||
|
string city_identity = 6;// 市级identity
|
|||
|
string district_identity = 7;// 区级identity
|
|||
|
bool is_default = 8;
|
|||
|
string created_at = 9;
|
|||
|
}
|
|||
|
|
|||
|
message CollectionInformationItem {
|
|||
|
string company_identity = 2;
|
|||
|
string card_no = 3;
|
|||
|
string deposit_bank = 4;
|
|||
|
string payment_line = 5;
|
|||
|
string remark = 6;
|
|||
|
}
|
|||
|
// END
|
|||
|
|
|||
|
|
|||
|
// /Users/edy/go/src/org/proto/role.proto START
|
|||
|
|
|||
|
service Role{
|
|||
|
|
|||
|
rpc List(RoleRequest) returns (RoleReply) {}
|
|||
|
rpc Modify(RoleItem) returns (Identity) {}
|
|||
|
rpc Delete(Identity) returns (Empty) {}
|
|||
|
}
|
|||
|
message RoleRequest {
|
|||
|
repeated string company_identity = 1; // 企业identity,如果不传具体的identity就查询所有的
|
|||
|
}
|
|||
|
|
|||
|
message RoleReply {
|
|||
|
map<string,RoleList> kv =1; // key:company_identity
|
|||
|
}
|
|||
|
|
|||
|
message RoleList {
|
|||
|
repeated RoleItem list = 1;
|
|||
|
}
|
|||
|
message RoleItem {
|
|||
|
int32 id = 1;
|
|||
|
string identity = 2;
|
|||
|
string name = 3;
|
|||
|
string company_identity = 4;
|
|||
|
string created_at = 5;
|
|||
|
}
|
|||
|
// END
|
|||
|
|
|||
|
|
|||
|
// /Users/edy/go/src/org/proto/staff.proto START
|
|||
|
|
|||
|
service Staff{
|
|||
|
|
|||
|
rpc List(StaffListRequest) returns (StaffListReply) {}
|
|||
|
|
|||
|
rpc Add(StaffItem) returns (Identity) {}
|
|||
|
rpc Modify(StaffItem) returns (Identity) {}
|
|||
|
|
|||
|
rpc Delete(Identity) returns (Empty) {}
|
|||
|
|
|||
|
rpc StaffCompanyChangeStatus(StaffCompanyChangeStatusRequest) returns (Empty) {}
|
|||
|
rpc StaffCompanyChangeRole(StaffCompanyChangeRoleRequest) returns (Empty) {}
|
|||
|
// GetProfile 获取个人信息
|
|||
|
rpc GetProfile(Empty) returns (StaffItem) {}
|
|||
|
// SetProfile 设置个人信息
|
|||
|
rpc SetProfile(SetProfileRequest) returns (Empty) {}
|
|||
|
// SetAccount 设置账号密码
|
|||
|
rpc SetAccount(SetAccountRequest) returns (Empty) {}
|
|||
|
|
|||
|
// 修改关联关系
|
|||
|
// rpc StaffCompany(StaffCompanyRequest) returns (Empty) {}
|
|||
|
}
|
|||
|
|
|||
|
message SetAccountRequest {
|
|||
|
string account = 1;
|
|||
|
string password = 2;
|
|||
|
string password_conformed = 3;
|
|||
|
}
|
|||
|
message SetProfileRequest {
|
|||
|
string name = 1;
|
|||
|
string phone = 2;
|
|||
|
string verify_code = 3;
|
|||
|
string email = 4;
|
|||
|
string profile = 5;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
message StaffCompanyChangeStatusRequest {
|
|||
|
string staff_identity = 1;
|
|||
|
int32 status = 2;
|
|||
|
}
|
|||
|
|
|||
|
message StaffCompanyChangeRoleRequest {
|
|||
|
string staff_identity = 1;
|
|||
|
int32 genre = 2;
|
|||
|
}
|
|||
|
|
|||
|
message StaffListRequest {
|
|||
|
int64 page_no=1; // 页数
|
|||
|
int64 page_size=2; // 每页记录数
|
|||
|
string staff_name = 3;
|
|||
|
string company_name = 4;
|
|||
|
int32 status = 5;
|
|||
|
string registered_start_at = 6; // 注册时间-开始,格式:2006-01-02 15:04:05
|
|||
|
string registered_end_at = 7; // 注册时间-结束格式:2006-01-02 15:04:05
|
|||
|
bool with_statistics = 8;// 是否需要查询统计信息
|
|||
|
string staff_identity = 9;
|
|||
|
}
|
|||
|
message StaffListReply {
|
|||
|
repeated StaffItem list = 1;
|
|||
|
int64 count = 2;
|
|||
|
StaffStatisticsData statistics = 3;
|
|||
|
}
|
|||
|
message StaffItem {
|
|||
|
int32 id = 1;
|
|||
|
string identity = 2;
|
|||
|
string name = 3;
|
|||
|
string account = 4;
|
|||
|
string profile = 5;
|
|||
|
string password = 6;
|
|||
|
string phone = 7;
|
|||
|
string email = 8;
|
|||
|
int32 status = 9;
|
|||
|
string creator_identity = 10;
|
|||
|
string created_at = 11;
|
|||
|
repeated StaffCompanyItem staff_company = 12; // 关联企业信息
|
|||
|
string password_confirmed = 13; // 确认密码密码,仅注册/修改需要
|
|||
|
// 创建时需要内容
|
|||
|
string verify_code = 14; // 短线验证码
|
|||
|
int32 company_genre = 15; // 角色
|
|||
|
}
|
|||
|
|
|||
|
message StaffStatisticsData {
|
|||
|
int64 total = 1; // 总的
|
|||
|
int64 available = 2; // 可用的
|
|||
|
int64 disable = 3;// 停用
|
|||
|
}
|
|||
|
|
|||
|
message StaffCompanyRequest {
|
|||
|
repeated StaffCompanyItem list = 1;
|
|||
|
string staff_identity = 2; //管理端请求需要校验这个参数
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
message StaffCompanyItem {
|
|||
|
string company_identity = 1;
|
|||
|
int32 genre = 2;
|
|||
|
int32 status = 3;
|
|||
|
// 显示用
|
|||
|
string company_name = 4;
|
|||
|
}
|
|||
|
|
|||
|
// END
|