完善功能
This commit is contained in:
21
api/author/author.go
Normal file
21
api/author/author.go
Normal file
@ -0,0 +1,21 @@
|
||||
// =================================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// =================================================================================
|
||||
|
||||
package author
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"server/api/author/v1"
|
||||
)
|
||||
|
||||
type IAuthorV1 interface {
|
||||
List(ctx context.Context, req *v1.ListReq) (res *v1.ListRes, err error)
|
||||
Add(ctx context.Context, req *v1.AddReq) (res *v1.AddRes, err error)
|
||||
Edit(ctx context.Context, req *v1.EditReq) (res *v1.EditRes, err error)
|
||||
Del(ctx context.Context, req *v1.DelReq) (res *v1.DelRes, err error)
|
||||
Follow(ctx context.Context, req *v1.FollowReq) (res *v1.FollowRes, err error)
|
||||
Unfollow(ctx context.Context, req *v1.UnfollowReq) (res *v1.UnfollowRes, err error)
|
||||
Detail(ctx context.Context, req *v1.DetailReq) (res *v1.DetailRes, err error)
|
||||
}
|
||||
75
api/author/v1/author.go
Normal file
75
api/author/v1/author.go
Normal file
@ -0,0 +1,75 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"server/internal/model"
|
||||
)
|
||||
|
||||
type ListReq struct {
|
||||
g.Meta `path:"/author" tags:"Backend/Admin" method:"get" summary:"获取作者列表"`
|
||||
Page int `json:"page" dc:"页码"`
|
||||
Size int `json:"size" dc:"每页数量"`
|
||||
PenName string `json:"penName" dc:"笔名(模糊搜索)"`
|
||||
Status int `json:"status" dc:"状态:1正常,2禁用"`
|
||||
}
|
||||
type ListRes struct {
|
||||
Total int `json:"total" dc:"总数"`
|
||||
List interface{} `json:"list" dc:"作者列表"`
|
||||
}
|
||||
|
||||
type AddReq struct {
|
||||
g.Meta `path:"/author" tags:"Backend/Admin" method:"post" summary:"新增作者"`
|
||||
UserId int64 `json:"userId" dc:"用户ID" v:"required"`
|
||||
PenName string `json:"penName" dc:"笔名" v:"required"`
|
||||
Bio string `json:"bio" dc:"作者简介"`
|
||||
Status int `json:"status" dc:"状态:1正常,2禁用"`
|
||||
}
|
||||
type AddRes struct {
|
||||
Success bool `json:"success" dc:"是否成功"`
|
||||
}
|
||||
|
||||
type EditReq struct {
|
||||
g.Meta `path:"/author" tags:"Backend/Admin" method:"put" summary:"编辑作者"`
|
||||
Id int64 `json:"id" dc:"作者ID" v:"required"`
|
||||
PenName string `json:"penName" dc:"笔名" v:"required"`
|
||||
Bio string `json:"bio" dc:"作者简介"`
|
||||
Status int `json:"status" dc:"状态:1正常,2禁用"`
|
||||
}
|
||||
type EditRes struct {
|
||||
Success bool `json:"success" dc:"是否成功"`
|
||||
}
|
||||
|
||||
type DelReq struct {
|
||||
g.Meta `path:"/author" tags:"Backend/Admin" method:"delete" summary:"删除作者"`
|
||||
Id int64 `json:"id" dc:"作者ID" v:"required"`
|
||||
}
|
||||
type DelRes struct {
|
||||
Success bool `json:"success" dc:"是否成功"`
|
||||
}
|
||||
|
||||
// 关注作者
|
||||
// =============================
|
||||
type FollowReq struct {
|
||||
g.Meta `path:"/author/follow" tags:"APP" method:"post" summary:"关注作者"`
|
||||
AuthorId int64 `json:"authorId" dc:"作者ID" v:"required"`
|
||||
}
|
||||
type FollowRes struct {
|
||||
Success bool `json:"success" dc:"是否成功"`
|
||||
}
|
||||
|
||||
// 取消关注作者
|
||||
// =============================
|
||||
type UnfollowReq struct {
|
||||
g.Meta `path:"/author/unfollow" tags:"APP" method:"post" summary:"取消关注作者"`
|
||||
AuthorId int64 `json:"authorId" dc:"作者ID" v:"required"`
|
||||
}
|
||||
type UnfollowRes struct {
|
||||
Success bool `json:"success" dc:"是否成功"`
|
||||
}
|
||||
type DetailReq struct {
|
||||
g.Meta `path:"/author/detail" tags:"APP" method:"get" summary:"作者详情"`
|
||||
AuthorId int64 `json:"authorId" dc:"作者ID" v:"required"`
|
||||
}
|
||||
type DetailRes struct {
|
||||
Author *model.AuthorDetailOut `json:"author" dc:"作者信息"`
|
||||
}
|
||||
Reference in New Issue
Block a user