1234567891011121314151617181920212223242526272829 |
- package models
- import (
- "encoding/json"
- "github.com/beego/beego/v2/client/orm"
- "hongze/hongze_robot/utils"
- "time"
- )
- type SmsConfig struct {
- ConfigKey string
- ConfigValue string
- }
- func GetSmsConfigByConfigKey(configKey string) (item *SmsConfig, err error) {
- o := orm.NewOrm()
- sql := `SELECT *
- FROM sms_config AS a
- WHERE config_key=? `
- err = o.Raw(sql, configKey).QueryRow(&item)
- if err == nil && utils.Re == nil {
- body, err := json.Marshal(item)
- if err != nil {
- return item, err
- }
- utils.Rc.Put(utils.CACHE_HZ_SMS_CONFIG+configKey, string(body), 24*time.Hour)
- }
- return
- }
|