award.go 820 B

12345678910111213141516171819202122
  1. package dao
  2. import (
  3. "context"
  4. "time"
  5. "go-common/library/log"
  6. )
  7. const (
  8. _addAwardRecordMysql = "insert into ap_award_record(uid, gift_name, gift_type, gift_num, source, source_id, create_time, expire_time, status, user_extra_field) values(?,?,?,?,?,?,?,?,?,?)"
  9. )
  10. // AddAward .
  11. func (d *Dao) AddAward(ctx context.Context, uid int64, expireTime string, giftType int64, giftName string, giftNum int64, source string, sourceId int64) bool {
  12. sql := _addAwardRecordMysql
  13. affect, err := d.execSqlWithBindParams(ctx, &sql, uid, giftName, giftType, giftNum, source, sourceId, time.Now().Format("2006-01-02 15:04:05"), expireTime, 0, "")
  14. if err != nil {
  15. log.Error("[dao.mysql_lottery | AddAward] uid(%d) gift_name(%s) gift_type(%s) source(%s) error(%v)", uid, giftName, giftType, source, err)
  16. }
  17. return affect > 0
  18. }