act_daily_chest.go 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. package service
  2. import (
  3. "crazy-fox-backend-api/model"
  4. "github.com/jmoiron/sqlx/types"
  5. jsoniter "github.com/json-iterator/go"
  6. "github.com/pkg/errors"
  7. )
  8. type actDailyChest struct{}
  9. // 展示数据处理
  10. func (This *actDailyChest) handleActShow(confInfo *model.ActConfInfo) (json types.JSONText, err error) {
  11. var conf model.DailyChestConf
  12. if err = jsoniter.Unmarshal(confInfo.RewardConf, &conf); err != nil {
  13. return nil, errors.Wrap(err, "每日宝箱 配置Json解析失败")
  14. }
  15. if json, err = jsoniter.Marshal(conf); err != nil {
  16. return nil, errors.Wrap(err, "每日宝箱 配置序列化失败")
  17. }
  18. return
  19. }
  20. // 保存数据处理
  21. func (This *actDailyChest) handleActSave(confInfo *model.ActConfInfo) (err error) {
  22. var conf model.DailyChestConf
  23. if err = jsoniter.Unmarshal(confInfo.ActShowConf, &conf); err != nil {
  24. return errors.Wrap(err, "每日宝箱 配置Json解析失败")
  25. }
  26. if confInfo.RewardConf, err = jsoniter.Marshal(conf); err != nil {
  27. return errors.Wrap(err, "每日宝箱 配置序列化失败")
  28. }
  29. return
  30. }
  31. // 分层数据处理
  32. func (This *actDailyChest) handleActRewardSection(*model.ActConfInfo, ...map[string]any) error {
  33. return nil
  34. }
  35. // 导入数据处理
  36. func (This *actDailyChest) handleActImport(*model.ActDetailInfo, [][][]string) (types.JSONText, error) {
  37. return nil, errors.New("暂不支持此活动类型导入")
  38. }