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; string miniOpenId = 16; string sessionKey = 17; string unionId = 18; string saOpenId = 19; } message FindOrCreateUserByOpenIdReq { string openId = 1; string sessionKey = 2; string clientId = 3; string unionId = 4; string saOpenId = 5; } message GetProfileReq { string userId = 1; } message UpdateProfileReq { string userId = 1; string nickName = 2; string avatarId = 3; } // 我的徽章 message UserBadgeInfo { string id = 1; string badgeId = 2; string badgeName = 3; string dimension = 4; int32 tier = 5; string awardedAt = 6; } message UserBadgeListResp { repeated UserBadgeInfo list = 1; } // 我的收藏 message UserStarInfo { string id = 1; string targetId = 2; string type = 3; string createdAt = 4; } message UserStarListResp { repeated UserStarInfo list = 1; int64 total = 2; } // ========== 我的植物 ========== 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; } // 养护任务 status: 1=待完成 2=已完成 3=已过期 message CareTaskInfo { string id = 1; string plantId = 2; string planId = 3; string name = 4; string icon = 5; string targetAction = 6; string dueDate = 7; int32 status = 8; } message CareTaskListResp { repeated CareTaskInfo list = 1; int64 total = 2; } // ========== 养护记录 ========== 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; string classId = 12; string distributionArea = 13; string lifeCycle = 14; repeated string classIds = 15; repeated string ossIds = 16; repeated string relatedWikiIds = 17; bool isVectorSynced = 18; bool isStar = 19; string reproductionMethod = 20; string pestsDiseases = 21; string lightType = 22; string stem = 23; string fruit = 24; string foliageType = 25; string foliageColor = 26; string foliageShape = 27; int32 height = 28; string floweringPeriod = 29; string floweringColor = 30; string floweringShape = 31; int32 floweringDiameter = 32; } 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 CreateWikiReq { string name = 1; string latinName = 2; string aliases = 3; string genus = 4; int32 difficulty = 5; int32 isHot = 6; string growthHabit = 7; string lightIntensity = 8; string optimalTempPeriod = 9; string classId = 10; string distributionArea = 11; string lifeCycle = 12; repeated string classIds = 13; repeated string ossIds = 14; repeated string relatedWikiIds = 15; string reproductionMethod = 16; string pestsDiseases = 17; string lightType = 18; string stem = 19; string fruit = 20; string foliageType = 21; string foliageColor = 22; string foliageShape = 23; int32 height = 24; string floweringPeriod = 25; string floweringColor = 26; string floweringShape = 27; int32 floweringDiameter = 28; } message UpdateWikiReq { 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; string classId = 11; string distributionArea = 12; string lifeCycle = 13; repeated string classIds = 14; repeated string ossIds = 15; repeated string relatedWikiIds = 16; string reproductionMethod = 17; string pestsDiseases = 18; string lightType = 19; string stem = 20; string fruit = 21; string foliageType = 22; string foliageColor = 23; string foliageShape = 24; int32 height = 25; string floweringPeriod = 26; string floweringColor = 27; string floweringShape = 28; int32 floweringDiameter = 29; } 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 UpdateWikiClassReq { string id = 1; string name = 2; string icon = 3; } message ToggleStarReq { string userId = 1; string targetId = 2; string type = 3; } // ========== OCR ========== message ClassifyLogInfo { string id = 1; string userId = 2; string imageUrl = 3; string result = 4; string createdAt = 5; } message ClassifyLogListResp { repeated ClassifyLogInfo list = 1; int64 total = 2; } // ========== 社区帖子 ========== 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; string topicId = 11; } 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; string icon = 4; string desc = 5; string title = 6; string remark = 7; string startTime = 8; string endTime = 9; } message TopicListResp { repeated TopicInfo list = 1; } message CreateTopicReq { string name = 1; string icon = 2; string desc = 3; string title = 4; string remark = 5; string startTime = 6; string endTime = 7; } message UpdateTopicReq { string id = 1; string name = 2; string icon = 3; string desc = 4; string title = 5; string remark = 6; string startTime = 7; string endTime = 8; } // ========== 兑换商城 ========== message ExchangeItemInfo { string id = 1; string name = 2; string desc = 3; string imgId = 4; int64 cost = 5; int32 stock = 6; int32 status = 7; } message ExchangeItemListReq { int32 current = 1; int32 pageSize = 2; int32 status = 3; } message ExchangeItemListResp { repeated ExchangeItemInfo list = 1; int64 total = 2; } message CreateExchangeOrderReq { string userId = 1; string itemId = 2; int32 quantity = 3; string recipientName = 4; string phone = 5; string address = 6; } message CreateExchangeItemReq { string name = 1; string desc = 2; string imgId = 3; int64 cost = 4; int32 stock = 5; string type = 6; int64 costSunlight = 7; int32 limitPerUser = 8; int32 sort = 9; string startTime = 10; string endTime = 11; string imageId = 12; } message UpdateExchangeItemReq { string id = 1; string name = 2; string desc = 3; string imgId = 4; int64 cost = 5; int32 stock = 6; int32 status = 7; string type = 8; int64 costSunlight = 9; int32 limitPerUser = 10; int32 sort = 11; string startTime = 12; string endTime = 13; string imageId = 14; } message ExchangeOrderInfo { string id = 1; string userId = 2; string itemId = 3; string itemName = 4; int64 cost = 5; int32 status = 6; string address = 7; string createdAt = 8; int32 quantity = 9; string itemType = 10; string recipientName = 11; string phone = 12; string trackingNo = 13; string remark = 14; string completedAt = 15; } message ExchangeOrderListReq { int32 current = 1; int32 pageSize = 2; string userId = 3; int32 status = 4; } message ExchangeOrderListResp { repeated ExchangeOrderInfo list = 1; int64 total = 2; } message UpdateExchangeOrderReq { string id = 1; int32 status = 2; string trackingNo = 3; string remark = 4; } message MediaCheckCallbackReq { string traceId = 1; string postId = 2; string ossId = 3; string userId = 4; int32 status = 5; int32 type = 6; string errMsg = 7; } // ========== 快捷养护 ========== message QuickCareReq { string userId = 1; string plantId = 2; string name = 3; string icon = 4; string remark = 5; } // ========== Banner ========== message BannerInfo { string id = 1; string title = 2; string imageId = 3; int32 sort = 4; int32 isActive = 5; string targetUrl = 6; string createdAt = 7; } message BannerListReq { int32 current = 1; int32 pageSize = 2; string title = 3; int32 isActive = 4; } message BannerListResp { repeated BannerInfo list = 1; int64 total = 2; } message CreateBannerReq { string title = 1; string imageId = 2; int32 sort = 3; int32 isActive = 4; string targetUrl = 5; } message UpdateBannerReq { string id = 1; string title = 2; string imageId = 3; int32 sort = 4; int32 isActive = 5; string targetUrl = 6; } message SaveAiChatHistoryReq { string userId = 1; string question = 2; string answer = 3; } message SyncWikiVectorReq { string wikiId = 1; } // ========== 配置 ========== message LevelConfigInfo { string id = 1; int32 level = 2; string title = 3; int64 minSunlight = 4; string perks = 5; } message LevelConfigListResp { repeated LevelConfigInfo list = 1; } message CreateLevelConfigReq { int32 level = 1; string title = 2; int64 minSunlight = 3; string perks = 4; } message UpdateLevelConfigReq { string id = 1; int32 level = 2; string title = 3; int64 minSunlight = 4; string perks = 5; } 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; string iconId = 10; int32 sort = 11; } message BadgeConfigListReq { int32 current = 1; int32 pageSize = 2; string dimension = 3; } message BadgeConfigListResp { repeated BadgeConfigInfo list = 1; int64 total = 2; } message CreateBadgeConfigReq { string name = 1; string description = 2; string dimension = 3; string groupId = 4; int32 tier = 5; string targetAction = 6; int64 threshold = 7; int64 rewardSunlight = 8; string iconId = 9; int32 sort = 10; } message UpdateBadgeConfigReq { 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; string iconId = 10; int32 sort = 11; } // ========== 完成任务 ========== message CompleteTaskReq { string userId = 1; string taskId = 2; string remark = 3; } message TaskCompletionResult { bool isLevelUp = 1; LevelConfigInfo currentLevel = 2; bool isGetBadge = 3; BadgeConfigInfo newBadge = 4; int64 rewardSunlight = 5; } // ========== 徽章树 ========== message BadgeGroupInfo { string groupId = 1; string dimension = 2; repeated BadgeConfigInfo badges = 3; } message BadgeConfigTreeResp { repeated BadgeGroupInfo groups = 1; } // ========== AI ========== message AiQuotaResp { int64 remaining = 1; int64 total = 2; int64 used = 3; int64 limit = 4; } message AiChatHistoryInfo { string id = 1; string userId = 2; string question = 3; string answer = 4; string createdAt = 5; } message AiChatHistoryReq { string userId = 1; int32 current = 2; int32 pageSize = 3; } message AiChatHistoryResp { repeated AiChatHistoryInfo list = 1; int64 total = 2; } // ========== 服务定义 ========== service PlantService { // 用户Profile rpc GetUserProfile(GetProfileReq) returns (PlantUserProfile); rpc FindOrCreateUserByOpenId(FindOrCreateUserByOpenIdReq) returns (PlantUserProfile); rpc UpdateUserProfile(UpdateProfileReq) returns (CommonResp); rpc GetMyBadges(GetProfileReq) returns (UserBadgeListResp); rpc GetMyStars(GetProfileReq) returns (UserStarListResp); // 我的植物 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 DeleteCarePlan(IdsReq) returns (CommonResp); rpc GetTodayTaskList(GetProfileReq) returns (CareTaskListResp); rpc CompleteTask(CompleteTaskReq) returns (TaskCompletionResult); rpc AddCareRecord(AddCareRecordReq) returns (CommonResp); rpc AddGrowthRecord(AddGrowthRecordReq) returns (CommonResp); // 百科 rpc GetWikiList(WikiListReq) returns (WikiListResp); rpc GetWikiDetail(IdReq) returns (WikiDetailResp); rpc CreateWiki(CreateWikiReq) returns (CommonResp); rpc UpdateWiki(UpdateWikiReq) returns (CommonResp); rpc DeleteWiki(IdsReq) returns (CommonResp); rpc SyncWikiVector(SyncWikiVectorReq) returns (CommonResp); rpc DeleteWikiVector(SyncWikiVectorReq) returns (CommonResp); rpc SyncAllWikiVector(PageReq) returns (CommonResp); rpc GetWikiClassList(IdReq) returns (WikiClassListResp); rpc CreateWikiClass(CreateWikiClassReq) returns (CommonResp); rpc UpdateWikiClass(UpdateWikiClassReq) returns (CommonResp); rpc DeleteWikiClass(IdsReq) returns (CommonResp); rpc ToggleWikiStar(ToggleStarReq) returns (CommonResp); // OCR rpc GetMyClassifyLog(GetProfileReq) returns (ClassifyLogListResp); rpc DeleteClassifyLog(IdsReq) 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 StarPost(LikePostReq) returns (CommonResp); rpc MediaCheckCallback(MediaCheckCallbackReq) returns (CommonResp); // 话题 rpc GetTopicList(IdReq) returns (TopicListResp); rpc GetTopicDetail(IdReq) returns (TopicInfo); rpc CreateTopic(CreateTopicReq) returns (CommonResp); rpc UpdateTopic(UpdateTopicReq) returns (CommonResp); rpc DeleteTopic(IdsReq) returns (CommonResp); // 兑换 rpc GetExchangeItemList(ExchangeItemListReq) returns (ExchangeItemListResp); rpc GetExchangeItemDetail(IdReq) returns (ExchangeItemInfo); rpc CreateExchangeItem(CreateExchangeItemReq) returns (CommonResp); rpc UpdateExchangeItem(UpdateExchangeItemReq) returns (CommonResp); rpc DeleteExchangeItem(IdsReq) returns (CommonResp); rpc CreateExchangeOrder(CreateExchangeOrderReq) returns (CommonResp); rpc GetMyExchangeOrders(ExchangeOrderListReq) returns (ExchangeOrderListResp); rpc GetExchangeOrderList(ExchangeOrderListReq) returns (ExchangeOrderListResp); rpc UpdateExchangeOrder(UpdateExchangeOrderReq) returns (CommonResp); // 配置 rpc GetLevelConfigList(PageReq) returns (LevelConfigListResp); rpc GetLevelConfigDetail(IdReq) returns (LevelConfigInfo); rpc CreateLevelConfig(CreateLevelConfigReq) returns (CommonResp); rpc UpdateLevelConfig(UpdateLevelConfigReq) returns (CommonResp); rpc DeleteLevelConfig(IdsReq) returns (CommonResp); rpc GetBadgeConfigList(BadgeConfigListReq) returns (BadgeConfigListResp); rpc GetBadgeConfigDetail(IdReq) returns (BadgeConfigInfo); rpc GetBadgeConfigTree(IdReq) returns (BadgeConfigTreeResp); rpc CreateBadgeConfig(CreateBadgeConfigReq) returns (CommonResp); rpc UpdateBadgeConfig(UpdateBadgeConfigReq) returns (CommonResp); rpc DeleteBadgeConfig(IdsReq) returns (CommonResp); rpc GetWikiClassDetail(IdReq) returns (WikiClassInfo); // AI rpc GetAiChatHistory(AiChatHistoryReq) returns (AiChatHistoryResp); rpc SaveAiChatHistory(SaveAiChatHistoryReq) returns (CommonResp); rpc DeleteAiChatHistory(IdsReq) returns (CommonResp); rpc ClearAiChatHistory(GetProfileReq) returns (CommonResp); rpc GetAiChatQuota(GetProfileReq) returns (AiQuotaResp); // 快捷养护 rpc QuickCare(QuickCareReq) returns (CommonResp); // Banner rpc CreateBanner(CreateBannerReq) returns (CommonResp); rpc UpdateBanner(UpdateBannerReq) returns (CommonResp); rpc DeleteBanner(IdsReq) returns (CommonResp); rpc GetBannerList(BannerListReq) returns (BannerListResp); rpc GetActiveBannerList(PageReq) returns (BannerListResp); }