sms_record.go 592 B

123456789101112131415161718192021222324252627282930
  1. package models
  2. import (
  3. "rdluck_tools/orm"
  4. "time"
  5. )
  6. type SmsRecord struct {
  7. Id int `orm:"column(id);pk"`
  8. Body string
  9. Mobile string
  10. SmsDate string
  11. CreateTime time.Time
  12. }
  13. //新增视频
  14. func AddSmsRecord(item *SmsRecord) (newId int64, err error) {
  15. o := orm.NewOrm()
  16. newId, err = o.Insert(item)
  17. return
  18. }
  19. func GetSmsRecordCount(mobile, smsDate string) (count int, err error) {
  20. o := orm.NewOrm()
  21. sql := `SELECT COUNT(1) AS count
  22. FROM sms_record AS a
  23. WHERE mobile=? AND sms_date=? `
  24. err = o.Raw(sql, mobile, smsDate).QueryRow(&count)
  25. return
  26. }