406 lines
7.7 KiB
Protocol Buffer
406 lines
7.7 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
package plant;
|
|
|
|
option go_package = "./plant";
|
|
|
|
// ========== 通用 ==========
|
|
|
|
message CommonResp {
|
|
int64 code = 1;
|
|
string msg = 2;
|
|
}
|
|
|
|
message IdReq {
|
|
string id = 1;
|
|
}
|
|
|
|
message IdsReq {
|
|
repeated string ids = 1;
|
|
}
|
|
|
|
message PageReq {
|
|
int32 current = 1;
|
|
int32 pageSize = 2;
|
|
}
|
|
|
|
// ========== 用户Profile ==========
|
|
|
|
message PlantUserProfile {
|
|
string id = 1;
|
|
string userId = 2;
|
|
string nickName = 3;
|
|
string avatarId = 4;
|
|
string levelId = 5;
|
|
int64 currentSunlight = 6;
|
|
int64 totalSunlight = 7;
|
|
int64 plantCount = 8;
|
|
int64 careCount = 9;
|
|
int64 postCount = 10;
|
|
int64 waterCount = 11;
|
|
int64 fertilizeCount = 12;
|
|
int64 repotCount = 13;
|
|
int64 pruneCount = 14;
|
|
int64 photoCount = 15;
|
|
}
|
|
|
|
message GetProfileReq {
|
|
string userId = 1;
|
|
}
|
|
|
|
message UpdateProfileReq {
|
|
string userId = 1;
|
|
string nickName = 2;
|
|
string avatarId = 3;
|
|
}
|
|
|
|
// ========== 我的植物 ==========
|
|
|
|
message PlantInfo {
|
|
string id = 1;
|
|
string userId = 2;
|
|
string name = 3;
|
|
string plantTime = 4;
|
|
int32 status = 5;
|
|
string placement = 6;
|
|
string potMaterial = 7;
|
|
string potSize = 8;
|
|
string sunlight = 9;
|
|
string plantingMaterial = 10;
|
|
repeated string imgIds = 11;
|
|
int64 createdAt = 12;
|
|
}
|
|
|
|
message CreatePlantReq {
|
|
string userId = 1;
|
|
string name = 2;
|
|
string plantTime = 3;
|
|
string placement = 4;
|
|
string potMaterial = 5;
|
|
string potSize = 6;
|
|
string sunlight = 7;
|
|
string plantingMaterial = 8;
|
|
repeated string imgIds = 9;
|
|
}
|
|
|
|
message UpdatePlantReq {
|
|
string id = 1;
|
|
string name = 2;
|
|
int32 status = 3;
|
|
string placement = 4;
|
|
string potMaterial = 5;
|
|
string potSize = 6;
|
|
string sunlight = 7;
|
|
string plantingMaterial = 8;
|
|
repeated string imgIds = 9;
|
|
}
|
|
|
|
message PlantListReq {
|
|
string userId = 1;
|
|
int32 current = 2;
|
|
int32 pageSize = 3;
|
|
string name = 4;
|
|
}
|
|
|
|
message PlantListResp {
|
|
repeated PlantInfo list = 1;
|
|
int64 total = 2;
|
|
}
|
|
|
|
message PlantDetailResp {
|
|
PlantInfo plant = 1;
|
|
repeated CarePlanInfo carePlans = 2;
|
|
repeated GrowthRecordInfo growthRecords = 3;
|
|
}
|
|
|
|
// ========== 养护计划 ==========
|
|
|
|
message CarePlanInfo {
|
|
string id = 1;
|
|
string plantId = 2;
|
|
string name = 3;
|
|
string icon = 4;
|
|
string targetAction = 5;
|
|
int32 period = 6;
|
|
}
|
|
|
|
message AddCarePlanReq {
|
|
string userId = 1;
|
|
string plantId = 2;
|
|
string name = 3;
|
|
string icon = 4;
|
|
string targetAction = 5;
|
|
int32 period = 6;
|
|
}
|
|
|
|
// ========== 养护记录 ==========
|
|
|
|
message AddCareRecordReq {
|
|
string userId = 1;
|
|
string plantId = 2;
|
|
string planId = 3;
|
|
string action = 4;
|
|
string note = 5;
|
|
}
|
|
|
|
// ========== 成长记录 ==========
|
|
|
|
message GrowthRecordInfo {
|
|
string id = 1;
|
|
string plantId = 2;
|
|
string content = 3;
|
|
int64 createdAt = 4;
|
|
}
|
|
|
|
message AddGrowthRecordReq {
|
|
string userId = 1;
|
|
string plantId = 2;
|
|
string content = 3;
|
|
repeated string imgIds = 4;
|
|
}
|
|
|
|
// ========== 百科 ==========
|
|
|
|
message WikiInfo {
|
|
string id = 1;
|
|
string name = 2;
|
|
string latinName = 3;
|
|
string aliases = 4;
|
|
string genus = 5;
|
|
int32 difficulty = 6;
|
|
int32 isHot = 7;
|
|
string growthHabit = 8;
|
|
string lightIntensity = 9;
|
|
string optimalTempPeriod = 10;
|
|
int64 createdAt = 11;
|
|
}
|
|
|
|
message WikiListReq {
|
|
int32 current = 1;
|
|
int32 pageSize = 2;
|
|
string name = 3;
|
|
string classId = 4;
|
|
int32 isHot = 5;
|
|
}
|
|
|
|
message WikiListResp {
|
|
repeated WikiInfo list = 1;
|
|
int64 total = 2;
|
|
}
|
|
|
|
message WikiDetailResp {
|
|
WikiInfo wiki = 1;
|
|
}
|
|
|
|
message WikiClassInfo {
|
|
string id = 1;
|
|
string name = 2;
|
|
string ossId = 3;
|
|
}
|
|
|
|
message WikiClassListResp {
|
|
repeated WikiClassInfo list = 1;
|
|
}
|
|
|
|
message CreateWikiClassReq {
|
|
string name = 1;
|
|
string icon = 2;
|
|
}
|
|
|
|
message ToggleStarReq {
|
|
string userId = 1;
|
|
string targetId = 2;
|
|
string type = 3;
|
|
}
|
|
|
|
// ========== 社区帖子 ==========
|
|
|
|
message PostInfo {
|
|
string id = 1;
|
|
string userId = 2;
|
|
string title = 3;
|
|
string content = 4;
|
|
int32 viewCount = 5;
|
|
int32 commentCount = 6;
|
|
int32 likeCount = 7;
|
|
int32 starCount = 8;
|
|
string location = 9;
|
|
int64 createdAt = 10;
|
|
}
|
|
|
|
message CreatePostReq {
|
|
string userId = 1;
|
|
string title = 2;
|
|
string content = 3;
|
|
string location = 4;
|
|
repeated string imgIds = 5;
|
|
string topicId = 6;
|
|
}
|
|
|
|
message PostListReq {
|
|
int32 current = 1;
|
|
int32 pageSize = 2;
|
|
string keyword = 3;
|
|
string topicId = 4;
|
|
string userId = 5;
|
|
}
|
|
|
|
message PostListResp {
|
|
repeated PostInfo list = 1;
|
|
int64 total = 2;
|
|
}
|
|
|
|
message PostDetailResp {
|
|
PostInfo post = 1;
|
|
repeated PostCommentInfo comments = 2;
|
|
}
|
|
|
|
message PostCommentInfo {
|
|
string id = 1;
|
|
string userId = 2;
|
|
string content = 3;
|
|
string parentId = 4;
|
|
int64 createdAt = 5;
|
|
}
|
|
|
|
message CommentPostReq {
|
|
string userId = 1;
|
|
string postId = 2;
|
|
string content = 3;
|
|
string parentId = 4;
|
|
}
|
|
|
|
message LikePostReq {
|
|
string userId = 1;
|
|
string postId = 2;
|
|
}
|
|
|
|
// ========== 话题 ==========
|
|
|
|
message TopicInfo {
|
|
string id = 1;
|
|
string name = 2;
|
|
int32 postCount = 3;
|
|
}
|
|
|
|
message TopicListResp {
|
|
repeated TopicInfo list = 1;
|
|
}
|
|
|
|
message CreateTopicReq {
|
|
string name = 1;
|
|
string icon = 2;
|
|
string desc = 3;
|
|
}
|
|
|
|
// ========== 兑换商城 ==========
|
|
|
|
message ExchangeItemInfo {
|
|
string id = 1;
|
|
string name = 2;
|
|
string desc = 3;
|
|
string imgId = 4;
|
|
int64 cost = 5;
|
|
int32 stock = 6;
|
|
}
|
|
|
|
message ExchangeItemListReq {
|
|
int32 current = 1;
|
|
int32 pageSize = 2;
|
|
}
|
|
|
|
message ExchangeItemListResp {
|
|
repeated ExchangeItemInfo list = 1;
|
|
int64 total = 2;
|
|
}
|
|
|
|
message CreateExchangeOrderReq {
|
|
string userId = 1;
|
|
string itemId = 2;
|
|
}
|
|
|
|
// ========== 配置 ==========
|
|
|
|
message LevelConfigInfo {
|
|
string id = 1;
|
|
int32 level = 2;
|
|
string title = 3;
|
|
int64 minSunlight = 4;
|
|
string perks = 5;
|
|
}
|
|
|
|
message LevelConfigListResp {
|
|
repeated LevelConfigInfo list = 1;
|
|
}
|
|
|
|
message BadgeConfigInfo {
|
|
string id = 1;
|
|
string name = 2;
|
|
string description = 3;
|
|
string dimension = 4;
|
|
string groupId = 5;
|
|
int32 tier = 6;
|
|
string targetAction = 7;
|
|
int64 threshold = 8;
|
|
int64 rewardSunlight = 9;
|
|
}
|
|
|
|
message BadgeConfigListReq {
|
|
int32 current = 1;
|
|
int32 pageSize = 2;
|
|
string dimension = 3;
|
|
}
|
|
|
|
message BadgeConfigListResp {
|
|
repeated BadgeConfigInfo list = 1;
|
|
int64 total = 2;
|
|
}
|
|
|
|
// ========== 服务定义 ==========
|
|
|
|
service PlantService {
|
|
// 用户Profile
|
|
rpc GetUserProfile(GetProfileReq) returns (PlantUserProfile);
|
|
rpc UpdateUserProfile(UpdateProfileReq) returns (CommonResp);
|
|
|
|
// 我的植物
|
|
rpc CreatePlant(CreatePlantReq) returns (CommonResp);
|
|
rpc UpdatePlant(UpdatePlantReq) returns (CommonResp);
|
|
rpc DeletePlant(IdsReq) returns (CommonResp);
|
|
rpc GetPlantList(PlantListReq) returns (PlantListResp);
|
|
rpc GetPlantDetail(IdReq) returns (PlantDetailResp);
|
|
|
|
// 养护
|
|
rpc AddCarePlan(AddCarePlanReq) returns (CommonResp);
|
|
rpc AddCareRecord(AddCareRecordReq) returns (CommonResp);
|
|
rpc AddGrowthRecord(AddGrowthRecordReq) returns (CommonResp);
|
|
|
|
// 百科
|
|
rpc GetWikiList(WikiListReq) returns (WikiListResp);
|
|
rpc GetWikiDetail(IdReq) returns (WikiDetailResp);
|
|
rpc GetWikiClassList(IdReq) returns (WikiClassListResp);
|
|
rpc CreateWikiClass(CreateWikiClassReq) returns (CommonResp);
|
|
rpc ToggleWikiStar(ToggleStarReq) returns (CommonResp);
|
|
|
|
// 社区
|
|
rpc CreatePost(CreatePostReq) returns (CommonResp);
|
|
rpc DeletePost(IdsReq) returns (CommonResp);
|
|
rpc GetPostList(PostListReq) returns (PostListResp);
|
|
rpc GetPostDetail(IdReq) returns (PostDetailResp);
|
|
rpc CommentPost(CommentPostReq) returns (CommonResp);
|
|
rpc LikePost(LikePostReq) returns (CommonResp);
|
|
|
|
// 话题
|
|
rpc GetTopicList(IdReq) returns (TopicListResp);
|
|
rpc CreateTopic(CreateTopicReq) returns (CommonResp);
|
|
rpc DeleteTopic(IdsReq) returns (CommonResp);
|
|
|
|
// 兑换
|
|
rpc GetExchangeItemList(ExchangeItemListReq) returns (ExchangeItemListResp);
|
|
rpc CreateExchangeOrder(CreateExchangeOrderReq) returns (CommonResp);
|
|
|
|
// 配置
|
|
rpc GetLevelConfigList(PageReq) returns (LevelConfigListResp);
|
|
rpc GetBadgeConfigList(BadgeConfigListReq) returns (BadgeConfigListResp);
|
|
}
|