初始化项目框架,完成部分接口开发
This commit is contained in:
16
api/admin/admin.go
Normal file
16
api/admin/admin.go
Normal file
@ -0,0 +1,16 @@
|
||||
// =================================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// =================================================================================
|
||||
|
||||
package admin
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"server/api/admin/v1"
|
||||
)
|
||||
|
||||
type IAdminV1 interface {
|
||||
AdminInfo(ctx context.Context, req *v1.AdminInfoReq) (res *v1.AdminInfoRes, err error)
|
||||
AdminEditPass(ctx context.Context, req *v1.AdminEditPassReq) (res *v1.AdminEditPassRes, err error)
|
||||
}
|
||||
24
api/admin/v1/admin.go
Normal file
24
api/admin/v1/admin.go
Normal file
@ -0,0 +1,24 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
type AdminInfoReq struct {
|
||||
g.Meta `path:"/admin/info" tags:"Admin" method:"get" summary:"管理员信息"`
|
||||
}
|
||||
type AdminInfoRes struct {
|
||||
g.Meta `mime:"application/json"`
|
||||
AdminId int64 `json:"adminId"`
|
||||
Username string `json:"username"`
|
||||
}
|
||||
|
||||
type AdminEditPassReq struct {
|
||||
g.Meta `path:"/admin/editPass" tags:"Admin" method:"post" summary:"修改密码"`
|
||||
OldPass string `json:"oldPass" v:"required" dc:"旧密码"`
|
||||
NewPass string `json:"newPass" v:"required" dc:"新密码"`
|
||||
}
|
||||
type AdminEditPassRes struct {
|
||||
g.Meta `mime:"application/json"`
|
||||
Success bool
|
||||
}
|
||||
19
api/auth/auth.go
Normal file
19
api/auth/auth.go
Normal file
@ -0,0 +1,19 @@
|
||||
// =================================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// =================================================================================
|
||||
|
||||
package auth
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"server/api/auth/v1"
|
||||
)
|
||||
|
||||
type IAuthV1 interface {
|
||||
AdminLogin(ctx context.Context, req *v1.AdminLoginReq) (res *v1.AdminLoginRes, err error)
|
||||
UserLogin(ctx context.Context, req *v1.UserLoginReq) (res *v1.UserLoginRes, err error)
|
||||
UserRegister(ctx context.Context, req *v1.UserRegisterReq) (res *v1.UserRegisterRes, err error)
|
||||
UserEditPass(ctx context.Context, req *v1.UserEditPassReq) (res *v1.UserEditPassRes, err error)
|
||||
UserCode(ctx context.Context, req *v1.UserCodeReq) (res *v1.UserCodeRes, err error)
|
||||
}
|
||||
47
api/auth/v1/auth.go
Normal file
47
api/auth/v1/auth.go
Normal file
@ -0,0 +1,47 @@
|
||||
package v1
|
||||
|
||||
import "github.com/gogf/gf/v2/frame/g"
|
||||
|
||||
type AdminLoginReq struct {
|
||||
g.Meta `path:"/admin/login" tags:"Admin" method:"post" summary:"管理员登录"`
|
||||
Username string `json:"username" v:"required" dc:"用户名"`
|
||||
Password string `json:"password" v:"required" dc:"密码"`
|
||||
}
|
||||
type AdminLoginRes struct {
|
||||
Token string `json:"token" dc:"token"`
|
||||
}
|
||||
type UserLoginReq struct {
|
||||
g.Meta `path:"/user/login" tags:"APP/User" method:"post" summary:"用户登录"`
|
||||
Email string `json:"email" v:"required" dc:"邮箱"`
|
||||
Password string `json:"password" v:"required" dc:"密码"`
|
||||
}
|
||||
type UserLoginRes struct {
|
||||
Token string `json:"token" dc:"token"`
|
||||
}
|
||||
type UserRegisterReq struct {
|
||||
g.Meta `path:"/user/register" tags:"APP/User" method:"post" summary:"用户注册"`
|
||||
Email string `json:"email" v:"required" dc:"邮箱"`
|
||||
Password string `json:"password" v:"required" dc:"密码"`
|
||||
Password2 string `json:"password2" v:"required|same:password" dc:"确认密码"`
|
||||
}
|
||||
type UserRegisterRes struct {
|
||||
Success bool `json:"success" dc:"是否成功"`
|
||||
}
|
||||
type UserEditPassReq struct {
|
||||
g.Meta `path:"/user/editPass" tags:"APP/User" method:"post" summary:"修改密码"`
|
||||
Email string `json:"email" v:"required" dc:"邮箱"`
|
||||
Password string `json:"password" v:"required" dc:"密码"`
|
||||
Password2 string `json:"password2" v:"required|same:password" dc:"确认密码"`
|
||||
Sign string `json:"sign" v:"required" dc:"验证码"`
|
||||
}
|
||||
|
||||
type UserEditPassRes struct {
|
||||
Success bool `json:"success" dc:"是否成功"`
|
||||
}
|
||||
type UserCodeReq struct {
|
||||
g.Meta `path:"/user/code" tags:"APP/User" method:"post" summary:"获取验证码"`
|
||||
Email string `json:"email" v:"required" dc:"邮箱"`
|
||||
}
|
||||
type UserCodeRes struct {
|
||||
Success bool `json:"success" dc:"是否成功"`
|
||||
}
|
||||
18
api/book/book.go
Normal file
18
api/book/book.go
Normal file
@ -0,0 +1,18 @@
|
||||
// =================================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// =================================================================================
|
||||
|
||||
package book
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"server/api/book/v1"
|
||||
)
|
||||
|
||||
type IBookV1 interface {
|
||||
BookList(ctx context.Context, req *v1.BookListReq) (res *v1.BookListRes, err error)
|
||||
BookAdd(ctx context.Context, req *v1.BookAddReq) (res *v1.BookAddRes, err error)
|
||||
BookEdit(ctx context.Context, req *v1.BookEditReq) (res *v1.BookEditRes, err error)
|
||||
BookDel(ctx context.Context, req *v1.BookDelReq) (res *v1.BookDelRes, err error)
|
||||
}
|
||||
61
api/book/v1/book.go
Normal file
61
api/book/v1/book.go
Normal file
@ -0,0 +1,61 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"server/internal/model"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
type BookListReq struct {
|
||||
g.Meta `path:"/book" tags:"Book" method:"get" summary:"获取小说列表"`
|
||||
Page int `json:"page"`
|
||||
Size int `json:"size"`
|
||||
Title string `json:"title"`
|
||||
CategoryId int64 `json:"categoryId"`
|
||||
AuthorId int64 `json:"authorId"`
|
||||
Status int `json:"status"`
|
||||
IsRecommended int `json:"isRecommended"`
|
||||
}
|
||||
type BookListRes struct {
|
||||
Total int `json:"total"`
|
||||
List []model.Book `json:"list"`
|
||||
}
|
||||
|
||||
type BookAddReq struct {
|
||||
g.Meta `path:"/book" tags:"Book" method:"post" summary:"新增小说"`
|
||||
AuthorId int64 `json:"authorId"`
|
||||
CategoryId int64 `json:"categoryId"`
|
||||
Title string `json:"title"`
|
||||
CoverUrl string `json:"coverUrl"`
|
||||
Description string `json:"description"`
|
||||
Status int `json:"status"`
|
||||
Tags string `json:"tags"`
|
||||
IsRecommended int `json:"isRecommended"`
|
||||
}
|
||||
type BookAddRes struct {
|
||||
Success bool `json:"success"`
|
||||
}
|
||||
|
||||
type BookEditReq struct {
|
||||
g.Meta `path:"/book" tags:"Book" method:"put" summary:"编辑小说"`
|
||||
Id int64 `json:"id"`
|
||||
AuthorId int64 `json:"authorId"`
|
||||
CategoryId int64 `json:"categoryId"`
|
||||
Title string `json:"title"`
|
||||
CoverUrl string `json:"coverUrl"`
|
||||
Description string `json:"description"`
|
||||
Status int `json:"status"`
|
||||
Tags string `json:"tags"`
|
||||
IsRecommended int `json:"isRecommended"`
|
||||
}
|
||||
type BookEditRes struct {
|
||||
Success bool `json:"success"`
|
||||
}
|
||||
|
||||
type BookDelReq struct {
|
||||
g.Meta `path:"/book" tags:"Book" method:"delete" summary:"删除小说"`
|
||||
Id int64 `json:"id"`
|
||||
}
|
||||
type BookDelRes struct {
|
||||
Success bool `json:"success"`
|
||||
}
|
||||
18
api/category/category.go
Normal file
18
api/category/category.go
Normal file
@ -0,0 +1,18 @@
|
||||
// =================================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// =================================================================================
|
||||
|
||||
package category
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"server/api/category/v1"
|
||||
)
|
||||
|
||||
type ICategoryV1 interface {
|
||||
CategoryList(ctx context.Context, req *v1.CategoryListReq) (res *v1.CategoryListRes, err error)
|
||||
CategoryAdd(ctx context.Context, req *v1.CategoryAddReq) (res *v1.CategoryAddRes, err error)
|
||||
CategoryEdit(ctx context.Context, req *v1.CategoryEditReq) (res *v1.CategoryEditRes, err error)
|
||||
CategoryDel(ctx context.Context, req *v1.CategoryDelReq) (res *v1.CategoryDelRes, err error)
|
||||
}
|
||||
46
api/category/v1/category.go
Normal file
46
api/category/v1/category.go
Normal file
@ -0,0 +1,46 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"server/internal/model"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
type CategoryListReq struct {
|
||||
g.Meta `path:"/category" tags:"Category" method:"get" summary:"获取分类列表"`
|
||||
Page int `json:"page" dc:"页码"`
|
||||
Size int `json:"size" dc:"每页数量"`
|
||||
Name string `json:"name" dc:"分类名称(模糊搜索)"`
|
||||
Type int `json:"type" dc:"类型,1男频,2女频"`
|
||||
}
|
||||
type CategoryListRes struct {
|
||||
Total int `json:"total" dc:"总数"`
|
||||
List []model.Category `json:"list" dc:"分类列表"`
|
||||
}
|
||||
|
||||
type CategoryAddReq struct {
|
||||
g.Meta `path:"/category" tags:"Category" method:"post" summary:"新增分类"`
|
||||
Name string `json:"name" dc:"分类名称"`
|
||||
Type int `json:"type" dc:"类型,1男频,2女频"`
|
||||
}
|
||||
type CategoryAddRes struct {
|
||||
Success bool `json:"success" dc:"是否成功"`
|
||||
}
|
||||
|
||||
type CategoryEditReq struct {
|
||||
g.Meta `path:"/category" tags:"Category" method:"put" summary:"编辑分类"`
|
||||
Id int `json:"id" dc:"分类ID"`
|
||||
Name string `json:"name" dc:"分类名称"`
|
||||
Type int `json:"type" dc:"类型,1男频,2女频"`
|
||||
}
|
||||
type CategoryEditRes struct {
|
||||
Success bool `json:"success" dc:"是否成功"`
|
||||
}
|
||||
|
||||
type CategoryDelReq struct {
|
||||
g.Meta `path:"/category" tags:"Category" method:"delete" summary:"删除分类"`
|
||||
Id int `json:"id" dc:"分类ID"`
|
||||
}
|
||||
type CategoryDelRes struct {
|
||||
Success bool `json:"success" dc:"是否成功"`
|
||||
}
|
||||
18
api/chapter/chapter.go
Normal file
18
api/chapter/chapter.go
Normal file
@ -0,0 +1,18 @@
|
||||
// =================================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// =================================================================================
|
||||
|
||||
package chapter
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"server/api/chapter/v1"
|
||||
)
|
||||
|
||||
type IChapterV1 interface {
|
||||
ChapterList(ctx context.Context, req *v1.ChapterListReq) (res *v1.ChapterListRes, err error)
|
||||
ChapterAdd(ctx context.Context, req *v1.ChapterAddReq) (res *v1.ChapterAddRes, err error)
|
||||
ChapterEdit(ctx context.Context, req *v1.ChapterEditReq) (res *v1.ChapterEditRes, err error)
|
||||
ChapterDel(ctx context.Context, req *v1.ChapterDelReq) (res *v1.ChapterDelRes, err error)
|
||||
}
|
||||
57
api/chapter/v1/chapter.go
Normal file
57
api/chapter/v1/chapter.go
Normal file
@ -0,0 +1,57 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"server/internal/model"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
type ChapterListReq struct {
|
||||
g.Meta `path:"/chapter" tags:"Chapter" method:"get" summary:"获取章节列表"`
|
||||
Page int `json:"page" dc:"页码"`
|
||||
Size int `json:"size" dc:"每页数量"`
|
||||
BookId int64 `json:"bookId" dc:"小说ID"`
|
||||
Title string `json:"title" dc:"章节标题(模糊搜索)"`
|
||||
IsLocked int `json:"isLocked" dc:"是否锁定:0免费,1需积分解锁"`
|
||||
}
|
||||
type ChapterListRes struct {
|
||||
Total int `json:"total" dc:"总数"`
|
||||
List []model.Chapter `json:"list" dc:"章节列表"`
|
||||
}
|
||||
|
||||
type ChapterAddReq struct {
|
||||
g.Meta `path:"/chapter" tags:"Chapter" method:"post" summary:"新增章节"`
|
||||
BookId int64 `json:"bookId" dc:"小说ID"`
|
||||
Title string `json:"title" dc:"章节标题"`
|
||||
Content string `json:"content" dc:"章节内容"`
|
||||
WordCount int `json:"wordCount" dc:"章节字数"`
|
||||
Sort int `json:"sort" dc:"排序序号"`
|
||||
IsLocked int `json:"isLocked" dc:"是否锁定:0免费,1需积分解锁"`
|
||||
RequiredScore int `json:"requiredScore" dc:"解锁所需积分"`
|
||||
}
|
||||
type ChapterAddRes struct {
|
||||
Success bool `json:"success" dc:"是否成功"`
|
||||
}
|
||||
|
||||
type ChapterEditReq struct {
|
||||
g.Meta `path:"/chapter" tags:"Chapter" method:"put" summary:"编辑章节"`
|
||||
Id int64 `json:"id" dc:"章节ID"`
|
||||
BookId int64 `json:"bookId" dc:"小说ID"`
|
||||
Title string `json:"title" dc:"章节标题"`
|
||||
Content string `json:"content" dc:"章节内容"`
|
||||
WordCount int `json:"wordCount" dc:"章节字数"`
|
||||
Sort int `json:"sort" dc:"排序序号"`
|
||||
IsLocked int `json:"isLocked" dc:"是否锁定:0免费,1需积分解锁"`
|
||||
RequiredScore int `json:"requiredScore" dc:"解锁所需积分"`
|
||||
}
|
||||
type ChapterEditRes struct {
|
||||
Success bool `json:"success" dc:"是否成功"`
|
||||
}
|
||||
|
||||
type ChapterDelReq struct {
|
||||
g.Meta `path:"/chapter" tags:"Chapter" method:"delete" summary:"删除章节"`
|
||||
Id int64 `json:"id" dc:"章节ID"`
|
||||
}
|
||||
type ChapterDelRes struct {
|
||||
Success bool `json:"success" dc:"是否成功"`
|
||||
}
|
||||
16
api/feedback/feedback.go
Normal file
16
api/feedback/feedback.go
Normal file
@ -0,0 +1,16 @@
|
||||
// =================================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// =================================================================================
|
||||
|
||||
package feedback
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"server/api/feedback/v1"
|
||||
)
|
||||
|
||||
type IFeedbackV1 interface {
|
||||
FeedbackList(ctx context.Context, req *v1.FeedbackListReq) (res *v1.FeedbackListRes, err error)
|
||||
FeedbackAdd(ctx context.Context, req *v1.FeedbackAddReq) (res *v1.FeedbackAddRes, err error)
|
||||
}
|
||||
27
api/feedback/v1/feedback.go
Normal file
27
api/feedback/v1/feedback.go
Normal file
@ -0,0 +1,27 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"server/internal/model"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
type FeedbackListReq struct {
|
||||
g.Meta `path:"/feedback" tags:"Feedback" method:"get" summary:"获取反馈列表"`
|
||||
Page int `json:"page" dc:"页码"`
|
||||
Size int `json:"size" dc:"每页数量"`
|
||||
UserId int64 `json:"userId" dc:"用户ID"`
|
||||
Status int `json:"status" dc:"处理状态:1未处理,2处理中,3已处理"`
|
||||
}
|
||||
type FeedbackListRes struct {
|
||||
Total int `json:"total" dc:"总数"`
|
||||
List []model.Feedback `json:"list" dc:"反馈列表"`
|
||||
}
|
||||
|
||||
type FeedbackAddReq struct {
|
||||
g.Meta `path:"/feedback" tags:"APP/Feedback" method:"post" summary:"新增反馈"`
|
||||
Content string `json:"content" dc:"反馈内容"`
|
||||
}
|
||||
type FeedbackAddRes struct {
|
||||
Success bool `json:"success" dc:"是否成功"`
|
||||
}
|
||||
17
api/user/user.go
Normal file
17
api/user/user.go
Normal file
@ -0,0 +1,17 @@
|
||||
// =================================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// =================================================================================
|
||||
|
||||
package user
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"server/api/user/v1"
|
||||
)
|
||||
|
||||
type IUserV1 interface {
|
||||
UserInfo(ctx context.Context, req *v1.UserInfoReq) (res *v1.UserInfoRes, err error)
|
||||
Delete(ctx context.Context, req *v1.DeleteReq) (res *v1.DeleteRes, err error)
|
||||
Logout(ctx context.Context, req *v1.LogoutReq) (res *v1.LogoutRes, err error)
|
||||
}
|
||||
33
api/user/v1/user.go
Normal file
33
api/user/v1/user.go
Normal file
@ -0,0 +1,33 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
type UserInfoReq struct {
|
||||
g.Meta `path:"/user/info" tags:"APP/User" method:"get" summary:"获取用户信息"`
|
||||
}
|
||||
type UserInfoRes struct {
|
||||
g.Meta `mime:"application/json"`
|
||||
UserId int64 `json:"userId"`
|
||||
Username string `json:"username"` // 用户名
|
||||
Avatar string `json:"avatar"` // 头像 URL
|
||||
Email string `json:"email"` // 邮箱
|
||||
Points uint64 `json:"points"`
|
||||
}
|
||||
|
||||
type DeleteReq struct {
|
||||
g.Meta `path:"/user/delete" tags:"APP/User" method:"post" summary:"删除用户"`
|
||||
Password string `json:"password" v:"required" dc:"密码"`
|
||||
}
|
||||
|
||||
type DeleteRes struct {
|
||||
Success bool `json:"success" dc:"是否成功"`
|
||||
}
|
||||
|
||||
type LogoutReq struct {
|
||||
g.Meta `path:"/user/logout" tags:"APP/User" method:"post" summary:"登出"`
|
||||
}
|
||||
type LogoutRes struct {
|
||||
Success bool `json:"success" dc:"是否成功"`
|
||||
}
|
||||
Reference in New Issue
Block a user