useuserdetailedlogic.go 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. package logic
  2. import (
  3. "app.yhyue.com/moapp/jyResourcesCenter/rpc/internal/config"
  4. "context"
  5. "app.yhyue.com/moapp/jyResourcesCenter/rpc/internal/svc"
  6. "app.yhyue.com/moapp/jyResourcesCenter/rpc/resourcesCenter"
  7. "github.com/tal-tech/go-zero/core/logx"
  8. )
  9. type UseUserDetailedLogic struct {
  10. ctx context.Context
  11. svcCtx *svc.ServiceContext
  12. logx.Logger
  13. }
  14. func NewUseUserDetailedLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UseUserDetailedLogic {
  15. return &UseUserDetailedLogic{
  16. ctx: ctx,
  17. svcCtx: svcCtx,
  18. Logger: logx.WithContext(ctx),
  19. }
  20. }
  21. // 根据账户标识使用资源
  22. func (l *UseUserDetailedLogic) UseUserDetailed(in *resourcesCenter.Resources) (*resourcesCenter.Response, error) {
  23. // todo: add your logic here and delete this line
  24. balance := &resourcesCenter.Balance{
  25. AccountId: in.AccountId,
  26. CompanyId: in.CompanyId,
  27. DepartmentId: in.DepartmentId,
  28. Name: in.Name,
  29. ResourceType: in.ResourceType,
  30. Number: in.Number,
  31. Spec: in.Spec,
  32. AppId: in.AppId,
  33. Model: in.Model,
  34. EndTime: in.EndTime,
  35. }
  36. detailed := &resourcesCenter.Detailed{
  37. AccountId: in.AccountId,
  38. CompanyId: in.CompanyId,
  39. ResourceType: in.AccountId,
  40. ExportNum: in.Number,
  41. DepartmentId: in.DepartmentId,
  42. Name: in.Name,
  43. UserId: in.UserId,
  44. UserType: in.Model,
  45. Remarks: in.Remarks,
  46. RuleId: in.RuleId,
  47. }
  48. code, msg := balanceService.UseUserDetailed(in.DuplicateRemoval, balance, detailed, in.InfoId, config.ConfigJson.DedupUrl)
  49. return &resourcesCenter.Response{
  50. Code: code,
  51. Message: msg,
  52. }, nil
  53. }