package review import ( "context" "tianyuan-api/apps/user/client/enterprise" "tianyuan-api/apps/admin/internal/svc" "tianyuan-api/apps/admin/internal/types" "github.com/zeromicro/go-zero/core/logx" ) type GetPendingEnterpriseLogic struct { logx.Logger ctx context.Context svcCtx *svc.ServiceContext } func NewGetPendingEnterpriseLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetPendingEnterpriseLogic { return &GetPendingEnterpriseLogic{ Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx, } } func (l *GetPendingEnterpriseLogic) GetPendingEnterprise(req *types.GetPendingEnterpriseReq) (resp *types.GetPendingEnterpriseResp, err error) { pendingEnterpriseList, err := l.svcCtx.EntRpc.GetPendingEnterprise(l.ctx, &enterprise.GetPendingEnterpriseReq{Page: req.Page, PageSize: req.PageSize}) if err != nil { return nil, err } var list []types.EnterpriseItem for _, ent := range pendingEnterpriseList.List { list = append(list, types.EnterpriseItem{ Id: ent.Id, EnterpriseName: ent.EnterpriseName, EnterpriseContact: ent.EnterpriseContact, CreditCode: ent.CreditCode, LegalPerson: ent.LegalPerson, AuthStatus: ent.AuthStatus, BusinessLicense: ent.BusinessLicense, UpdatedAt: ent.UpdatedAt, CreatedAt: ent.CreatedAt, }) } resp = &types.GetPendingEnterpriseResp{ Total: pendingEnterpriseList.Total, List: list, } return resp, nil }