|
|
@@ -44,7 +44,7 @@ func ModuleSettingGet(c *gin.Context) { |
|
|
|
e.OutErr(c, e.ERR_DB_ORM, err.Error()) |
|
|
|
return |
|
|
|
} |
|
|
|
var dataMap map[string]interface{} |
|
|
|
var data interface{} |
|
|
|
if moduleStyle == nil { |
|
|
|
now := time.Now() |
|
|
|
m := model.ModuleStyle{ |
|
|
@@ -53,7 +53,7 @@ func ModuleSettingGet(c *gin.Context) { |
|
|
|
SkipIdentifier: "", |
|
|
|
Title: "主标题", |
|
|
|
Subtitle: "子标题", |
|
|
|
Data: utils.SerializeStr(dataMap), |
|
|
|
Data: utils.SerializeStr(data), |
|
|
|
CreateAt: now.Format("2006-01-02 15:04:05"), |
|
|
|
} |
|
|
|
_, err = moduleStyleDb.ModuleStyleInsert(&m) |
|
|
@@ -72,8 +72,8 @@ func ModuleSettingGet(c *gin.Context) { |
|
|
|
} |
|
|
|
redisConn := cache.GetPool().Get() |
|
|
|
scheme, domain := svc.ImageBucket(db.Db, redisConn) |
|
|
|
moduleStyle.Data = svc.ImageFormatWithBucketNew(scheme, domain, moduleStyle.Data) |
|
|
|
utils.Unserialize([]byte(moduleStyle.Data), &dataMap) |
|
|
|
moduleStyleStr := svc.ImageFormatWithBucketForDataInfo(scheme, domain, moduleStyle.Data) |
|
|
|
utils.Unserialize([]byte(moduleStyleStr), &data) |
|
|
|
|
|
|
|
resp := md.ModuleSettingGetResp{ |
|
|
|
ModNameList: modNameList, |
|
|
@@ -82,7 +82,7 @@ func ModuleSettingGet(c *gin.Context) { |
|
|
|
SkipIdentifier: moduleStyle.SkipIdentifier, |
|
|
|
Title: moduleStyle.Title, |
|
|
|
Subtitle: moduleStyle.Subtitle, |
|
|
|
Data: dataMap, |
|
|
|
Data: data, |
|
|
|
} |
|
|
|
|
|
|
|
e.OutSuc(c, resp, nil) |
|
|
@@ -125,7 +125,7 @@ func ModuleSettingUpdate(c *gin.Context) { |
|
|
|
// 替换所有 host |
|
|
|
redisConn := cache.GetPool().Get() |
|
|
|
scheme, domain := svc.ImageBucket(db.Db, redisConn) |
|
|
|
moduleStyle.Data = strings.ReplaceAll(moduleStyle.Data, fmt.Sprintf("%s://%s/", scheme, domain), "{{host}}") |
|
|
|
moduleStyle.Data = strings.ReplaceAll(moduleStyle.Data, fmt.Sprintf("%s://%s/", scheme, domain), "{{tempHost}}") |
|
|
|
affected, err := moduleStyleDb.ModuleStyleUpdate(moduleStyle.ModId, moduleStyle, forceColumns...) |
|
|
|
if err != nil { |
|
|
|
e.OutErr(c, e.ERR_DB_ORM, err.Error()) |
|
|
|