智盟项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

db_master_list_cfg.go 858 B

1 year ago
1 year ago
12345678910111213141516171819202122232425262728293031323334353637
  1. package offical
  2. import (
  3. "applet/app/db"
  4. "applet/app/db/model"
  5. )
  6. func MasterListCfgGetOneData(uid, key string) string {
  7. var cfgList model.MasterListCfg
  8. has, err := db.Db.Where("`k`=? and uid=?", key, uid).Get(&cfgList)
  9. if err != nil {
  10. return ""
  11. }
  12. if has == false {
  13. cfgList = model.MasterListCfg{Uid: uid, K: key}
  14. db.Db.InsertOne(&cfgList)
  15. }
  16. return cfgList.V
  17. }
  18. func MasterListCfgGetKeyAll(key string) *[]model.MasterListCfg {
  19. var cfgList []model.MasterListCfg
  20. err := db.Db.Where("`k`=? ", key).Find(&cfgList)
  21. if err != nil {
  22. return nil
  23. }
  24. return &cfgList
  25. }
  26. func MasterListCfgSave(uid, key, val string) {
  27. var cfgList model.MasterListCfg
  28. has, err := db.Db.Where("`k`=? and uid=?", key, uid).Get(&cfgList)
  29. if err != nil || has == false {
  30. return
  31. }
  32. cfgList.V = val
  33. db.Db.Where("`k`=? and uid=?", key, uid).Update(&cfgList)
  34. return
  35. }