rechargelogic.go 859 B

123456789101112131415161718192021222324252627282930313233343536
  1. package logic
  2. import (
  3. "context"
  4. "fmt"
  5. . "bp.jydev.jianyu360.cn/BaseService/resourceCenter/public/service"
  6. "bp.jydev.jianyu360.cn/BaseService/resourceCenter/rpc/internal/svc"
  7. "bp.jydev.jianyu360.cn/BaseService/resourceCenter/rpc/pb"
  8. "github.com/zeromicro/go-zero/core/logx"
  9. )
  10. type RechargeLogic struct {
  11. ctx context.Context
  12. svcCtx *svc.ServiceContext
  13. logx.Logger
  14. }
  15. func NewRechargeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *RechargeLogic {
  16. return &RechargeLogic{
  17. ctx: ctx,
  18. svcCtx: svcCtx,
  19. Logger: logx.WithContext(ctx),
  20. }
  21. }
  22. // 资源充值
  23. func (l *RechargeLogic) Recharge(in *pb.RechargeReq) (*pb.Resp, error) {
  24. resp := &pb.Resp{}
  25. status, err := Recharge(in.Appid, in.FunctionCode, in.AccountId, in.Count, in.Ids)
  26. if err != nil {
  27. l.Error(fmt.Sprintf("%+v", in), err)
  28. }
  29. resp.Status = status
  30. return resp, nil
  31. }