getnewmsglistlogic.go 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. package institution
  2. import (
  3. "context"
  4. "fmt"
  5. "bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/rpc/medical/medical"
  6. "bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/api/medical/internal/svc"
  7. "bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/api/medical/internal/types"
  8. "github.com/zeromicro/go-zero/core/logx"
  9. )
  10. type GetNewMsgListLogic struct {
  11. logx.Logger
  12. ctx context.Context
  13. svcCtx *svc.ServiceContext
  14. }
  15. func NewGetNewMsgListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetNewMsgListLogic {
  16. return &GetNewMsgListLogic{
  17. Logger: logx.WithContext(ctx),
  18. ctx: ctx,
  19. svcCtx: svcCtx,
  20. }
  21. }
  22. func (l *GetNewMsgListLogic) GetNewMsgList(req *types.GetNewMsgListReq) (resp *types.CommonRes, err error) {
  23. // todo: add your logic here and delete this line
  24. resp = &types.CommonRes{}
  25. ret, err := l.svcCtx.Medical.GetNewMsg(l.ctx, &medical.GetNewMsgReq{
  26. CompanyName: req.CompanyName,
  27. PageNum: req.PageNum,
  28. PageSize: req.PageSize,
  29. })
  30. if err != nil || ret == nil {
  31. l.Error(fmt.Sprintf("%+v", req), resp.Error_msg)
  32. resp.Error_code, resp.Error_msg = -1, "查看失败"
  33. } else {
  34. resp.Data = map[string]interface{}{
  35. "count": ret.Count,
  36. "list": ret.List,
  37. }
  38. }
  39. return
  40. }