| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- package plat
- import (
- "context"
- "dashoo.cn/common_definition/comm_def"
- "github.com/gogf/gf/frame/g"
- "github.com/gogf/gf/util/gvalid"
- model "dashoo.cn/micro/app/model/plat"
- server "dashoo.cn/micro/app/service/plat"
- )
- type TaskCommentHandler struct{}
- // GetList 获取列表
- func (h *TaskCommentHandler) GetList(ctx context.Context, req *model.SearchPlatTaskCommentReq, rsp *comm_def.CommonMsg) error {
- taskCommentService, err := server.NewTaskCommentService(ctx)
- if err != nil {
- g.Log().Error(err)
- return err
- }
- g.Log().Info("搜索值", req)
- total, list, err := taskCommentService.GetList(req)
- if err != nil {
- return err
- }
- rsp.Data = g.Map{"list": list, "total": total}
- return nil
- }
- // Create 添加任务评论
- func (h *TaskCommentHandler) Create(ctx context.Context, req *model.AddPlatTaskCommentReq, rsp *comm_def.CommonMsg) error {
- // 参数校验
- if err := gvalid.CheckStruct(ctx, req, nil); err != nil {
- return err
- }
- taskCommentService, err := server.NewTaskCommentService(ctx)
- if err != nil {
- g.Log().Error(err)
- return err
- }
- err = taskCommentService.Create(req)
- if err != nil {
- g.Log().Error(err)
- return err
- }
- return nil
- }
|