isclaimedlogic.go 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. package public
  2. import (
  3. "app.yhyue.com/moapp/jybase/encrypt"
  4. "bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/entity"
  5. "bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/rpc/medical/medical"
  6. "context"
  7. "bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/api/medical/internal/svc"
  8. "bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/api/medical/internal/types"
  9. "github.com/zeromicro/go-zero/core/logx"
  10. )
  11. type IsClaimedLogic struct {
  12. logx.Logger
  13. ctx context.Context
  14. svcCtx *svc.ServiceContext
  15. }
  16. func NewIsClaimedLogic(ctx context.Context, svcCtx *svc.ServiceContext) *IsClaimedLogic {
  17. return &IsClaimedLogic{
  18. Logger: logx.WithContext(ctx),
  19. ctx: ctx,
  20. svcCtx: svcCtx,
  21. }
  22. }
  23. // IsClaimed 是否认领
  24. func (l *IsClaimedLogic) IsClaimed(req *types.IsClaimedReq) (resp *types.CommonRes, err error) {
  25. // 解密企业id
  26. entID := encrypt.DecodeArticleId2ByCheck(req.CompanyId)[0]
  27. if entID == "" {
  28. return &types.CommonRes{
  29. Error_msg: "参数有误",
  30. Error_code: entity.ERRORCODE,
  31. }, nil
  32. }
  33. rs, _ := l.svcCtx.Medical.IsClaimed(l.ctx, &medical.IsClaimedReq{
  34. UserId: int64(req.UserId),
  35. EntId: entID,
  36. Type: int64(req.Type),
  37. AppId: req.AppId,
  38. })
  39. return &types.CommonRes{
  40. Error_msg: rs.ErrorMsg,
  41. Error_code: int(rs.ErrorCode),
  42. Data: map[string]interface{}{
  43. "status": rs.Data.Status,
  44. },
  45. }, nil
  46. }