getnewmsglogic.go 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. package logic
  2. import (
  3. "context"
  4. "fmt"
  5. "bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/entity"
  6. "bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/rpc/medical/internal/svc"
  7. "bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/rpc/medical/medical"
  8. "bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/service"
  9. "github.com/zeromicro/go-zero/core/logx"
  10. )
  11. type GetNewMsgLogic struct {
  12. ctx context.Context
  13. svcCtx *svc.ServiceContext
  14. logx.Logger
  15. }
  16. func NewGetNewMsgLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetNewMsgLogic {
  17. return &GetNewMsgLogic{
  18. ctx: ctx,
  19. svcCtx: svcCtx,
  20. Logger: logx.WithContext(ctx),
  21. }
  22. }
  23. // 招标动态
  24. func (l *GetNewMsgLogic) GetNewMsg(in *medical.GetNewMsgReq) (*medical.GetNewMsgResp, error) {
  25. resp := &medical.GetNewMsgResp{}
  26. portrait := service.NewPortrait(&entity.Conn{
  27. Mysql: entity.Mysql,
  28. BaseMysql: entity.BaseMysql,
  29. CommonMysql: entity.CommonMysql,
  30. })
  31. info, count, err := portrait.List(in.CompanyName, in.PageSize, in.PageNum)
  32. if err != nil || info == nil {
  33. l.Error(fmt.Sprintf("%+v", in), err.Error())
  34. resp.ErrorMsg = err.Error()
  35. resp.ErrorCode = -1
  36. } else {
  37. resp.Count = count
  38. for _, v := range *info {
  39. resp.List = append(resp.List, &medical.NewMsgList{
  40. Area: v.Area,
  41. Bidstatus: v.Bidstatus,
  42. Firsttime: v.Firsttime,
  43. Id: v.Id,
  44. Title: v.Title,
  45. })
  46. }
  47. }
  48. return resp, nil
  49. }