123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- package logic
- import (
- "context"
- "encoding/json"
- "bp.jydev.jianyu360.cn/BaseService/jyMicroservices/jyBXSubscribe/rpc/type/bxsubscribe"
- "bp.jydev.jianyu360.cn/BaseService/jyMicroservices/jyBXSubscribe/api/internal/svc"
- "bp.jydev.jianyu360.cn/BaseService/jyMicroservices/jyBXSubscribe/api/internal/types"
- "github.com/zeromicro/go-zero/core/logx"
- )
- type GetStaffSubscribeDetailLogic struct {
- logx.Logger
- ctx context.Context
- svcCtx *svc.ServiceContext
- }
- func NewGetStaffSubscribeDetailLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetStaffSubscribeDetailLogic {
- return &GetStaffSubscribeDetailLogic{
- Logger: logx.WithContext(ctx),
- ctx: ctx,
- svcCtx: svcCtx,
- }
- }
- func (l *GetStaffSubscribeDetailLogic) GetStaffSubscribeDetail(req *types.GetStaffSubscribeDetailReq) (resp *types.StaffSubscribeCommonResp, err error) {
- res, err := l.svcCtx.Suscribe.GetStaffSubscribeDetail(l.ctx, &bxsubscribe.StaffSubscribeDetailReq{
- EntId: req.EntId,
- EntUserId: req.EntUserId,
- Token: req.Token,
- })
- if err != nil {
- return nil, err
- }
- if res.ErrCode != 0 {
- return &types.StaffSubscribeCommonResp{
- Err_code: res.ErrCode,
- Err_msg: res.ErrMsg,
- Data: nil,
- }, nil
- }
- subscribeDetail := map[string]interface{}{}
- if err := json.Unmarshal(res.Data, &subscribeDetail); err != nil {
- return &types.StaffSubscribeCommonResp{
- Err_code: res.ErrCode,
- Err_msg: "返回异常",
- Data: nil,
- }, nil
- }
- return &types.StaffSubscribeCommonResp{
- Err_code: res.ErrCode,
- Err_msg: res.ErrMsg,
- Data: subscribeDetail,
- }, nil
- }
|