server code 4/27

This commit is contained in:
袁智鸿
2026-04-27 10:35:03 +08:00
parent f0fa33cd67
commit 2ccbcd01c0
143 changed files with 5812 additions and 756 deletions
+19
View File
@@ -0,0 +1,19 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package admin
import (
"context"
"stackChan/api/admin/v1"
)
type IAdminV1 interface {
AdminLogin(ctx context.Context, req *v1.AdminLoginReq) (res *v1.AdminLoginRes, err error)
AddApp(ctx context.Context, req *v1.AddAppReq) (res *v1.AddAppRes, err error)
GetAppList(ctx context.Context, req *v1.GetAppListReq) (res *v1.GetAppListRes, err error)
DeleteApp(ctx context.Context, req *v1.DeleteAppReq) (res *v1.DeleteAppRes, err error)
UpdateApp(ctx context.Context, req *v1.UpdateAppReq) (res *v1.UpdateAppRes, err error)
}
+18
View File
@@ -0,0 +1,18 @@
/*
SPDX-FileCopyrightText: 2026 M5Stack Technology CO LTD
SPDX-License-Identifier: MIT
*/
package v1
import "github.com/gogf/gf/v2/frame/g"
type AdminLoginReq struct {
g.Meta `path:"/login" method:"post" tags:"Info" summary:"admin login info"`
UserName string `json:"user_name" description:"Admin username"`
Password string `json:"pass_word" description:"Admin password"`
}
type AdminLoginRes struct {
Token string `json:"token"`
}
+46
View File
@@ -0,0 +1,46 @@
/*
SPDX-FileCopyrightText: 2026 M5Stack Technology CO LTD
SPDX-License-Identifier: MIT
*/
package v1
import (
"stackChan/internal/model"
"github.com/gogf/gf/v2/frame/g"
)
type AddAppReq struct {
g.Meta `path:"/app/add" method:"post" tags:"App" summary:"App add request"`
AppName string `json:"appName" orm:"app_name" v:"required" d:"" description:"App name (required)"`
AppIconUrl string `json:"appIconUrl" orm:"app_icon_url" d:"" description:"App icon URL (optional)"`
Description string `json:"description" orm:"description" d:"" description:"App description (optional)"`
FirmwareUrl string `json:"firmwareUrl" orm:"firmware_url" d:"" description:"Firmware / installation package download URL (optional)"`
}
type AddAppRes model.AppInfo
type GetAppListReq struct {
g.Meta `path:"/apps" method:"get" tags:"App" summary:"App List Get"`
}
type GetAppListRes []model.AppInfo
type DeleteAppReq struct {
g.Meta `path:"/app/delete" method:"delete" tags:"App" summary:"App delete"`
Id int64 `json:"id" orm:"id" description:"App ID"` // App ID
}
type DeleteAppRes struct{}
type UpdateAppReq struct {
g.Meta `path:"/app/update" method:"put" tags:"App" summary:"App put"`
Id int64 `json:"id" orm:"id" v:"required" description:"App ID (required)"`
AppName string `json:"appName" orm:"app_name" d:"" description:"App name (optional)"`
AppIconUrl string `json:"appIconUrl" orm:"app_icon_url" d:"" description:"App icon URL (optional)"`
Description string `json:"description" orm:"description" d:"" description:"App description (optional)"`
FirmwareUrl string `json:"firmwareUrl" orm:"firmware_url" d:"" description:"Firmware / installation package download URL (optional)"`
}
type UpdateAppRes model.AppInfo
+15
View File
@@ -0,0 +1,15 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package appstore
import (
"context"
"stackChan/api/appstore/v1"
)
type IAppstoreV1 interface {
GetAppList(ctx context.Context, req *v1.GetAppListReq) (res *v1.GetAppListRes, err error)
}
+18
View File
@@ -0,0 +1,18 @@
/*
SPDX-FileCopyrightText: 2026 M5Stack Technology CO LTD
SPDX-License-Identifier: MIT
*/
package v1
import (
"stackChan/internal/model"
"github.com/gogf/gf/v2/frame/g"
)
type GetAppListReq struct {
g.Meta `path:"/apps" method:"get" tags:"App" summary:"App List Get"`
}
type GetAppListRes []model.AppInfo
+11
View File
@@ -8,6 +8,7 @@ import (
"context"
"stackChan/api/dance/v1"
"stackChan/api/dance/v2"
)
type IDanceV1 interface {
@@ -15,4 +16,14 @@ type IDanceV1 interface {
Delete(ctx context.Context, req *v1.DeleteReq) (res *v1.DeleteRes, err error)
Update(ctx context.Context, req *v1.UpdateReq) (res *v1.UpdateRes, err error)
GetList(ctx context.Context, req *v1.GetListReq) (res *v1.GetListRes, err error)
GetDanceInfo(ctx context.Context, req *v1.GetDanceInfoReq) (res *v1.GetDanceInfoRes, err error)
GetMusicList(ctx context.Context, req *v1.GetMusicListReq) (res *v1.GetMusicListRes, err error)
}
type IDanceV2 interface {
GetList(ctx context.Context, req *v2.GetListReq) (res *v2.GetListRes, err error)
Create(ctx context.Context, req *v2.CreateReq) (res *v2.CreateRes, err error)
Delete(ctx context.Context, req *v2.DeleteReq) (res *v2.DeleteRes, err error)
Update(ctx context.Context, req *v2.UpdateReq) (res *v2.UpdateRes, err error)
GetDanceInfo(ctx context.Context, req *v2.GetDanceInfoReq) (res *v2.GetDanceInfoRes, err error)
}
+25 -12
View File
@@ -6,40 +6,53 @@ SPDX-License-Identifier: MIT
package v1
import (
"encoding/json"
"stackChan/internal/model"
"github.com/gogf/gf/v2/frame/g"
)
type CreateReq struct {
g.Meta `path:"/dance" method:"post" tags:"Dance" summary:"Dance create request"`
Mac string `json:"mac" v:"required"`
Index int `json:"index" v:"required"`
List []model.DanceData `json:"list" v:"required"`
g.Meta `path:"/dance" method:"post" tags:"Dance" summary:"Dance create request"`
DanceData json.RawMessage `json:"danceData"` // Dance motion data
DanceName string `json:"danceName" v:"required"` // Dance name
MusicUrl string `json:"musicUrl"` // Dance background music URL
}
type CreateRes string
type DeleteReq struct {
g.Meta `path:"/dance" method:"delete" tags:"Dance" summary:"Dance delete request"`
Mac string `json:"mac" v:"required"`
Index int `json:"index" v:"required"`
Id int64 `json:"id" v:"required"`
}
type DeleteRes string
type UpdateReq struct {
g.Meta `path:"/dance" method:"put" tags:"Dance" summary:"Dance put request"`
Mac string `json:"mac" v:"required"`
Index int `json:"index" v:"required"`
Data []model.DanceData `json:"list" v:"required"`
g.Meta `path:"/dance" method:"put" tags:"Dance" summary:"Dance put request"`
Id int64 `json:"id" v:"required"`
DanceData json.RawMessage `json:"danceData"` // Dance motion data
DanceName string `json:"danceName"` // Dance name
MusicUrl string `json:"musicUrl"` // Dance background music URL
}
type UpdateRes string
type GetListReq struct {
g.Meta `path:"/dance" method:"get" tags:"Dance" summary:"Dance get request"`
Mac string `json:"mac" v:"required"`
}
type GetListRes map[string][]model.DanceData
type GetListRes []model.Dance
type GetDanceInfoReq struct {
g.Meta `path:"/danceData" method:"get" tags:"Dance get request"`
Id int64 `json:"id" v:"required"`
}
type GetDanceInfoRes model.Dance
type GetMusicListReq struct {
g.Meta `path:"/musicList" method:"get" tags:"Dance get request"`
}
type GetMusicListRes []string
+54
View File
@@ -0,0 +1,54 @@
/*
SPDX-FileCopyrightText: 2026 M5Stack Technology CO LTD
SPDX-License-Identifier: MIT
*/
package v2
import (
"encoding/json"
"stackChan/internal/model"
"github.com/gogf/gf/v2/frame/g"
)
type GetListReq struct {
g.Meta `path:"/dance" method:"get" tags:"Dance" summary:"Dance get request"`
Mac string `json:"mac" v:"required"` // mac address
}
type GetListRes []model.Dance
type CreateReq struct {
g.Meta `path:"/dance" method:"post" tags:"Dance" summary:"Dance create request"`
Mac string `json:"mac" v:"required"` // mac address
DanceData json.RawMessage `json:"danceData"` // Dance motion data
DanceName string `json:"danceName" v:"required"` // Dance name
MusicUrl string `json:"musicUrl"` // Dance background music URL
}
type CreateRes string
type DeleteReq struct {
g.Meta `path:"/dance" method:"delete" tags:"Dance" summary:"Dance delete request"`
Id int64 `json:"id" v:"required"`
}
type DeleteRes string
type UpdateReq struct {
g.Meta `path:"/dance" method:"put" tags:"Dance" summary:"Dance put request"`
Id int64 `json:"id" v:"required"`
DanceData json.RawMessage `json:"danceData"` // Dance motion data
DanceName string `json:"danceName"` // Dance name
MusicUrl string `json:"musicUrl"` // Dance background music URL
}
type UpdateRes string
type GetDanceInfoReq struct {
g.Meta `path:"/danceData" method:"get" tags:"Dance get request"`
Id int64 `json:"id" v:"required"`
}
type GetDanceInfoRes model.Dance
+9
View File
@@ -8,6 +8,7 @@ import (
"context"
"stackChan/api/device/v1"
"stackChan/api/device/v2"
)
type IDeviceV1 interface {
@@ -17,3 +18,11 @@ type IDeviceV1 interface {
GetDeviceInfo(ctx context.Context, req *v1.GetDeviceInfoReq) (res *v1.GetDeviceInfoRes, err error)
UpdateDeviceInfo(ctx context.Context, req *v1.UpdateDeviceInfoReq) (res *v1.UpdateDeviceInfoRes, err error)
}
type IDeviceV2 interface {
GetDevices(ctx context.Context, req *v2.GetDevicesReq) (res *v2.GetDevicesRes, err error)
BindDevice(ctx context.Context, req *v2.BindDeviceReq) (res *v2.BindDeviceRes, err error)
UnbindDevice(ctx context.Context, req *v2.UnbindDeviceReq) (res *v2.UnbindDeviceRes, err error)
UpdateDevice(ctx context.Context, req *v2.UpdateDeviceReq) (res *v2.UpdateDeviceRes, err error)
AgentRestoreDefault(ctx context.Context, req *v2.AgentRestoreDefaultReq) (res *v2.AgentRestoreDefaultRes, err error)
}
+2 -6
View File
@@ -14,7 +14,6 @@ import (
type CreateReq struct {
g.Meta `path:"/device" method:"post" tags:"Device" summary:"Device create request"`
Mac string `json:"mac" v:"required" description:"Mac address"`
Name string `json:"name,omitempty" description:"Device name"`
}
@@ -24,29 +23,26 @@ type CreateRes struct {
type UpdateReq struct {
g.Meta `path:"/device" method:"put" tags:"Device" summary:"Device update request"`
Mac string `json:"mac" v:"required" description:"Mac address"`
Name string `json:"name" description:"Device name"`
}
type UpdateRes struct{}
type GetRandomDeviceReq struct {
g.Meta `path:"/device/randomList" method:"get" tags:"Device" summary:"Device get Random"`
Mac string `json:"mac" v:"required" description:"Mac address"`
g.Meta `path:"/device/randomList" method:"get" tags:"Device" summary:"Device get Random"`
PageSize int `json:"pageSize" v:"required" d:"6" description:"Page size"`
}
type GetRandomDeviceRes []entity.Device
type GetDeviceInfoReq struct {
g.Meta `path:"/device/info" method:"get" tags:"Device" summary:"Device Info Get request"`
Mac string `json:"mac" v:"required" description:"Mac address"`
}
type GetDeviceInfoRes model.DeviceInfo
type UpdateDeviceInfoReq struct {
g.Meta `path:"/device/info" method:"put" tags:"Device" summary:"Device Info Put request"`
Mac string `json:"mac" v:"required" description:"Mac address"`
Name string `json:"name" description:"Device name"`
}
+49
View File
@@ -0,0 +1,49 @@
/*
SPDX-FileCopyrightText: 2026 M5Stack Technology CO LTD
SPDX-License-Identifier: MIT
*/
package v2
import (
"stackChan/internal/model"
"github.com/gogf/gf/v2/frame/g"
)
type GetDevicesReq struct {
g.Meta `path:"/devices" method:"get" tags:"Device" summary:"Devices Get request"`
}
type GetDevicesRes []model.DeviceInfo
type BindDeviceReq struct {
g.Meta `path:"/device/bind" method:"post" tags:"Device" summary:"Bind device to current user"`
Mac string `json:"mac" v:"required" dc:"Device MAC address"`
}
type BindDeviceRes bool
type UnbindDeviceReq struct {
g.Meta `path:"/device/unbind" method:"post" tags:"Device" summary:"Unbind device from current user"`
Mac string `json:"mac" v:"required" dc:"Device MAC address"`
}
type UnbindDeviceRes bool
type UpdateDeviceReq struct {
g.Meta `path:"/device/update" method:"put" tags:"Device" summary:"Update device name for current user's bound device"`
Mac string `json:"mac" v:"required" dc:"Device MAC address"`
Name string `json:"name" dc:"New device name"`
Longitude float64 `json:"longitude" dc:"Device longitude"`
Latitude float64 `json:"latitude" dc:"Device latitude"`
}
type UpdateDeviceRes bool
type AgentRestoreDefaultReq struct {
g.Meta `path:"/device/agent/restore" method:"post" tags:"Device" summary:"Restore Agent to default template settings"`
Mac string `json:"mac" v:"required" dc:"Device MAC address"`
}
type AgentRestoreDefaultRes bool
-1
View File
@@ -9,7 +9,6 @@ import "github.com/gogf/gf/v2/frame/g"
type AddReq struct {
g.Meta `path:"/friend" method:"post" tags:"Friend" summary:"Friend add request"`
Mac string `json:"mac" v:"required" description:"Mac address"`
FriendMac string `json:"friendMac" v:"required" description:"Friend Mac address"`
}
+16
View File
@@ -0,0 +1,16 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package pano
import (
"context"
"stackChan/api/pano/v1"
)
type IPanoV1 interface {
AddPano(ctx context.Context, req *v1.AddPanoReq) (res *v1.AddPanoRes, err error)
GetPanoList(ctx context.Context, req *v1.GetPanoListReq) (res *v1.GetPanoListRes, err error)
}
+27
View File
@@ -0,0 +1,27 @@
/*
SPDX-FileCopyrightText: 2026 M5Stack Technology CO LTD
SPDX-License-Identifier: MIT
*/
package v1
import (
"stackChan/internal/model"
"github.com/gogf/gf/v2/frame/g"
)
type AddPanoReq struct {
g.Meta `path:"/pano" method:"post" tags:"Pano" summary:"Pano add request"`
Url string `json:"url" v:"required" description:"Pano image url"`
}
type AddPanoRes struct {
Id int64 `json:"id"`
}
type GetPanoListReq struct {
g.Meta `path:"/pano" method:"get" tags:"Pano" summary:"Pano list"`
}
type GetPanoListRes []model.Pano
+10 -13
View File
@@ -13,9 +13,8 @@ import (
type CreatePostReq struct {
g.Meta `path:"/post/add" method:"post" tags:"Post" summary:"Post create request"`
Mac string `json:"mac" v:"required" description:"Mac address"`
ContentText string `json:"content_text" v:"required" description:"Content text"`
ContentImage string `json:"content_image" v:"required" description:"Content image"`
ContentImage string `json:"content_image" description:"Content image"`
}
type CreatePostRes struct {
@@ -24,8 +23,8 @@ type CreatePostRes struct {
type GetPostReq struct {
g.Meta `path:"/post/get" method:"get" tags:"Post" summary:"Post get request"`
Page int `json:"page" v:"required#Page不能为空" description:"页码"`
PageSize int `json:"pageSize" v:"required#每页数量不能为空" description:"每页条数"`
Page int `json:"page" v:"required#Page cannot be empty" description:"Page number"`
PageSize int `json:"pageSize" v:"required#Page size cannot be empty" description:"Items per page"`
}
type GetPostRes []model.Post
@@ -39,9 +38,8 @@ type DeletePostRes string
type CreatePostCommentReq struct {
g.Meta `path:"/post/comment/create" method:"post" tags:"Post" summary:"Post create comment"`
Mac string `json:"mac" v:"required" description:"Mac address"`
PostId int64 `json:"postId" v:"required" summary:"Post comment id"`
Content string `json:"content" description:"评论内容"`
Content string `json:"content" description:"Comment content"`
}
type CreatePostCommentRes struct {
@@ -49,19 +47,18 @@ type CreatePostCommentRes struct {
}
type DeletePostCommentReq struct {
g.Meta `path:"/post/comment/delete" method:"post" tags:"Post" summary:"Post delete comment"`
Mac string `json:"mac" v:"required" description:"Mac address"`
Id int `json:"id" summary:"Post comment id"`
g.Meta `path:"/post/comment/delete" method:"delete" tags:"Post" summary:"Post delete comment"`
PostId int64 `json:"postId" v:"required" summary:"Post comment id"`
CommentId int `json:"commentId" v:"required" summary:"Post comment id"`
}
type DeletePostCommentRes struct{}
type GetPostCommentReq struct {
g.Meta `path:"/post/comment/get" method:"get" tags:"Post" summary:"Post get comment"`
PostId int64 `json:"postId" summary:"Post comment id"`
Mac string `json:"mac" v:"required" description:"Mac address"`
Page int `json:"page" summary:"Post comment page"`
PageSize int `json:"pageSize" summary:"Post comment page"`
PostId int64 `json:"postId" summary:"Post comment id"`
Page int `json:"page" summary:"Post comment page"`
PageSize int `json:"pageSize" summary:"Post comment page"`
}
type GetPostCommentRes struct {
@@ -0,0 +1,16 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package stackchandevice
import (
"context"
"stackChan/api/stackchandevice/v2"
)
type IStackchandeviceV2 interface {
GetDeviceUserInfo(ctx context.Context, req *v2.GetDeviceUserInfoReq) (res *v2.GetDeviceUserInfoRes, err error)
UnbindDevice(ctx context.Context, req *v2.UnbindDeviceReq) (res *v2.UnbindDeviceRes, err error)
}
+24
View File
@@ -0,0 +1,24 @@
/*
SPDX-FileCopyrightText: 2026 M5Stack Technology CO LTD
SPDX-License-Identifier: MIT
*/
package v2
import (
"stackChan/internal/model"
"github.com/gogf/gf/v2/frame/g"
)
type GetDeviceUserInfoReq struct {
g.Meta `path:"/device/user" method:"get" tags:"Device" summary:"Get device information for StackChan device"`
}
type GetDeviceUserInfoRes *model.User
type UnbindDeviceReq struct {
g.Meta `path:"/device/unbind" method:"post" tags:"Device" summary:"Unbind device from current user for StackChan device"`
}
type UnbindDeviceRes bool
+17
View File
@@ -0,0 +1,17 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package user
import (
"context"
"stackChan/api/user/v2"
)
type IUserV2 interface {
Login(ctx context.Context, req *v2.LoginReq) (res *v2.LoginRes, err error)
GetUserInfo(ctx context.Context, req *v2.GetUserInfoReq) (res *v2.GetUserInfoRes, err error)
Registration(ctx context.Context, req *v2.RegistrationReq) (res *v2.RegistrationRes, err error)
}
+37
View File
@@ -0,0 +1,37 @@
/*
SPDX-FileCopyrightText: 2026 M5Stack Technology CO LTD
SPDX-License-Identifier: MIT
*/
package v2
import (
"stackChan/internal/model"
"github.com/gogf/gf/v2/frame/g"
)
type LoginReq struct {
g.Meta `path:"user/login" method:"post" tags:"Info" summary:"user login info"`
Username string `json:"username" v:"required" description:"Account or email"`
Password string `json:"password" v:"required" description:"Password"`
}
type LoginRes struct {
Token string `json:"token"`
}
type GetUserInfoReq struct {
g.Meta `path:"user" method:"get" tags:"Info" summary:"user get info"`
}
type GetUserInfoRes model.User
type RegistrationReq struct {
g.Meta `path:"user/registration" method:"post" tags:"Info" summary:"user registration"`
UserName string `json:"username" v:"required" description:"Username"`
Email string `json:"email" v:"required" description:"Email address"`
Password string `json:"password" v:"required" description:"Password"`
}
type RegistrationRes *model.RegistrationResponse
+26
View File
@@ -0,0 +1,26 @@
/*
SPDX-FileCopyrightText: 2026 M5Stack Technology CO LTD
SPDX-License-Identifier: MIT
*/
package v1
import "github.com/gogf/gf/v2/frame/g"
type GetXiaoZhiTokenReq struct {
g.Meta `path:"/xiaozhi/token" method:"get" tags:"XiaoZhi" summary:"XiaoZhi token"`
}
type GetXiaoZhiTokenRes string
type RefreshTokenReq struct {
g.Meta `path:"/xiaozhi/token/refresh" method:"get" tags:"XiaoZhi" summary:"XiaoZhi token refresh"`
}
type RefreshTokenRes string
type GetXiaoZhiGenerateLicenseTokenReq struct {
g.Meta `path:"/xiaozhi/generateLicenseToken" method:"get" tags:"XiaoZhi" summary:"XiaoZhi generateLicenseToken"`
}
type GetXiaoZhiGenerateLicenseTokenRes string
+17
View File
@@ -0,0 +1,17 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package xiaozhi
import (
"context"
"stackChan/api/xiaozhi/v1"
)
type IXiaozhiV1 interface {
GetXiaoZhiToken(ctx context.Context, req *v1.GetXiaoZhiTokenReq) (res *v1.GetXiaoZhiTokenRes, err error)
RefreshToken(ctx context.Context, req *v1.RefreshTokenReq) (res *v1.RefreshTokenRes, err error)
GetXiaoZhiGenerateLicenseToken(ctx context.Context, req *v1.GetXiaoZhiGenerateLicenseTokenReq) (res *v1.GetXiaoZhiGenerateLicenseTokenRes, err error)
}