43 lines
1.1 KiB
Go
43 lines
1.1 KiB
Go
package controller
|
|
|
|
import (
|
|
"context"
|
|
"rag/model/dto"
|
|
"rag/service"
|
|
|
|
"gitea.com/red-future/common/beans"
|
|
"github.com/gogf/gf/v2/frame/g"
|
|
)
|
|
|
|
type keyword struct{}
|
|
|
|
var Keyword = new(keyword)
|
|
|
|
func (c *keyword) Create(ctx context.Context, req *dto.CreateKeywordReq) (res *dto.CreateKeywordRes, err error) {
|
|
res, err = service.Keyword.Create(ctx, req)
|
|
return
|
|
}
|
|
|
|
func (c *keyword) Update(ctx context.Context, req *dto.UpdateKeywordReq) (res *beans.ResponseEmpty, err error) {
|
|
err = service.Keyword.Update(ctx, req)
|
|
return
|
|
}
|
|
|
|
func (c *keyword) Delete(ctx context.Context, req *dto.DeleteKeywordReq) (res *beans.ResponseEmpty, err error) {
|
|
err = service.Keyword.Delete(ctx, req)
|
|
return
|
|
}
|
|
|
|
func (c *keyword) Get(ctx context.Context, req *dto.GetKeywordReq) (res *dto.KeywordVO, err error) {
|
|
res, err = service.Keyword.Get(ctx, req)
|
|
return
|
|
}
|
|
|
|
func (c *keyword) List(ctx context.Context, req *dto.ListKeywordReq) (res *dto.ListKeywordRes, err error) {
|
|
if !g.IsEmpty(req.Page) {
|
|
req.Page = &beans.Page{PageNum: 1, PageSize: 20}
|
|
}
|
|
res, err = service.Keyword.List(ctx, req)
|
|
return
|
|
}
|