From da154e5c758c3b67202390debdc5331a8f68c685 Mon Sep 17 00:00:00 2001 From: yinbentan <yinbentan@live.com> Date: 星期六, 29 六月 2024 18:25:22 +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