edbinfo_send_msg_record.go 657 B

1234567891011121314151617181920212223242526
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. type EdbinfoSendMsgRecord struct {
  7. Id int `orm:"column(id);pk"`
  8. UserId int
  9. TradeCode string
  10. CreateTime time.Time
  11. }
  12. func AddEdbinfoSendMsgRecord(item *EdbinfoSendMsgRecord) (err error) {
  13. o := orm.NewOrmUsingDB("rddp")
  14. _, err = o.Insert(item)
  15. return err
  16. }
  17. func GetEdbinfoSendMsgCount(userId int, tradeCode string) (count int, err error) {
  18. o := orm.NewOrmUsingDB("rddp")
  19. sql := `SELECT COUNT(1) AS count FROM edbinfo_send_msg_record WHERE user_id=? AND trade_code=? AND create_time=DATE(NOW()) `
  20. err = o.Raw(sql, userId, tradeCode).QueryRow(&count)
  21. return
  22. }