1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- package public
- import (
- "app.yhyue.com/moapp/jybase/encrypt"
- "bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/entity"
- "bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/rpc/medical/medical"
- "context"
- "bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/api/medical/internal/svc"
- "bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/api/medical/internal/types"
- "github.com/zeromicro/go-zero/core/logx"
- )
- type InstitutionUnclaimedLogic struct {
- logx.Logger
- ctx context.Context
- svcCtx *svc.ServiceContext
- }
- func NewInstitutionUnclaimedLogic(ctx context.Context, svcCtx *svc.ServiceContext) *InstitutionUnclaimedLogic {
- return &InstitutionUnclaimedLogic{
- Logger: logx.WithContext(ctx),
- ctx: ctx,
- svcCtx: svcCtx,
- }
- }
- func (l *InstitutionUnclaimedLogic) InstitutionUnclaimed(req *types.ClaimReq) (resp *types.ClaimResp, err error) {
- rs, err := l.svcCtx.Medical.UnClaimed(l.ctx, &medical.ClaimReq{
- UserId: int64(req.UserId),
- EntId: encrypt.SE.DecodeString(req.EntId),
- Type: entity.TypeInstitution,
- AppId: req.AppId,
- })
- if err != nil || rs == nil {
- errMsg := ""
- if err == entity.RepeatErr || err == entity.OperateErr || err == entity.EntNoFoundErr {
- errMsg = err.Error()
- } else {
- errMsg = entity.OperateErr.Error()
- }
- return &types.ClaimResp{
- Error_msg: errMsg,
- Error_code: entity.ERRORCODE,
- ResourceNum: 0,
- ResourceIds: 0,
- }, nil
- }
- return &types.ClaimResp{
- Error_msg: rs.ErrorMsg,
- Error_code: int(rs.ErrorCode),
- ResourceIds: int(rs.ResourceIds),
- ResourceNum: int(rs.ResourceNum),
- }, nil
- }
|