mysql.go 549 B

12345678910111213141516171819202122
  1. package anchorReward
  2. import (
  3. "context"
  4. model "go-common/app/service/live/xrewardcenter/model/anchorTask"
  5. "go-common/library/log"
  6. )
  7. // RawRewardConf return reward config from db.
  8. func (d *Dao) RawRewardConf(c context.Context, id int64) (res *model.AnchorRewardConf, err error) {
  9. rewards := []*model.AnchorRewardConf{}
  10. if err := d.orm.Model(&model.AnchorReward{}).Find(&rewards, "id=?", id).Error; err != nil {
  11. log.Error("getRewardById (%v) error(%v)", id, err)
  12. return nil, err
  13. }
  14. if len(rewards) != 0 {
  15. res = rewards[0]
  16. }
  17. return
  18. }