更新代码
This commit is contained in:
@@ -311,35 +311,12 @@ func (c *BackendSiteSettingsController) resolveBackendTenantID(claims *jwtutil.C
|
||||
return tid
|
||||
}
|
||||
|
||||
func (c *BackendSiteSettingsController) ensureBackendSettingItemsTable() error {
|
||||
_, err := models.Orm.Raw(`
|
||||
CREATE TABLE IF NOT EXISTS yz_system_tenant_setting_items (
|
||||
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
tid BIGINT UNSIGNED NOT NULL DEFAULT 0,
|
||||
setting_key VARCHAR(64) NOT NULL DEFAULT '',
|
||||
setting_value LONGTEXT NULL,
|
||||
create_time DATETIME NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
update_time DATETIME NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
delete_time DATETIME NULL DEFAULT NULL,
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE KEY uk_tid_key (tid, setting_key),
|
||||
KEY idx_tid (tid),
|
||||
KEY idx_delete_time (delete_time)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='租户站点扩展设置';
|
||||
`).Exec()
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *BackendSiteSettingsController) getBackendSettingItems(tid uint64, keys []string) (map[string]string, error) {
|
||||
out := make(map[string]string, len(keys))
|
||||
for _, key := range keys {
|
||||
out[key] = ""
|
||||
}
|
||||
|
||||
if err := c.ensureBackendSettingItemsTable(); err != nil {
|
||||
return out, err
|
||||
}
|
||||
|
||||
type rowItem struct {
|
||||
SettingKey string
|
||||
SettingValue string
|
||||
@@ -360,9 +337,6 @@ func (c *BackendSiteSettingsController) getBackendSettingItems(tid uint64, keys
|
||||
}
|
||||
|
||||
func (c *BackendSiteSettingsController) saveBackendSettingItems(tid uint64, values map[string]string) error {
|
||||
if err := c.ensureBackendSettingItemsTable(); err != nil {
|
||||
return err
|
||||
}
|
||||
for key, value := range values {
|
||||
_, err := models.Orm.Raw(`
|
||||
INSERT INTO yz_system_tenant_setting_items (tid, setting_key, setting_value, create_time, update_time)
|
||||
|
||||
Reference in New Issue
Block a user