From f4508a84236a4aff1c7b5bfa17a14a8ff95728ba Mon Sep 17 00:00:00 2001 From: yinbentan <yinbentan@live.com> Date: 星期一, 08 七月 2024 09:45:10 +0800 Subject: [PATCH] 接口调用报错处理 --- models/system_config.go | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+), 0 deletions(-) diff --git a/models/system_config.go b/models/system_config.go index e36d115..dc07f78 100644 --- a/models/system_config.go +++ b/models/system_config.go @@ -242,3 +242,21 @@ return records, nil } + +// InitDefaultData 鍒濆鍖栨暟鎹� +func (slf *SystemConfigSearch) InitDefaultData() error { + var ( + db = slf.Orm.Table(slf.TableName()) + total int64 = 0 + ) + if err := db.Count(&total).Error; err != nil { + return err + } + if total != 0 { + return nil + } + config := make([]*SystemConfig, 0) + config = append(config, &SystemConfig{ConfigType: constvar.SystemConfigTypeInventoryCutOffPoint, Name: "搴撳瓨缁撶畻鏃堕棿鐐�", Val: "03-02:00"}) + err := slf.CreateBatch(config) + return err +} -- Gitblit v1.8.0