1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- package models
- import (
- "rdluck_tools/orm"
- "time"
- )
- type SmsRecord struct {
- Id int `orm:"column(id);pk"`
- Body string
- Mobile string
- SmsDate string
- IsSend int
- CreateTime time.Time
- ModifyTime time.Time
- SmsDateTime time.Time
- }
- //新增视频
- func AddSmsRecord(item *SmsRecord) (newId int64, err error) {
- o := orm.NewOrm()
- newId, err = o.Insert(item)
- return
- }
- func GetSmsRecordCount(mobile, smsDate string) (count int, err error) {
- o := orm.NewOrm()
- sql := `SELECT COUNT(1) AS count
- FROM sms_record AS a
- WHERE mobile=? AND sms_date=? `
- err = o.Raw(sql, mobile, smsDate).QueryRow(&count)
- return
- }
- func ModifySmsRecordIsSend(mobile, smsDate string) (err error) {
- o := orm.NewOrm()
- sql := `UPDATE sms_record SET is_send=1,modify_time=NOW() WHERE mobile=? AND sms_date=? `
- _, err = o.Raw(sql, mobile, smsDate).Exec()
- return
- }
- func GetSmsRecord() (items []*SmsRecord, err error) {
- o := orm.NewOrm()
- sql := `SELECT * FROM sms_record WHERE is_send=0 `
- _, err = o.Raw(sql).QueryRows(&items)
- return
- }
|