feat: 初次启动
This commit is contained in:
+180
-103
@@ -4,8 +4,29 @@ 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 UserProfile {
|
||||
|
||||
message PlantUserProfile {
|
||||
string id = 1;
|
||||
string userId = 2;
|
||||
string nickName = 3;
|
||||
@@ -23,22 +44,18 @@ message UserProfile {
|
||||
int64 photoCount = 15;
|
||||
}
|
||||
|
||||
message GetUserProfileReq { string userId = 1; }
|
||||
message GetUserProfileResp { UserProfile profile = 1; }
|
||||
message UpdateUserProfileReq {
|
||||
message GetProfileReq {
|
||||
string userId = 1;
|
||||
}
|
||||
|
||||
message UpdateProfileReq {
|
||||
string userId = 1;
|
||||
string nickName = 2;
|
||||
string avatarId = 3;
|
||||
}
|
||||
message UpdateUserProfileResp {}
|
||||
message IncrUserCounterReq {
|
||||
string userId = 1;
|
||||
string field = 2; // care_count, water_count, etc.
|
||||
int64 delta = 3;
|
||||
}
|
||||
message IncrUserCounterResp {}
|
||||
|
||||
// ========== 我的植物 ==========
|
||||
|
||||
message PlantInfo {
|
||||
string id = 1;
|
||||
string userId = 2;
|
||||
@@ -65,7 +82,6 @@ message CreatePlantReq {
|
||||
string plantingMaterial = 8;
|
||||
repeated string imgIds = 9;
|
||||
}
|
||||
message CreatePlantResp { string id = 1; }
|
||||
|
||||
message UpdatePlantReq {
|
||||
string id = 1;
|
||||
@@ -76,35 +92,36 @@ message UpdatePlantReq {
|
||||
string potSize = 6;
|
||||
string sunlight = 7;
|
||||
string plantingMaterial = 8;
|
||||
repeated string imgIds = 9;
|
||||
}
|
||||
message UpdatePlantResp {}
|
||||
|
||||
message DeletePlantReq { repeated string ids = 1; }
|
||||
message DeletePlantResp {}
|
||||
|
||||
message GetPlantListReq {
|
||||
message PlantListReq {
|
||||
string userId = 1;
|
||||
int32 current = 2;
|
||||
int32 pageSize = 3;
|
||||
string name = 4;
|
||||
}
|
||||
message GetPlantListResp {
|
||||
|
||||
message PlantListResp {
|
||||
repeated PlantInfo list = 1;
|
||||
int64 total = 2;
|
||||
}
|
||||
|
||||
message GetPlantDetailReq { string id = 1; }
|
||||
message GetPlantDetailResp { PlantInfo plant = 1; }
|
||||
message PlantDetailResp {
|
||||
PlantInfo plant = 1;
|
||||
repeated CarePlanInfo carePlans = 2;
|
||||
repeated GrowthRecordInfo growthRecords = 3;
|
||||
}
|
||||
|
||||
// ========== 养护计划 ==========
|
||||
|
||||
// ========== 养护 ==========
|
||||
message CarePlanInfo {
|
||||
string id = 1;
|
||||
string userId = 2;
|
||||
string plantId = 3;
|
||||
string name = 4;
|
||||
string icon = 5;
|
||||
string targetAction = 6;
|
||||
int32 period = 7;
|
||||
string plantId = 2;
|
||||
string name = 3;
|
||||
string icon = 4;
|
||||
string targetAction = 5;
|
||||
int32 period = 6;
|
||||
}
|
||||
|
||||
message AddCarePlanReq {
|
||||
@@ -115,7 +132,8 @@ message AddCarePlanReq {
|
||||
string targetAction = 5;
|
||||
int32 period = 6;
|
||||
}
|
||||
message AddCarePlanResp { string id = 1; }
|
||||
|
||||
// ========== 养护记录 ==========
|
||||
|
||||
message AddCareRecordReq {
|
||||
string userId = 1;
|
||||
@@ -124,7 +142,15 @@ message AddCareRecordReq {
|
||||
string action = 4;
|
||||
string note = 5;
|
||||
}
|
||||
message AddCareRecordResp {}
|
||||
|
||||
// ========== 成长记录 ==========
|
||||
|
||||
message GrowthRecordInfo {
|
||||
string id = 1;
|
||||
string plantId = 2;
|
||||
string content = 3;
|
||||
int64 createdAt = 4;
|
||||
}
|
||||
|
||||
message AddGrowthRecordReq {
|
||||
string userId = 1;
|
||||
@@ -132,9 +158,9 @@ message AddGrowthRecordReq {
|
||||
string content = 3;
|
||||
repeated string imgIds = 4;
|
||||
}
|
||||
message AddGrowthRecordResp {}
|
||||
|
||||
// ========== 百科 ==========
|
||||
|
||||
message WikiInfo {
|
||||
string id = 1;
|
||||
string name = 2;
|
||||
@@ -143,41 +169,52 @@ message WikiInfo {
|
||||
string genus = 5;
|
||||
int32 difficulty = 6;
|
||||
int32 isHot = 7;
|
||||
int64 createdAt = 8;
|
||||
string growthHabit = 8;
|
||||
string lightIntensity = 9;
|
||||
string optimalTempPeriod = 10;
|
||||
int64 createdAt = 11;
|
||||
}
|
||||
|
||||
message GetWikiListReq {
|
||||
message WikiListReq {
|
||||
int32 current = 1;
|
||||
int32 pageSize = 2;
|
||||
string name = 3;
|
||||
string classId = 4;
|
||||
int32 isHot = 5;
|
||||
}
|
||||
message GetWikiListResp {
|
||||
|
||||
message WikiListResp {
|
||||
repeated WikiInfo list = 1;
|
||||
int64 total = 2;
|
||||
}
|
||||
|
||||
message GetWikiDetailReq { string id = 1; }
|
||||
message GetWikiDetailResp { WikiInfo wiki = 1; }
|
||||
message WikiDetailResp {
|
||||
WikiInfo wiki = 1;
|
||||
}
|
||||
|
||||
message WikiClassInfo {
|
||||
string id = 1;
|
||||
string name = 2;
|
||||
string ossId = 3;
|
||||
}
|
||||
message GetWikiClassListResp { repeated WikiClassInfo list = 1; }
|
||||
message CreateWikiClassReq { string name = 1; string ossId = 2; }
|
||||
message CreateWikiClassResp { string id = 1; }
|
||||
|
||||
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 ToggleStarResp { bool starred = 1; }
|
||||
|
||||
// ========== 社区 ==========
|
||||
// ========== 社区帖子 ==========
|
||||
|
||||
message PostInfo {
|
||||
string id = 1;
|
||||
string userId = 2;
|
||||
@@ -199,24 +236,32 @@ message CreatePostReq {
|
||||
repeated string imgIds = 5;
|
||||
string topicId = 6;
|
||||
}
|
||||
message CreatePostResp { string id = 1; }
|
||||
|
||||
message GetPostListReq {
|
||||
message PostListReq {
|
||||
int32 current = 1;
|
||||
int32 pageSize = 2;
|
||||
string keyword = 3;
|
||||
string topicId = 4;
|
||||
string userId = 5;
|
||||
}
|
||||
message GetPostListResp {
|
||||
|
||||
message PostListResp {
|
||||
repeated PostInfo list = 1;
|
||||
int64 total = 2;
|
||||
}
|
||||
|
||||
message GetPostDetailReq { string id = 1; }
|
||||
message GetPostDetailResp { PostInfo post = 1; }
|
||||
message PostDetailResp {
|
||||
PostInfo post = 1;
|
||||
repeated PostCommentInfo comments = 2;
|
||||
}
|
||||
|
||||
message DeletePostReq { repeated string ids = 1; }
|
||||
message DeletePostResp {}
|
||||
message PostCommentInfo {
|
||||
string id = 1;
|
||||
string userId = 2;
|
||||
string content = 3;
|
||||
string parentId = 4;
|
||||
int64 createdAt = 5;
|
||||
}
|
||||
|
||||
message CommentPostReq {
|
||||
string userId = 1;
|
||||
@@ -224,27 +269,58 @@ message CommentPostReq {
|
||||
string content = 3;
|
||||
string parentId = 4;
|
||||
}
|
||||
message CommentPostResp {}
|
||||
|
||||
message LikePostReq {
|
||||
string userId = 1;
|
||||
string postId = 2;
|
||||
}
|
||||
message LikePostResp { bool liked = 1; }
|
||||
|
||||
// ========== 话题 ==========
|
||||
|
||||
message TopicInfo {
|
||||
string id = 1;
|
||||
string name = 2;
|
||||
int32 postCount = 3;
|
||||
}
|
||||
message GetTopicListResp { repeated TopicInfo list = 1; }
|
||||
message CreateTopicReq { string name = 1; }
|
||||
message CreateTopicResp { string id = 1; }
|
||||
message DeleteTopicReq { repeated string ids = 1; }
|
||||
message DeleteTopicResp {}
|
||||
|
||||
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;
|
||||
@@ -252,8 +328,10 @@ message LevelConfigInfo {
|
||||
int64 minSunlight = 4;
|
||||
string perks = 5;
|
||||
}
|
||||
message GetLevelConfigListReq { int32 current = 1; int32 pageSize = 2; }
|
||||
message GetLevelConfigListResp { repeated LevelConfigInfo list = 1; int64 total = 2; }
|
||||
|
||||
message LevelConfigListResp {
|
||||
repeated LevelConfigInfo list = 1;
|
||||
}
|
||||
|
||||
message BadgeConfigInfo {
|
||||
string id = 1;
|
||||
@@ -266,63 +344,62 @@ message BadgeConfigInfo {
|
||||
int64 threshold = 8;
|
||||
int64 rewardSunlight = 9;
|
||||
}
|
||||
message GetBadgeConfigListReq { int32 current = 1; int32 pageSize = 2; string dimension = 3; }
|
||||
message GetBadgeConfigListResp { repeated BadgeConfigInfo list = 1; int64 total = 2; }
|
||||
|
||||
// ========== 兑换 ==========
|
||||
message ExchangeItemInfo {
|
||||
string id = 1;
|
||||
string name = 2;
|
||||
string desc = 3;
|
||||
int64 cost = 4;
|
||||
int32 stock = 5;
|
||||
message BadgeConfigListReq {
|
||||
int32 current = 1;
|
||||
int32 pageSize = 2;
|
||||
string dimension = 3;
|
||||
}
|
||||
message GetExchangeItemListReq { int32 current = 1; int32 pageSize = 2; }
|
||||
message GetExchangeItemListResp { repeated ExchangeItemInfo list = 1; int64 total = 2; }
|
||||
|
||||
message CreateExchangeOrderReq { string userId = 1; string itemId = 2; }
|
||||
message CreateExchangeOrderResp { string id = 1; }
|
||||
|
||||
// ========== 通用 ==========
|
||||
message Empty {}
|
||||
message BadgeConfigListResp {
|
||||
repeated BadgeConfigInfo list = 1;
|
||||
int64 total = 2;
|
||||
}
|
||||
|
||||
// ========== 服务定义 ==========
|
||||
|
||||
service PlantService {
|
||||
// 用户Profile
|
||||
rpc GetUserProfile(GetUserProfileReq) returns (GetUserProfileResp);
|
||||
rpc UpdateUserProfile(UpdateUserProfileReq) returns (UpdateUserProfileResp);
|
||||
rpc IncrUserCounter(IncrUserCounterReq) returns (IncrUserCounterResp);
|
||||
// 植物
|
||||
rpc CreatePlant(CreatePlantReq) returns (CreatePlantResp);
|
||||
rpc UpdatePlant(UpdatePlantReq) returns (UpdatePlantResp);
|
||||
rpc DeletePlant(DeletePlantReq) returns (DeletePlantResp);
|
||||
rpc GetPlantList(GetPlantListReq) returns (GetPlantListResp);
|
||||
rpc GetPlantDetail(GetPlantDetailReq) returns (GetPlantDetailResp);
|
||||
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 (AddCarePlanResp);
|
||||
rpc AddCareRecord(AddCareRecordReq) returns (AddCareRecordResp);
|
||||
rpc AddGrowthRecord(AddGrowthRecordReq) returns (AddGrowthRecordResp);
|
||||
rpc AddCarePlan(AddCarePlanReq) returns (CommonResp);
|
||||
rpc AddCareRecord(AddCareRecordReq) returns (CommonResp);
|
||||
rpc AddGrowthRecord(AddGrowthRecordReq) returns (CommonResp);
|
||||
|
||||
// 百科
|
||||
rpc GetWikiList(GetWikiListReq) returns (GetWikiListResp);
|
||||
rpc GetWikiDetail(GetWikiDetailReq) returns (GetWikiDetailResp);
|
||||
rpc GetWikiClassList(Empty) returns (GetWikiClassListResp);
|
||||
rpc CreateWikiClass(CreateWikiClassReq) returns (CreateWikiClassResp);
|
||||
rpc ToggleStar(ToggleStarReq) returns (ToggleStarResp);
|
||||
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 (CreatePostResp);
|
||||
rpc GetPostList(GetPostListReq) returns (GetPostListResp);
|
||||
rpc GetPostDetail(GetPostDetailReq) returns (GetPostDetailResp);
|
||||
rpc DeletePost(DeletePostReq) returns (DeletePostResp);
|
||||
rpc CommentPost(CommentPostReq) returns (CommentPostResp);
|
||||
rpc LikePost(LikePostReq) returns (LikePostResp);
|
||||
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(Empty) returns (GetTopicListResp);
|
||||
rpc CreateTopic(CreateTopicReq) returns (CreateTopicResp);
|
||||
rpc DeleteTopic(DeleteTopicReq) returns (DeleteTopicResp);
|
||||
// 配置
|
||||
rpc GetLevelConfigList(GetLevelConfigListReq) returns (GetLevelConfigListResp);
|
||||
rpc GetBadgeConfigList(GetBadgeConfigListReq) returns (GetBadgeConfigListResp);
|
||||
rpc GetTopicList(IdReq) returns (TopicListResp);
|
||||
rpc CreateTopic(CreateTopicReq) returns (CommonResp);
|
||||
rpc DeleteTopic(IdsReq) returns (CommonResp);
|
||||
|
||||
// 兑换
|
||||
rpc GetExchangeItemList(GetExchangeItemListReq) returns (GetExchangeItemListResp);
|
||||
rpc CreateExchangeOrder(CreateExchangeOrderReq) returns (CreateExchangeOrderResp);
|
||||
rpc GetExchangeItemList(ExchangeItemListReq) returns (ExchangeItemListResp);
|
||||
rpc CreateExchangeOrder(CreateExchangeOrderReq) returns (CommonResp);
|
||||
|
||||
// 配置
|
||||
rpc GetLevelConfigList(PageReq) returns (LevelConfigListResp);
|
||||
rpc GetBadgeConfigList(BadgeConfigListReq) returns (BadgeConfigListResp);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user