From 0fc6fbdc9c932dbba3a038aa4693b2bd808fbc8c Mon Sep 17 00:00:00 2001 From: lifei6671 Date: Mon, 1 May 2017 19:50:29 +0800 Subject: [PATCH] * --- commands/command.go | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/commands/command.go b/commands/command.go index b6799cd4..acd6c933 100644 --- a/commands/command.go +++ b/commands/command.go @@ -52,14 +52,18 @@ func RegisterModel() { func Initialization() { - options := []models.Option { - { OptionName: "ENABLED_CAPTCHA", OptionValue: "false", OptionTitle:"是否启用验证码"}, - { OptionName: "ENABLED_REGISTER",OptionValue:"false",OptionTitle:"是否启用注册"}, - { OptionName: "ENABLE_ANONYMOUS" , OptionValue:"false", OptionTitle:"启用匿名访问"}, - { OptionName: "SITE_NAME", OptionValue:"MinDoc", OptionTitle: "站点名称"}, - } - - models.NewOption().InsertMulti(options...) + (&models.Option{ + OptionName: "ENABLED_CAPTCHA", OptionValue: "false", OptionTitle:"是否启用验证码", + }).InsertOrUpdate() + (&models.Option{ + OptionName: "ENABLED_REGISTER",OptionValue:"false",OptionTitle:"是否启用注册", + }).InsertOrUpdate() + (&models.Option{ + OptionName: "ENABLE_ANONYMOUS" , OptionValue:"false", OptionTitle:"启用匿名访问", + }).InsertOrUpdate() + (&models.Option{ + OptionName: "SITE_NAME", OptionValue:"MinDoc", OptionTitle: "站点名称", + }).InsertOrUpdate() member := models.NewMember() member.Account = "admin"