1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- package public
- import (
- "app.yhyue.com/moapp/jybase/common"
- "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 UnclaimedLogic struct {
- logx.Logger
- ctx context.Context
- svcCtx *svc.ServiceContext
- }
- func NewUnclaimedLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UnclaimedLogic {
- return &UnclaimedLogic{
- Logger: logx.WithContext(ctx),
- ctx: ctx,
- svcCtx: svcCtx,
- }
- }
- // Unclaimed 取消认领
- func (l *UnclaimedLogic) Unclaimed(req *types.UnclaimedReq) (resp *types.ClaimResp, err error) {
- rs, err := l.svcCtx.Medical.UnClaimed(l.ctx, &medical.UnclaimedReq{
- UserId: int64(req.UserId),
- Id: common.Int64All(encrypt.SE.DecodeString(req.Id)),
- })
- if err != nil || rs == nil {
- return &types.ClaimResp{
- Error_msg: "操作失败",
- 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
- }
|