|
12345678910111213141516171819202122232425262728293031323334353637 |
- package offical
-
- import (
- "applet/app/db"
- "applet/app/db/model"
- )
-
- func MasterListCfgGetOneData(uid, key string) string {
- var cfgList model.MasterListCfg
- has, err := db.Db.Where("`k`=? and uid=?", key, uid).Get(&cfgList)
- if err != nil {
- return ""
- }
- if has == false {
- cfgList = model.MasterListCfg{Uid: uid, K: key}
- db.Db.InsertOne(&cfgList)
- }
- return cfgList.V
- }
- func MasterListCfgGetKeyAll(key string) *[]model.MasterListCfg {
- var cfgList []model.MasterListCfg
- err := db.Db.Where("`k`=? ", key).Find(&cfgList)
- if err != nil {
- return nil
- }
- return &cfgList
- }
- func MasterListCfgSave(uid, key, val string) {
- var cfgList model.MasterListCfg
- has, err := db.Db.Where("`k`=? and uid=?", key, uid).Get(&cfgList)
- if err != nil || has == false {
- return
- }
- cfgList.V = val
- db.Db.Where("`k`=? and uid=?", key, uid).Update(&cfgList)
- return
- }
|