|
|
@@ -3,6 +3,7 @@ package module_setting |
|
|
|
import ( |
|
|
|
"applet/app/db" |
|
|
|
"applet/app/e" |
|
|
|
md2 "applet/app/md" |
|
|
|
"applet/app/md/institutional_management/module_setting" |
|
|
|
"applet/app/utils" |
|
|
|
"applet/app/utils/cache" |
|
|
@@ -10,6 +11,7 @@ import ( |
|
|
|
"code.fnuoos.com/EggPlanet/egg_models.git/src/model" |
|
|
|
"code.fnuoos.com/EggPlanet/egg_system_rules.git/svc" |
|
|
|
"errors" |
|
|
|
"fmt" |
|
|
|
"github.com/gin-gonic/gin" |
|
|
|
"strings" |
|
|
|
"time" |
|
|
@@ -28,35 +30,8 @@ import ( |
|
|
|
// @Router /api/institutionalManagement/moduleSetting/getModuleSetting [GET] |
|
|
|
func ModuleSettingGet(c *gin.Context) { |
|
|
|
modNameValue := c.DefaultQuery("mod_name_value", "1") |
|
|
|
modNameList := []map[string]interface{}{ |
|
|
|
{ |
|
|
|
"mod_name": "home_page", |
|
|
|
"value": "1", |
|
|
|
}, |
|
|
|
{ |
|
|
|
"mod_name": "member_center", |
|
|
|
"value": "2", |
|
|
|
}, |
|
|
|
{ |
|
|
|
"mod_name": "bottom_bar", |
|
|
|
"value": "3", |
|
|
|
}, |
|
|
|
{ |
|
|
|
"mod_name": "invitation_download_landing_page", |
|
|
|
"value": "4", |
|
|
|
}, |
|
|
|
{ |
|
|
|
"mod_name": "invitation_poster", |
|
|
|
"value": "5", |
|
|
|
}, |
|
|
|
} |
|
|
|
modNameMap := map[string]string{ |
|
|
|
"1": "home_page", |
|
|
|
"2": "member_center", |
|
|
|
"3": "bottom_bar", |
|
|
|
"4": "invitation_download_landing_page", |
|
|
|
"5": "invitation_poster", |
|
|
|
} |
|
|
|
modNameList := md2.ModuleList |
|
|
|
modNameMap := md2.Module |
|
|
|
moduleStyleDb := implement.NewModuleStyleDb(db.Db) |
|
|
|
var moduleStyle *model.ModuleStyle |
|
|
|
var err error |
|
|
@@ -131,13 +106,7 @@ func ModuleSettingUpdate(c *gin.Context) { |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
modNameMap := map[string]string{ |
|
|
|
"1": "home_page", |
|
|
|
"2": "member_center", |
|
|
|
"3": "bottom_bar", |
|
|
|
"4": "invitation_download_landing_page", |
|
|
|
"5": "invitation_poster", |
|
|
|
} |
|
|
|
modNameMap := md2.Module |
|
|
|
moduleStyleDb := implement.NewModuleStyleDb(db.Db) |
|
|
|
moduleStyle, err := moduleStyleDb.ModuleStyleGetOneByParams(map[string]interface{}{ |
|
|
|
"key": "mod_name", |
|
|
@@ -154,7 +123,9 @@ func ModuleSettingUpdate(c *gin.Context) { |
|
|
|
moduleStyle.Data = utils.SerializeStr(req.Data) |
|
|
|
|
|
|
|
// 替换所有 host |
|
|
|
moduleStyle.Data = strings.ReplaceAll(moduleStyle.Data, "http", "{{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}}") |
|
|
|
affected, err := moduleStyleDb.ModuleStyleUpdate(moduleStyle.ModId, moduleStyle, forceColumns...) |
|
|
|
if err != nil { |
|
|
|
e.OutErr(c, e.ERR_DB_ORM, err.Error()) |
|
|
|