package logic import ( "context" "app.yhyue.com/moapp/jyResourcesCenter/rpc/internal/config" "app.yhyue.com/moapp/jyResourcesCenter/service" "app.yhyue.com/moapp/jyResourcesCenter/rpc/internal/svc" "app.yhyue.com/moapp/jyResourcesCenter/rpc/resourcesCenter" "github.com/zeromicro/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, VipTime: in.VipTime, } detailed := &resourcesCenter.Detailed{ AccountId: in.AccountId, CompanyId: in.CompanyId, Number: in.Number, ResourceType: in.ResourceType, DepartmentId: in.DepartmentId, Name: in.Name, UserType: in.Model, Remarks: in.Remarks, } code, msg := balanceService.PurchaseUserBalance(balance, detailed, config.ConfigJson.ProductMap, in.EntId, in.EntUserId) return &resourcesCenter.Response{ Code: code, Message: msg, }, nil }