Browse Source

更新

master
huangjiajun 3 months ago
parent
commit
5f689f3a43
1 changed files with 5 additions and 5 deletions
  1. +5
    -5
      app/db/implement/sys_cfg_implement.go

+ 5
- 5
app/db/implement/sys_cfg_implement.go View File

@@ -1,4 +1,4 @@
package implement
package implement

import (
"applet/app/db/dao"
@@ -24,7 +24,7 @@ type SysCfgDb struct {

func (s SysCfgDb) SysCfgGetAll() (*[]model.SysCfg, error) {
var cfgList []model.SysCfg
if err := s.Db.Cols("key,val,memo").Find(&cfgList); err != nil {
if err := s.Db.Cols("k,v,memo").Find(&cfgList); err != nil {
return nil, logx.Error(err)
}
return &cfgList, nil
@@ -32,7 +32,7 @@ func (s SysCfgDb) SysCfgGetAll() (*[]model.SysCfg, error) {

func (s SysCfgDb) SysCfgGetOneNoDataNoErr(key string) (*model.SysCfg, error) {
var cfgList model.SysCfg
has, err := s.Db.Where("`key`=?", key).Get(&cfgList)
has, err := s.Db.Where("`k`=?", key).Get(&cfgList)
if err != nil {
return nil, logx.Error(err)
}
@@ -44,7 +44,7 @@ func (s SysCfgDb) SysCfgGetOneNoDataNoErr(key string) (*model.SysCfg, error) {

func (s SysCfgDb) SysCfgGetOne(key string) (*model.SysCfg, error) {
var cfgList model.SysCfg
if has, err := s.Db.Where("`key`=?", key).Get(&cfgList); err != nil || has == false {
if has, err := s.Db.Where("`k`=?", key).Get(&cfgList); err != nil || has == false {
return nil, logx.Error(err)
}
return &cfgList, nil
@@ -62,7 +62,7 @@ func (s SysCfgDb) SysCfgInsert(key, val, memo string) bool {

func (s SysCfgDb) SysCfgUpdate(key, val string) bool {
cfg := model.SysCfg{K: key, V: val}
_, err := s.Db.Where("`key`=?", key).Cols("val").Update(&cfg)
_, err := s.Db.Where("`k`=?", key).Cols("val").Update(&cfg)
if err != nil {
logx.Error(err)
return false


Loading…
Cancel
Save