Files
novel_server/internal/controller/author/author_v1_apply.go

24 lines
580 B
Go

package author
import (
"context"
"github.com/gogf/gf/v2/frame/g"
"server/internal/model"
"server/internal/service"
"server/api/author/v1"
)
func (c *ControllerV1) Apply(ctx context.Context, req *v1.ApplyReq) (res *v1.ApplyRes, err error) {
userId := g.RequestFromCtx(ctx).GetCtxVar("id").Int64()
out, err := service.Author().Apply(ctx, &model.AuthorApplyIn{
UserId: userId,
PenName: req.PenName,
Bio: req.Bio,
})
if err != nil {
return nil, err
}
return &v1.ApplyRes{Success: out.Success, Msg: "Please wait patiently for the management review"}, nil
}