1234567891011121314151617181920212223242526 |
- package models
- import (
- "github.com/beego/beego/v2/client/orm"
- "time"
- )
- type EdbinfoSendMsgRecord struct {
- Id int `orm:"column(id);pk"`
- UserId int
- TradeCode string
- CreateTime time.Time
- }
- func AddEdbinfoSendMsgRecord(item *EdbinfoSendMsgRecord) (err error) {
- o := orm.NewOrmUsingDB("rddp")
- _, err = o.Insert(item)
- return err
- }
- func GetEdbinfoSendMsgCount(userId int, tradeCode string) (count int, err error) {
- o := orm.NewOrmUsingDB("rddp")
- sql := `SELECT COUNT(1) AS count FROM edbinfo_send_msg_record WHERE user_id=? AND trade_code=? AND create_time=DATE(NOW()) `
- err = o.Raw(sql, userId, tradeCode).QueryRow(&count)
- return
- }
|