28 lines
805 B
Go
28 lines
805 B
Go
package client
|
|
|
|
import (
|
|
"context"
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
"sundynix-micro-go/app/system/api/internal/svc"
|
|
"sundynix-micro-go/app/system/api/internal/types"
|
|
"sundynix-micro-go/app/system/rpc/system"
|
|
)
|
|
|
|
type CreateClientLogic struct {
|
|
logx.Logger
|
|
ctx context.Context
|
|
svcCtx *svc.ServiceContext
|
|
}
|
|
|
|
func NewCreateClientLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateClientLogic {
|
|
return &CreateClientLogic{Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx}
|
|
}
|
|
|
|
func (l *CreateClientLogic) CreateClient(req *types.ClientReq) error {
|
|
_, err := l.svcCtx.SystemRpc.CreateClient(l.ctx, &system.ClientReq{
|
|
ClientId: req.ClientId, Name: req.Name, GrantType: req.GrantType,
|
|
AdditionalInfo: req.AdditionalInfo, ActiveTimeout: req.ActiveTimeout,
|
|
})
|
|
return err
|
|
}
|