surplusdetaillogic.go 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package logic
  2. import (
  3. "context"
  4. "fmt"
  5. "bp.jydev.jianyu360.cn/BaseService/resourceCenter/api/internal/svc"
  6. "bp.jydev.jianyu360.cn/BaseService/resourceCenter/api/internal/types"
  7. . "bp.jydev.jianyu360.cn/BaseService/resourceCenter/public/entity"
  8. . "bp.jydev.jianyu360.cn/BaseService/resourceCenter/public/service"
  9. "github.com/zeromicro/go-zero/core/logx"
  10. )
  11. type SurplusDetailLogic struct {
  12. logx.Logger
  13. ctx context.Context
  14. svcCtx *svc.ServiceContext
  15. }
  16. func NewSurplusDetailLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SurplusDetailLogic {
  17. return &SurplusDetailLogic{
  18. Logger: logx.WithContext(ctx),
  19. ctx: ctx,
  20. svcCtx: svcCtx,
  21. }
  22. }
  23. //资源剩余详情
  24. func (l *SurplusDetailLogic) SurplusDetail(req *types.Req) (resp *types.Reply, err error) {
  25. resp = &types.Reply{}
  26. status, total, surplus, start_time, end_time, err := Surplus(req.AppId, req.Function_code, req.Account_id, req.Ent_account_id, req.Ent_id, req.Ent_user_id)
  27. if err != nil {
  28. resp.Error_msg = err.Error()
  29. l.Error(fmt.Sprintf("%+v", req), err)
  30. }
  31. resp.Error_code = status
  32. resp.Data = &SurplusData{
  33. Total: total,
  34. Surplus: surplus,
  35. Start_time: start_time,
  36. End_time: end_time,
  37. }
  38. return
  39. }