37 lines
760 B
Go
37 lines
760 B
Go
package feedback
|
|
|
|
import (
|
|
"context"
|
|
"github.com/gogf/gf/v2/frame/g"
|
|
"server/internal/model"
|
|
"server/internal/service"
|
|
|
|
"server/api/feedback/v1"
|
|
)
|
|
|
|
func (c *ControllerV1) List(ctx context.Context, req *v1.ListReq) (res *v1.ListRes, err error) {
|
|
|
|
// 获取当前角色
|
|
role := g.RequestFromCtx(ctx).GetCtxVar("role").String()
|
|
|
|
operatorId := g.RequestFromCtx(ctx).GetCtxVar("id").Int64()
|
|
|
|
out, err := service.Feedback().List(ctx, &model.FeedbackIn{
|
|
Page: req.Page,
|
|
Size: req.Size,
|
|
Keyword: req.Title,
|
|
FeedbackType: req.FeedbackType,
|
|
Status: req.Status,
|
|
Role: role,
|
|
OperatorId: operatorId,
|
|
})
|
|
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &v1.ListRes{
|
|
List: out.List,
|
|
Total: out.Total,
|
|
}, nil
|
|
}
|