package logic import ( "app.yhyue.com/moapp/jyResourcesCenter/service" "context" "app.yhyue.com/moapp/jyResourcesCenter/rpc/internal/svc" "app.yhyue.com/moapp/jyResourcesCenter/rpc/resourcesCenter" "github.com/tal-tech/go-zero/core/logx" ) type PurchaseUserBalanceLogic struct { ctx context.Context svcCtx *svc.ServiceContext logx.Logger } func NewPurchaseUserBalanceLogic(ctx context.Context, svcCtx *svc.ServiceContext) *PurchaseUserBalanceLogic { return &PurchaseUserBalanceLogic{ ctx: ctx, svcCtx: svcCtx, Logger: logx.WithContext(ctx), } } var balanceService = service.BalanceService{} // 根据账户标识购买资源 func (l *PurchaseUserBalanceLogic) PurchaseUserBalance(in *resourcesCenter.Resources) (*resourcesCenter.Response, error) { // todo: add your logic here and delete this line balance := &resourcesCenter.Balance{ AccountId: in.AccountId, CompanyId: in.CompanyId, DepartmentId: in.DepartmentId, Name: in.Name, ResourceType: in.ResourceType, Number: in.Number, Spec: in.Spec, AppId: in.AppId, Model: in.Model, EndTime: in.EndTime, } detailed := &resourcesCenter.Detailed{ AccountId: in.AccountId, CompanyId: in.CompanyId, ResourceType: in.AccountId, ExportNum: in.Number, DepartmentId: in.DepartmentId, Name: in.Name, UserType: in.Model, } code, msg := balanceService.PurchaseUserBalance(balance,detailed) return &resourcesCenter.Response{ Code: code, Message: msg, }, nil }