lotteryreceivechecklogic.go 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. package logic
  2. import (
  3. "app.yhyue.com/moapp/jyMarketing/rpc/activity"
  4. "app.yhyue.com/moapp/jyMarketing/util"
  5. "context"
  6. "strconv"
  7. "strings"
  8. "app.yhyue.com/moapp/jyMarketing/api/internal/svc"
  9. "app.yhyue.com/moapp/jyMarketing/api/internal/types"
  10. "github.com/tal-tech/go-zero/core/logx"
  11. )
  12. type LotteryReceiveCheckLogic struct {
  13. logx.Logger
  14. ctx context.Context
  15. svcCtx *svc.ServiceContext
  16. }
  17. func NewLotteryReceiveCheckLogic(ctx context.Context, svcCtx *svc.ServiceContext) LotteryReceiveCheckLogic {
  18. return LotteryReceiveCheckLogic{
  19. Logger: logx.WithContext(ctx),
  20. ctx: ctx,
  21. svcCtx: svcCtx,
  22. }
  23. }
  24. func (l *LotteryReceiveCheckLogic) LotteryReceiveCheck(req types.LotteryOperation) (*types.Response, error) {
  25. result := &types.Response{}
  26. lsi := l.svcCtx.Activity
  27. var arr []int64
  28. lotteryIdArr := strings.Split(req.LotteryIdArr, ",")
  29. for _, value := range lotteryIdArr {
  30. var SE = util.SimpleEncrypt{Key: "topnet2015topnet2015"}
  31. lotteryIdStr:=SE.Decode4Hex(value)
  32. valueInt, _ := strconv.ParseInt(lotteryIdStr, 10, 64)
  33. arr = append(arr, valueInt)
  34. }
  35. resp, err := lsi.LotteryReceive(l.ctx, &activity.LotteryOperation{
  36. UserId: req.UserId,
  37. AppId: req.AppId,
  38. LotteryIdArr: arr,
  39. UserName:req.UserName,
  40. })
  41. if err != nil {
  42. return nil, err
  43. }
  44. result.Code = resp.Code
  45. result.Message = resp.Message
  46. return result, nil
  47. }