Browse Source

个性化

master
huangjiajun 3 days ago
parent
commit
3e07287a89
2 changed files with 40 additions and 37 deletions
  1. +8
    -37
      app/hdl/institutional_management/module_setting/hdl_basic.go
  2. +32
    -0
      app/md/md_module.go

+ 8
- 37
app/hdl/institutional_management/module_setting/hdl_basic.go View File

@@ -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())


+ 32
- 0
app/md/md_module.go View File

@@ -0,0 +1,32 @@
package md

var Module = map[string]string{
"1": "home_page",
"2": "member_center",
"3": "bottom_bar",
"4": "invitation_download_landing_page",
"5": "invitation_poster",
"6": "about_us",
"7": "down_channel",
"8": "contribution",
"9": "egg_score",
"10": "business_cooperation",
"11": "qualification_certificate",
"12": "withdraw",
"13": "withdraw_account",
}
var ModuleList = []map[string]interface{}{
{"name": "首页", "mod_name": "home_page", "value": "1"},
{"name": "会员中心", "mod_name": "member_center", "value": "2"},
{"name": "底部导航", "mod_name": "bottom_bar", "value": "3"},
{"name": "邀请下载落地页", "mod_name": "invitation_download_landing_page", "value": "4"},
{"name": "邀请海报", "mod_name": "invitation_poster", "value": "5"},
{"name": "关于我们", "mod_name": "about_us", "value": "6"},
{"name": "下载渠道", "mod_name": "down_channel", "value": "7"},
{"name": "贡献值", "mod_name": "contribution", "value": "8"},
{"name": "蛋蛋分", "mod_name": "egg_score", "value": "9"},
{"name": "商务合作", "mod_name": "business_cooperation", "value": "10"},
{"name": "资质证书", "mod_name": "qualification_certificate", "value": "11"},
{"name": "提现页", "mod_name": "withdraw", "value": "12"},
{"name": "提现到账户", "mod_name": "withdraw_account", "value": "13"},
}

Loading…
Cancel
Save