feat: 用户中心
This commit is contained in:
@@ -10,6 +10,7 @@ type ApiGroup struct {
|
||||
WikiApi
|
||||
OcrApi
|
||||
LevelConfigApi
|
||||
UserProfileApi
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -20,4 +21,5 @@ var (
|
||||
wikiService = service.GroupApp.PlantServiceGroup.WikiService
|
||||
ocrService = service.GroupApp.PlantServiceGroup.OcrService
|
||||
levelConfigService = service.GroupApp.PlantServiceGroup.LevelConfigService
|
||||
userProfileService = service.GroupApp.PlantServiceGroup.UserProfileService
|
||||
)
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
package plant
|
||||
|
||||
import (
|
||||
"sundynix-go/model/commom/response"
|
||||
"sundynix-go/model/plant/request"
|
||||
"sundynix-go/utils/auth"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type UserProfileApi struct{}
|
||||
|
||||
// UpdateProfile 修改用户信息
|
||||
// @Tags 个人中心
|
||||
// @Summary 修改用户信息
|
||||
// @Security BearerAuth
|
||||
// @accept json
|
||||
// @Produce application/json
|
||||
// @Param data body request.UpdateProfile true "修改用户信息"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"修改成功"}"
|
||||
// @Router /profile/update [post]
|
||||
func (a *UserProfileApi) UpdateProfile(c *gin.Context) {
|
||||
var req request.UpdateProfile
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
response.FailWithMsg("请求参数错误", c)
|
||||
return
|
||||
}
|
||||
userId := auth.GetUserId(c)
|
||||
if err := userProfileService.UpdateProfile(req, userId); err != nil {
|
||||
response.FailWithMsg("更新失败", c)
|
||||
return
|
||||
}
|
||||
response.OkWithMsg("更新成功", c)
|
||||
}
|
||||
|
||||
// ProfileDetail 用户详情
|
||||
// @Tags 个人中心
|
||||
// @Summary 用户详情
|
||||
// @Security BearerAuth
|
||||
// @Produce application/json
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}"
|
||||
// @Router /profile/detail [get]
|
||||
func (a *UserProfileApi) ProfileDetail(c *gin.Context) {
|
||||
userId := auth.GetUserId(c)
|
||||
res, err := userProfileService.ProfileDetail(userId)
|
||||
if err != nil {
|
||||
response.FailWithMsg("查询失败", c)
|
||||
return
|
||||
}
|
||||
response.OkWithData(res, c)
|
||||
}
|
||||
+546
-48
@@ -244,6 +244,104 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"/classify/myClassifyLog": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"识别相关"
|
||||
],
|
||||
"summary": "我的植物识别记录",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "分页",
|
||||
"name": "data",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/request.PageInfo"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "识别记录",
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/response.Response"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"msg": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/classify/plant": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"consumes": [
|
||||
"multipart/form-data"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"识别相关"
|
||||
],
|
||||
"summary": "base64植物识别",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "file",
|
||||
"description": "植物识别",
|
||||
"name": "file",
|
||||
"in": "formData",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "文件OCR",
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/response.Response"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"msg": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/client/delete": {
|
||||
"post": {
|
||||
"security": [
|
||||
@@ -496,6 +594,139 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"/config/level/add": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"等级配置"
|
||||
],
|
||||
"summary": "添加等级配置",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "添加等级配置",
|
||||
"name": "data",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/request.CreateLevelConf"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "{\"success\":true,\"data\":{},\"msg\":\"添加成功\"}",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/config/level/detail": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"等级配置"
|
||||
],
|
||||
"summary": "等级配置详情",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "等级配置id",
|
||||
"name": "id",
|
||||
"in": "query",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "{\"success\":true,\"data\":{},\"msg\":\"查询成功\"}",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/config/level/list": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"等级配置"
|
||||
],
|
||||
"summary": "等级配置列表",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "{\"success\":true,\"data\":{},\"msg\":\"查询成功\"}",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/config/level/update": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"等级配置"
|
||||
],
|
||||
"summary": "修改等级配置",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "修改等级配置",
|
||||
"name": "data",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/request.UpdateLevelConf"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "{\"success\":true,\"data\":{},\"msg\":\"修改成功\"}",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/menu/delete": {
|
||||
"get": {
|
||||
"security": [
|
||||
@@ -829,54 +1060,6 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"/ocr/base64": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"consumes": [
|
||||
"multipart/form-data"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"识别相关"
|
||||
],
|
||||
"summary": "base64植物识别",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "file",
|
||||
"description": "植物识别",
|
||||
"name": "file",
|
||||
"in": "formData",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "文件OCR",
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/response.Response"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"msg": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/oss/delete": {
|
||||
"post": {
|
||||
"security": [
|
||||
@@ -1255,6 +1438,44 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"/plant/growth/add": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"我的植物"
|
||||
],
|
||||
"summary": "添加成长记录",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "添加成长记录",
|
||||
"name": "data",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/request.CreateGrowthRecord"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "{\"success\":true,\"data\":{},\"msg\":\"添加成功\"}",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/plant/page": {
|
||||
"post": {
|
||||
"security": [
|
||||
@@ -1293,6 +1514,77 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"/plant/plan/add": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"我的植物"
|
||||
],
|
||||
"summary": "添加养护事项",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "添加养护事项",
|
||||
"name": "data",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/request.CreateCarePlan"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "{\"success\":true,\"data\":{},\"msg\":\"添加成功\"}",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/plant/plan/delete": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"我的植物"
|
||||
],
|
||||
"summary": "删除养护事项",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "id",
|
||||
"name": "id",
|
||||
"in": "query",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "{\"success\":true,\"data\":{},\"msg\":\"删除成功\"}",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/plant/todayTask": {
|
||||
"get": {
|
||||
"security": [
|
||||
@@ -1550,6 +1842,68 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"/profile/detail": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"个人中心"
|
||||
],
|
||||
"summary": "用户详情",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "{\"success\":true,\"data\":{},\"msg\":\"查询成功\"}",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/profile/update": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"个人中心"
|
||||
],
|
||||
"summary": "修改用户信息",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "修改用户信息",
|
||||
"name": "data",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/request.UpdateProfile"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "{\"success\":true,\"data\":{},\"msg\":\"修改成功\"}",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/role/delete": {
|
||||
"post": {
|
||||
"description": "删除角色",
|
||||
@@ -2212,6 +2566,30 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"/user/info": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"用户管理"
|
||||
],
|
||||
"summary": "当前登录用户",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "{\"code\": 200, \"data\": {}, \"msg\": \"添加成功\"}",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/response.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/user/save": {
|
||||
"post": {
|
||||
"security": [
|
||||
@@ -2688,6 +3066,29 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"request.CreateCarePlan": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"plantId"
|
||||
],
|
||||
"properties": {
|
||||
"icon": {
|
||||
"description": "icon信息",
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"description": "农事名称",
|
||||
"type": "string"
|
||||
},
|
||||
"period": {
|
||||
"description": "周期",
|
||||
"type": "integer"
|
||||
},
|
||||
"plantId": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"request.CreateComment": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
@@ -2705,6 +3106,56 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"request.CreateGrowthRecord": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"plantId"
|
||||
],
|
||||
"properties": {
|
||||
"content": {
|
||||
"type": "string"
|
||||
},
|
||||
"desc": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"ossIds": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"plantId": {
|
||||
"type": "string"
|
||||
},
|
||||
"tag": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"request.CreateLevelConf": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"level": {
|
||||
"description": "等级数值",
|
||||
"type": "integer"
|
||||
},
|
||||
"minSunlight": {
|
||||
"description": "达到该等级所需的最小阳光值",
|
||||
"type": "integer"
|
||||
},
|
||||
"perks": {
|
||||
"description": "解锁权益描述 (e.g., \"解锁智能诊断\")",
|
||||
"type": "string"
|
||||
},
|
||||
"title": {
|
||||
"description": "等级称号 (e.g., \"萌芽园丁\")",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"request.CreateMyPlant": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -3132,6 +3583,33 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"request.UpdateLevelConf": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"id"
|
||||
],
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"level": {
|
||||
"description": "等级数值",
|
||||
"type": "integer"
|
||||
},
|
||||
"minSunlight": {
|
||||
"description": "达到该等级所需的最小阳光值",
|
||||
"type": "integer"
|
||||
},
|
||||
"perks": {
|
||||
"description": "解锁权益描述 (e.g., \"解锁智能诊断\")",
|
||||
"type": "string"
|
||||
},
|
||||
"title": {
|
||||
"description": "等级称号 (e.g., \"萌芽园丁\")",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"request.UpdateMyPlant": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
@@ -3196,6 +3674,26 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"request.UpdateProfile": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"avatarId": {
|
||||
"type": "string"
|
||||
},
|
||||
"currentSunlight": {
|
||||
"type": "integer"
|
||||
},
|
||||
"levelId": {
|
||||
"type": "string"
|
||||
},
|
||||
"nickname": {
|
||||
"type": "string"
|
||||
},
|
||||
"totalSunlight": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"request.UpdateTopic": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
|
||||
+546
-48
@@ -236,6 +236,104 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/classify/myClassifyLog": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"识别相关"
|
||||
],
|
||||
"summary": "我的植物识别记录",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "分页",
|
||||
"name": "data",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/request.PageInfo"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "识别记录",
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/response.Response"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"msg": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/classify/plant": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"consumes": [
|
||||
"multipart/form-data"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"识别相关"
|
||||
],
|
||||
"summary": "base64植物识别",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "file",
|
||||
"description": "植物识别",
|
||||
"name": "file",
|
||||
"in": "formData",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "文件OCR",
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/response.Response"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"msg": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/client/delete": {
|
||||
"post": {
|
||||
"security": [
|
||||
@@ -488,6 +586,139 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/config/level/add": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"等级配置"
|
||||
],
|
||||
"summary": "添加等级配置",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "添加等级配置",
|
||||
"name": "data",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/request.CreateLevelConf"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "{\"success\":true,\"data\":{},\"msg\":\"添加成功\"}",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/config/level/detail": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"等级配置"
|
||||
],
|
||||
"summary": "等级配置详情",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "等级配置id",
|
||||
"name": "id",
|
||||
"in": "query",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "{\"success\":true,\"data\":{},\"msg\":\"查询成功\"}",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/config/level/list": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"等级配置"
|
||||
],
|
||||
"summary": "等级配置列表",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "{\"success\":true,\"data\":{},\"msg\":\"查询成功\"}",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/config/level/update": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"等级配置"
|
||||
],
|
||||
"summary": "修改等级配置",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "修改等级配置",
|
||||
"name": "data",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/request.UpdateLevelConf"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "{\"success\":true,\"data\":{},\"msg\":\"修改成功\"}",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/menu/delete": {
|
||||
"get": {
|
||||
"security": [
|
||||
@@ -821,54 +1052,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/ocr/base64": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"consumes": [
|
||||
"multipart/form-data"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"识别相关"
|
||||
],
|
||||
"summary": "base64植物识别",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "file",
|
||||
"description": "植物识别",
|
||||
"name": "file",
|
||||
"in": "formData",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "文件OCR",
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/response.Response"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"msg": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/oss/delete": {
|
||||
"post": {
|
||||
"security": [
|
||||
@@ -1247,6 +1430,44 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/plant/growth/add": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"我的植物"
|
||||
],
|
||||
"summary": "添加成长记录",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "添加成长记录",
|
||||
"name": "data",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/request.CreateGrowthRecord"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "{\"success\":true,\"data\":{},\"msg\":\"添加成功\"}",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/plant/page": {
|
||||
"post": {
|
||||
"security": [
|
||||
@@ -1285,6 +1506,77 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/plant/plan/add": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"我的植物"
|
||||
],
|
||||
"summary": "添加养护事项",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "添加养护事项",
|
||||
"name": "data",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/request.CreateCarePlan"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "{\"success\":true,\"data\":{},\"msg\":\"添加成功\"}",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/plant/plan/delete": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"我的植物"
|
||||
],
|
||||
"summary": "删除养护事项",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "id",
|
||||
"name": "id",
|
||||
"in": "query",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "{\"success\":true,\"data\":{},\"msg\":\"删除成功\"}",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/plant/todayTask": {
|
||||
"get": {
|
||||
"security": [
|
||||
@@ -1542,6 +1834,68 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/profile/detail": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"个人中心"
|
||||
],
|
||||
"summary": "用户详情",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "{\"success\":true,\"data\":{},\"msg\":\"查询成功\"}",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/profile/update": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"个人中心"
|
||||
],
|
||||
"summary": "修改用户信息",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "修改用户信息",
|
||||
"name": "data",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/request.UpdateProfile"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "{\"success\":true,\"data\":{},\"msg\":\"修改成功\"}",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/role/delete": {
|
||||
"post": {
|
||||
"description": "删除角色",
|
||||
@@ -2204,6 +2558,30 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/user/info": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"用户管理"
|
||||
],
|
||||
"summary": "当前登录用户",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "{\"code\": 200, \"data\": {}, \"msg\": \"添加成功\"}",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/response.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/user/save": {
|
||||
"post": {
|
||||
"security": [
|
||||
@@ -2680,6 +3058,29 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"request.CreateCarePlan": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"plantId"
|
||||
],
|
||||
"properties": {
|
||||
"icon": {
|
||||
"description": "icon信息",
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"description": "农事名称",
|
||||
"type": "string"
|
||||
},
|
||||
"period": {
|
||||
"description": "周期",
|
||||
"type": "integer"
|
||||
},
|
||||
"plantId": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"request.CreateComment": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
@@ -2697,6 +3098,56 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"request.CreateGrowthRecord": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"plantId"
|
||||
],
|
||||
"properties": {
|
||||
"content": {
|
||||
"type": "string"
|
||||
},
|
||||
"desc": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"ossIds": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"plantId": {
|
||||
"type": "string"
|
||||
},
|
||||
"tag": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"request.CreateLevelConf": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"level": {
|
||||
"description": "等级数值",
|
||||
"type": "integer"
|
||||
},
|
||||
"minSunlight": {
|
||||
"description": "达到该等级所需的最小阳光值",
|
||||
"type": "integer"
|
||||
},
|
||||
"perks": {
|
||||
"description": "解锁权益描述 (e.g., \"解锁智能诊断\")",
|
||||
"type": "string"
|
||||
},
|
||||
"title": {
|
||||
"description": "等级称号 (e.g., \"萌芽园丁\")",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"request.CreateMyPlant": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -3124,6 +3575,33 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"request.UpdateLevelConf": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"id"
|
||||
],
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"level": {
|
||||
"description": "等级数值",
|
||||
"type": "integer"
|
||||
},
|
||||
"minSunlight": {
|
||||
"description": "达到该等级所需的最小阳光值",
|
||||
"type": "integer"
|
||||
},
|
||||
"perks": {
|
||||
"description": "解锁权益描述 (e.g., \"解锁智能诊断\")",
|
||||
"type": "string"
|
||||
},
|
||||
"title": {
|
||||
"description": "等级称号 (e.g., \"萌芽园丁\")",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"request.UpdateMyPlant": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
@@ -3188,6 +3666,26 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"request.UpdateProfile": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"avatarId": {
|
||||
"type": "string"
|
||||
},
|
||||
"currentSunlight": {
|
||||
"type": "integer"
|
||||
},
|
||||
"levelId": {
|
||||
"type": "string"
|
||||
},
|
||||
"nickname": {
|
||||
"type": "string"
|
||||
},
|
||||
"totalSunlight": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"request.UpdateTopic": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
|
||||
+334
-27
@@ -27,6 +27,22 @@ definitions:
|
||||
required:
|
||||
- taskId
|
||||
type: object
|
||||
request.CreateCarePlan:
|
||||
properties:
|
||||
icon:
|
||||
description: icon信息
|
||||
type: string
|
||||
name:
|
||||
description: 农事名称
|
||||
type: string
|
||||
period:
|
||||
description: 周期
|
||||
type: integer
|
||||
plantId:
|
||||
type: string
|
||||
required:
|
||||
- plantId
|
||||
type: object
|
||||
request.CreateComment:
|
||||
properties:
|
||||
content:
|
||||
@@ -39,6 +55,40 @@ definitions:
|
||||
- content
|
||||
- postId
|
||||
type: object
|
||||
request.CreateGrowthRecord:
|
||||
properties:
|
||||
content:
|
||||
type: string
|
||||
desc:
|
||||
type: string
|
||||
name:
|
||||
type: string
|
||||
ossIds:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
plantId:
|
||||
type: string
|
||||
tag:
|
||||
type: string
|
||||
required:
|
||||
- plantId
|
||||
type: object
|
||||
request.CreateLevelConf:
|
||||
properties:
|
||||
level:
|
||||
description: 等级数值
|
||||
type: integer
|
||||
minSunlight:
|
||||
description: 达到该等级所需的最小阳光值
|
||||
type: integer
|
||||
perks:
|
||||
description: 解锁权益描述 (e.g., "解锁智能诊断")
|
||||
type: string
|
||||
title:
|
||||
description: 等级称号 (e.g., "萌芽园丁")
|
||||
type: string
|
||||
type: object
|
||||
request.CreateMyPlant:
|
||||
properties:
|
||||
carePlans:
|
||||
@@ -339,6 +389,25 @@ definitions:
|
||||
description: 标题
|
||||
type: string
|
||||
type: object
|
||||
request.UpdateLevelConf:
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
level:
|
||||
description: 等级数值
|
||||
type: integer
|
||||
minSunlight:
|
||||
description: 达到该等级所需的最小阳光值
|
||||
type: integer
|
||||
perks:
|
||||
description: 解锁权益描述 (e.g., "解锁智能诊断")
|
||||
type: string
|
||||
title:
|
||||
description: 等级称号 (e.g., "萌芽园丁")
|
||||
type: string
|
||||
required:
|
||||
- id
|
||||
type: object
|
||||
request.UpdateMyPlant:
|
||||
properties:
|
||||
carePlans:
|
||||
@@ -384,6 +453,19 @@ definitions:
|
||||
required:
|
||||
- id
|
||||
type: object
|
||||
request.UpdateProfile:
|
||||
properties:
|
||||
avatarId:
|
||||
type: string
|
||||
currentSunlight:
|
||||
type: integer
|
||||
levelId:
|
||||
type: string
|
||||
nickname:
|
||||
type: string
|
||||
totalSunlight:
|
||||
type: integer
|
||||
type: object
|
||||
request.UpdateTopic:
|
||||
properties:
|
||||
end_time:
|
||||
@@ -823,6 +905,61 @@ paths:
|
||||
summary: 小程序登录
|
||||
tags:
|
||||
- 登录相关
|
||||
/classify/myClassifyLog:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: 分页
|
||||
in: body
|
||||
name: data
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/request.PageInfo'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: 识别记录
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/response.Response'
|
||||
- properties:
|
||||
msg:
|
||||
type: string
|
||||
type: object
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: 我的植物识别记录
|
||||
tags:
|
||||
- 识别相关
|
||||
/classify/plant:
|
||||
post:
|
||||
consumes:
|
||||
- multipart/form-data
|
||||
parameters:
|
||||
- description: 植物识别
|
||||
in: formData
|
||||
name: file
|
||||
required: true
|
||||
type: file
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: 文件OCR
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/response.Response'
|
||||
- properties:
|
||||
msg:
|
||||
type: string
|
||||
type: object
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: base64植物识别
|
||||
tags:
|
||||
- 识别相关
|
||||
/client/delete:
|
||||
post:
|
||||
consumes:
|
||||
@@ -965,6 +1102,86 @@ paths:
|
||||
summary: 更新client
|
||||
tags:
|
||||
- 客户端管理
|
||||
/config/level/add:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: 添加等级配置
|
||||
in: body
|
||||
name: data
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/request.CreateLevelConf'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: '{"success":true,"data":{},"msg":"添加成功"}'
|
||||
schema:
|
||||
type: string
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: 添加等级配置
|
||||
tags:
|
||||
- 等级配置
|
||||
/config/level/detail:
|
||||
get:
|
||||
parameters:
|
||||
- description: 等级配置id
|
||||
in: query
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: '{"success":true,"data":{},"msg":"查询成功"}'
|
||||
schema:
|
||||
type: string
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: 等级配置详情
|
||||
tags:
|
||||
- 等级配置
|
||||
/config/level/list:
|
||||
get:
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: '{"success":true,"data":{},"msg":"查询成功"}'
|
||||
schema:
|
||||
type: string
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: 等级配置列表
|
||||
tags:
|
||||
- 等级配置
|
||||
/config/level/update:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: 修改等级配置
|
||||
in: body
|
||||
name: data
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/request.UpdateLevelConf'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: '{"success":true,"data":{},"msg":"修改成功"}'
|
||||
schema:
|
||||
type: string
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: 修改等级配置
|
||||
tags:
|
||||
- 等级配置
|
||||
/menu/delete:
|
||||
get:
|
||||
description: 删除menu
|
||||
@@ -1151,33 +1368,6 @@ paths:
|
||||
summary: 更新菜单
|
||||
tags:
|
||||
- 菜单管理
|
||||
/ocr/base64:
|
||||
post:
|
||||
consumes:
|
||||
- multipart/form-data
|
||||
parameters:
|
||||
- description: 植物识别
|
||||
in: formData
|
||||
name: file
|
||||
required: true
|
||||
type: file
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: 文件OCR
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/response.Response'
|
||||
- properties:
|
||||
msg:
|
||||
type: string
|
||||
type: object
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: base64植物识别
|
||||
tags:
|
||||
- 识别相关
|
||||
/oss/delete:
|
||||
post:
|
||||
consumes:
|
||||
@@ -1398,6 +1588,29 @@ paths:
|
||||
summary: ById植物详情
|
||||
tags:
|
||||
- 我的植物
|
||||
/plant/growth/add:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: 添加成长记录
|
||||
in: body
|
||||
name: data
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/request.CreateGrowthRecord'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: '{"success":true,"data":{},"msg":"添加成功"}'
|
||||
schema:
|
||||
type: string
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: 添加成长记录
|
||||
tags:
|
||||
- 我的植物
|
||||
/plant/page:
|
||||
post:
|
||||
consumes:
|
||||
@@ -1421,6 +1634,49 @@ paths:
|
||||
summary: 植物列表
|
||||
tags:
|
||||
- 我的植物
|
||||
/plant/plan/add:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: 添加养护事项
|
||||
in: body
|
||||
name: data
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/request.CreateCarePlan'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: '{"success":true,"data":{},"msg":"添加成功"}'
|
||||
schema:
|
||||
type: string
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: 添加养护事项
|
||||
tags:
|
||||
- 我的植物
|
||||
/plant/plan/delete:
|
||||
get:
|
||||
parameters:
|
||||
- description: id
|
||||
in: query
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: '{"success":true,"data":{},"msg":"删除成功"}'
|
||||
schema:
|
||||
type: string
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: 删除养护事项
|
||||
tags:
|
||||
- 我的植物
|
||||
/plant/todayTask:
|
||||
get:
|
||||
consumes:
|
||||
@@ -1577,6 +1833,43 @@ paths:
|
||||
summary: 发布帖子
|
||||
tags:
|
||||
- 帖子
|
||||
/profile/detail:
|
||||
get:
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: '{"success":true,"data":{},"msg":"查询成功"}'
|
||||
schema:
|
||||
type: string
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: 用户详情
|
||||
tags:
|
||||
- 个人中心
|
||||
/profile/update:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: 修改用户信息
|
||||
in: body
|
||||
name: data
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/request.UpdateProfile'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: '{"success":true,"data":{},"msg":"修改成功"}'
|
||||
schema:
|
||||
type: string
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: 修改用户信息
|
||||
tags:
|
||||
- 个人中心
|
||||
/role/delete:
|
||||
post:
|
||||
consumes:
|
||||
@@ -1965,6 +2258,20 @@ paths:
|
||||
summary: 给用户分配角色
|
||||
tags:
|
||||
- 用户管理
|
||||
/user/info:
|
||||
get:
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: '{"code": 200, "data": {}, "msg": "添加成功"}'
|
||||
schema:
|
||||
$ref: '#/definitions/response.Response'
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: 当前登录用户
|
||||
tags:
|
||||
- 用户管理
|
||||
/user/save:
|
||||
post:
|
||||
consumes:
|
||||
|
||||
@@ -53,6 +53,7 @@ func MigrateTable() {
|
||||
plant.ClassifyRecord{}, //植物识别记录
|
||||
|
||||
plant.LevelConfig{}, //等级配置
|
||||
plant.UserProfile{}, //用户资料
|
||||
|
||||
)
|
||||
if err != nil {
|
||||
|
||||
@@ -56,6 +56,7 @@ func Routers() {
|
||||
plantGroup.InitWikiRouter(NeedAuthGroup) //百科
|
||||
plantGroup.InitOcrRouter(NeedAuthGroup) // ocr识别
|
||||
plantGroup.InitLevelConfigRouter(NeedAuthGroup) //等级配置
|
||||
plantGroup.InitUserProfileRouter(NeedAuthGroup) //用户资料
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
package request
|
||||
|
||||
type UpdateProfile struct {
|
||||
Nickname string `json:"nickname"`
|
||||
AvatarId string `json:"avatarId"`
|
||||
}
|
||||
@@ -8,5 +8,5 @@ type LevelConfig struct {
|
||||
Level int `json:"level" gorm:"column:level"` // 等级数值
|
||||
Title string `json:"title" gorm:"column:title"` // 等级称号 (e.g., "萌芽园丁")
|
||||
MinSunlight int64 `json:"minSunlight" gorm:"column:min_sunlight"` // 达到该等级所需的最小阳光值
|
||||
Perks string `json:"perks" gorm:"column:column:perks"` // 解锁权益描述 (e.g., "解锁智能诊断")
|
||||
Perks string `json:"perks" gorm:"column:perks"` // 解锁权益描述 (e.g., "解锁智能诊断")
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package plant
|
||||
|
||||
import (
|
||||
"sundynix-go/global"
|
||||
"sundynix-go/model/system"
|
||||
)
|
||||
|
||||
type UserProfile struct {
|
||||
global.BaseModel
|
||||
UserId string `json:"userId" gorm:"index;column:user_id"`
|
||||
Nickname string `json:"nickname" gorm:"column:nick_name"`
|
||||
AvatarId string `json:"avatarId" gorm:"column:avatar_id"`
|
||||
LevelId string `json:"levelId" gorm:"column:level_id"` // 当前等级id
|
||||
CurrentSunlight int64 `json:"currentSunlight" gorm:"column:current_sunlight"` // 当前持有阳光值 (可消耗)
|
||||
TotalSunlight int64 `json:"totalSunlight" gorm:"column:total_sunlight"` // 历史累计阳光值 (用于计算等级)
|
||||
PlantCount int64 `json:"plantCount" gorm:"column:plant_count"`
|
||||
CareCount int64 `json:"careCount" gorm:"column:care_count"`
|
||||
PostCount int64 `json:"postCount" gorm:"column:post_count"`
|
||||
Avatar *system.Oss `json:"avatar" gorm:"foreignKey:AvatarId"`
|
||||
Level *LevelConfig `json:"level" gorm:"foreignKey:LevelId"`
|
||||
}
|
||||
@@ -8,7 +8,8 @@ type Menu struct {
|
||||
Category int `json:"category" form:"category"`
|
||||
Name string `gorm:"size:20" json:"name" form:"name"`
|
||||
Title string `gorm:"size:20" json:"title" form:"title"`
|
||||
Code string `gorm:"size:20" json:"code" form:"code"`
|
||||
Code string `gorm:"size:50" json:"code" form:"code"`
|
||||
Path string `gorm:"size:100" json:"path" form:"path"`
|
||||
Permission string `gorm:"size:20" json:"permission" form:"permission"`
|
||||
Locale string `gorm:"size:50" json:"locale" form:"locale"`
|
||||
Icon string `gorm:"size:20" json:"icon" form:"icon"`
|
||||
|
||||
@@ -10,6 +10,7 @@ type RouterGroup struct {
|
||||
WikiRouter
|
||||
OcrRouter
|
||||
LevelConfigRouter
|
||||
UserProfileRouter
|
||||
}
|
||||
|
||||
// 初始化路由
|
||||
@@ -21,4 +22,5 @@ var (
|
||||
wikiApi = v1.ApiGroupApp.PlantApiGroup.WikiApi
|
||||
ocrApi = v1.ApiGroupApp.PlantApiGroup.OcrApi
|
||||
levelConfigApi = v1.ApiGroupApp.PlantApiGroup.LevelConfigApi
|
||||
userProfileApi = v1.ApiGroupApp.PlantApiGroup.UserProfileApi
|
||||
)
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package plant
|
||||
|
||||
import "github.com/gin-gonic/gin"
|
||||
|
||||
type UserProfileRouter struct{}
|
||||
|
||||
func (c *OcrRouter) InitUserProfileRouter(Router *gin.RouterGroup) {
|
||||
userProfileRouter := Router.Group("profile")
|
||||
{
|
||||
userProfileRouter.POST("/update", userProfileApi.UpdateProfile)
|
||||
userProfileRouter.GET("/detail", userProfileApi.ProfileDetail)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,4 +8,5 @@ type ServiceGroup struct {
|
||||
WikiService
|
||||
OcrService
|
||||
LevelConfigService
|
||||
UserProfileService
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package plant
|
||||
|
||||
import (
|
||||
"sundynix-go/global"
|
||||
"sundynix-go/model/plant"
|
||||
plantReq "sundynix-go/model/plant/request"
|
||||
)
|
||||
|
||||
type UserProfileService struct{}
|
||||
|
||||
// UpdateProfile 修改用户信息
|
||||
func (s *UserProfileService) UpdateProfile(req plantReq.UpdateProfile, userId string) error {
|
||||
updateMap := map[string]interface{}{
|
||||
"nick_name": req.Nickname,
|
||||
"avatar_id": req.AvatarId,
|
||||
}
|
||||
return global.DB.Model(&plant.UserProfile{}).Where("user_id = ?", userId).Updates(updateMap).Error
|
||||
|
||||
}
|
||||
|
||||
// ProfileDetail 获取用户详情
|
||||
func (s *UserProfileService) ProfileDetail(userId string) (plant.UserProfile, error) {
|
||||
var res plant.UserProfile
|
||||
err := global.DB.Where("user_id = ?", userId).Preload("Avatar").Preload("Level").First(&res).Error
|
||||
if err != nil {
|
||||
return res, err
|
||||
}
|
||||
return res, nil
|
||||
}
|
||||
@@ -27,6 +27,7 @@ func (s *MenuService) UpdateMenu(menu *system.Menu) (err error) {
|
||||
"Name": menu.Name,
|
||||
"Title": menu.Title,
|
||||
"Code": menu.Code,
|
||||
"path": menu.Path,
|
||||
"Permission": menu.Permission,
|
||||
"Locale": menu.Locale,
|
||||
"Icon": menu.Icon,
|
||||
|
||||
+13
-13
@@ -12,6 +12,7 @@ import (
|
||||
"strconv"
|
||||
"sundynix-go/global"
|
||||
common "sundynix-go/model/commom/request"
|
||||
"sundynix-go/model/plant"
|
||||
"sundynix-go/model/system"
|
||||
systemReq "sundynix-go/model/system/request"
|
||||
systemResp "sundynix-go/model/system/response"
|
||||
@@ -157,19 +158,18 @@ func (userService *UserService) MiniLogin(code string) (result *system.User, err
|
||||
if err := tx.Create(&newUser).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
//// 归一化到当天的0点(本地时区)
|
||||
//now := time.Now()
|
||||
//today := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, time.Local)
|
||||
//personal := plant.Personal{
|
||||
// UserId: newUser.Id,
|
||||
// JoinDate: today,
|
||||
// PlantCount: 0,
|
||||
// CareCount: 0,
|
||||
// BadgeCount: 0,
|
||||
//}
|
||||
//if err := tx.Create(&personal).Error; err != nil {
|
||||
// return err
|
||||
//}
|
||||
profile := plant.UserProfile{
|
||||
UserId: newUser.Id,
|
||||
Nickname: newUser.Name,
|
||||
CurrentSunlight: 0,
|
||||
TotalSunlight: 0,
|
||||
PlantCount: 0,
|
||||
CareCount: 0,
|
||||
PostCount: 0,
|
||||
}
|
||||
if err := tx.Create(&profile).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
// 赋值给外部变量以便返回
|
||||
user = newUser
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user