fix: common去除Impi层
This commit is contained in:
@@ -10,15 +10,14 @@ import (
|
|||||||
|
|
||||||
// 实例化控制层 CommontController 结构体
|
// 实例化控制层 CommontController 结构体
|
||||||
var NewCommont = &CommontController{
|
var NewCommont = &CommontController{
|
||||||
commontService: commonService.NewCommontImpl,
|
commontService: commonService.NewCommont,
|
||||||
}
|
}
|
||||||
|
|
||||||
// 通用请求
|
// 通用请求
|
||||||
//
|
//
|
||||||
// PATH /
|
// PATH /
|
||||||
type CommontController struct {
|
type CommontController struct {
|
||||||
// 通用请求服务
|
commontService *commonService.Commont // 通用请求服务
|
||||||
commontService commonService.ICommont
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 哈希加密
|
// 哈希加密
|
||||||
@@ -36,17 +35,12 @@ func (s *CommontController) I18n(c *gin.Context) {
|
|||||||
|
|
||||||
i18nLang := i18n.TKey(language, "i18n")
|
i18nLang := i18n.TKey(language, "i18n")
|
||||||
hello := i18n.TKey(language, "hello")
|
hello := i18n.TKey(language, "hello")
|
||||||
ivs := i18n.TTemplate(language, "errorFields", nil)
|
errorFields := i18n.TTemplate(language, "dictData.errLabelExists", map[string]any{
|
||||||
errorFields := i18n.TTemplate(language, "errorFields", map[string]any{
|
"name": " ====",
|
||||||
"num": 1000,
|
|
||||||
"hello": "你好",
|
|
||||||
"h2o2": false,
|
|
||||||
"fileName": " ====",
|
|
||||||
})
|
})
|
||||||
c.JSON(200, map[string]any{
|
c.JSON(200, map[string]any{
|
||||||
"lang": language,
|
"lang": language,
|
||||||
"i18nLang": i18nLang,
|
"i18nLang": i18nLang,
|
||||||
"ivs": ivs,
|
|
||||||
"hello": hello,
|
"hello": hello,
|
||||||
"errorFields": errorFields,
|
"errorFields": errorFields,
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,7 +1,81 @@
|
|||||||
package service
|
package service
|
||||||
|
|
||||||
// 通用请求 服务层接口
|
import (
|
||||||
type ICommont interface {
|
"fmt"
|
||||||
// SystemConfigInfo 系统配置信息
|
|
||||||
SystemConfigInfo() map[string]string
|
"be.ems/lib/global"
|
||||||
|
"be.ems/src/framework/config"
|
||||||
|
"be.ems/src/framework/constants/common"
|
||||||
|
"be.ems/src/framework/utils/machine"
|
||||||
|
systemService "be.ems/src/modules/system/service"
|
||||||
|
)
|
||||||
|
|
||||||
|
// 实例化服务层 Commont 结构体
|
||||||
|
var NewCommont = &Commont{
|
||||||
|
sysUserService: systemService.NewSysUserImpl,
|
||||||
|
sysConfigService: systemService.NewSysConfigImpl,
|
||||||
|
}
|
||||||
|
|
||||||
|
// 通用请求 服务层处理
|
||||||
|
type Commont struct {
|
||||||
|
// 用户信息服务
|
||||||
|
sysUserService systemService.ISysUser
|
||||||
|
// 参数配置服务
|
||||||
|
sysConfigService systemService.ISysConfig
|
||||||
|
}
|
||||||
|
|
||||||
|
// SystemConfigInfo 系统配置信息
|
||||||
|
func (s *Commont) SystemConfigInfo() map[string]string {
|
||||||
|
infoMap := map[string]string{}
|
||||||
|
// 获取打包注入的全局变量信息
|
||||||
|
infoMap["version"] = global.Version
|
||||||
|
infoMap["buildTime"] = global.BuildTime
|
||||||
|
// 系统首次使用标记
|
||||||
|
launchInfo := machine.LaunchInfo
|
||||||
|
if launchInfo != nil {
|
||||||
|
if v, ok := launchInfo[common.LAUNCH_BOOTLOADER]; ok {
|
||||||
|
infoMap[common.LAUNCH_BOOTLOADER] = fmt.Sprint(v)
|
||||||
|
} else {
|
||||||
|
infoMap[common.LAUNCH_BOOTLOADER] = "true"
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
infoMap[common.LAUNCH_BOOTLOADER] = "true"
|
||||||
|
}
|
||||||
|
// 用户登录认证
|
||||||
|
infoMap["loginAuth"] = fmt.Sprint(config.Get("user.loginAuth"))
|
||||||
|
// 序列号
|
||||||
|
infoMap["serialNum"] = fmt.Sprint(config.Get("omc.sn"))
|
||||||
|
// 获取LOGO类型
|
||||||
|
logoType := s.sysConfigService.SelectConfigValueByKey("sys.logo.type")
|
||||||
|
infoMap["logoType"] = logoType
|
||||||
|
// 获取LOGO文件
|
||||||
|
filePathIcon := s.sysConfigService.SelectConfigValueByKey("sys.logo.filePathIcon")
|
||||||
|
infoMap["filePathIcon"] = filePathIcon
|
||||||
|
filePathBrand := s.sysConfigService.SelectConfigValueByKey("sys.logo.filePathBrand")
|
||||||
|
infoMap["filePathBrand"] = filePathBrand
|
||||||
|
// 获取系统名称
|
||||||
|
title := s.sysConfigService.SelectConfigValueByKey("sys.title")
|
||||||
|
infoMap["title"] = title
|
||||||
|
// 获取版权声明
|
||||||
|
copyright := s.sysConfigService.SelectConfigValueByKey("sys.copyright")
|
||||||
|
infoMap["copyright"] = copyright
|
||||||
|
// 获取是否开启用户注册功能
|
||||||
|
registerUser := s.sysConfigService.SelectConfigValueByKey("sys.account.registerUser")
|
||||||
|
infoMap["registerUser"] = registerUser
|
||||||
|
// 获取登录界面背景
|
||||||
|
loginBackground := s.sysConfigService.SelectConfigValueByKey("sys.loginBackground")
|
||||||
|
infoMap["loginBackground"] = loginBackground
|
||||||
|
// 系统设置-官网网址
|
||||||
|
officialUrl := s.sysConfigService.SelectConfigValueByKey("sys.officialUrl")
|
||||||
|
infoMap["officialUrl"] = officialUrl
|
||||||
|
// 系统设置-系统使用文档
|
||||||
|
helpDoc := s.sysConfigService.SelectConfigValueByKey("sys.helpDoc")
|
||||||
|
infoMap["helpDoc"] = helpDoc
|
||||||
|
// 国际化切换
|
||||||
|
i18nOpen := s.sysConfigService.SelectConfigValueByKey("sys.i18n.open")
|
||||||
|
infoMap["i18nOpen"] = i18nOpen
|
||||||
|
// 国际化默认语言
|
||||||
|
i18nDefault := s.sysConfigService.SelectConfigValueByKey("sys.i18n.default")
|
||||||
|
infoMap["i18nDefault"] = i18nDefault
|
||||||
|
return infoMap
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,81 +0,0 @@
|
|||||||
package service
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
|
|
||||||
"be.ems/lib/global"
|
|
||||||
"be.ems/src/framework/config"
|
|
||||||
"be.ems/src/framework/constants/common"
|
|
||||||
"be.ems/src/framework/utils/machine"
|
|
||||||
systemService "be.ems/src/modules/system/service"
|
|
||||||
)
|
|
||||||
|
|
||||||
// 实例化服务层 CommontImpl 结构体
|
|
||||||
var NewCommontImpl = &CommontImpl{
|
|
||||||
sysUserService: systemService.NewSysUserImpl,
|
|
||||||
sysConfigService: systemService.NewSysConfigImpl,
|
|
||||||
}
|
|
||||||
|
|
||||||
// 通用请求 服务层处理
|
|
||||||
type CommontImpl struct {
|
|
||||||
// 用户信息服务
|
|
||||||
sysUserService systemService.ISysUser
|
|
||||||
// 参数配置服务
|
|
||||||
sysConfigService systemService.ISysConfig
|
|
||||||
}
|
|
||||||
|
|
||||||
// SystemConfigInfo 系统配置信息
|
|
||||||
func (s *CommontImpl) SystemConfigInfo() map[string]string {
|
|
||||||
infoMap := map[string]string{}
|
|
||||||
// 获取打包注入的全局变量信息
|
|
||||||
infoMap["version"] = global.Version
|
|
||||||
infoMap["buildTime"] = global.BuildTime
|
|
||||||
// 系统首次使用标记
|
|
||||||
launchInfo := machine.LaunchInfo
|
|
||||||
if launchInfo != nil {
|
|
||||||
if v, ok := launchInfo[common.LAUNCH_BOOTLOADER]; ok {
|
|
||||||
infoMap[common.LAUNCH_BOOTLOADER] = fmt.Sprint(v)
|
|
||||||
} else {
|
|
||||||
infoMap[common.LAUNCH_BOOTLOADER] = "true"
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
infoMap[common.LAUNCH_BOOTLOADER] = "true"
|
|
||||||
}
|
|
||||||
// 用户登录认证
|
|
||||||
infoMap["loginAuth"] = fmt.Sprint(config.Get("user.loginAuth"))
|
|
||||||
// 序列号
|
|
||||||
infoMap["serialNum"] = fmt.Sprint(config.Get("omc.sn"))
|
|
||||||
// 获取LOGO类型
|
|
||||||
logoType := s.sysConfigService.SelectConfigValueByKey("sys.logo.type")
|
|
||||||
infoMap["logoType"] = logoType
|
|
||||||
// 获取LOGO文件
|
|
||||||
filePathIcon := s.sysConfigService.SelectConfigValueByKey("sys.logo.filePathIcon")
|
|
||||||
infoMap["filePathIcon"] = filePathIcon
|
|
||||||
filePathBrand := s.sysConfigService.SelectConfigValueByKey("sys.logo.filePathBrand")
|
|
||||||
infoMap["filePathBrand"] = filePathBrand
|
|
||||||
// 获取系统名称
|
|
||||||
title := s.sysConfigService.SelectConfigValueByKey("sys.title")
|
|
||||||
infoMap["title"] = title
|
|
||||||
// 获取版权声明
|
|
||||||
copyright := s.sysConfigService.SelectConfigValueByKey("sys.copyright")
|
|
||||||
infoMap["copyright"] = copyright
|
|
||||||
// 获取是否开启用户注册功能
|
|
||||||
registerUser := s.sysConfigService.SelectConfigValueByKey("sys.account.registerUser")
|
|
||||||
infoMap["registerUser"] = registerUser
|
|
||||||
// 获取登录界面背景
|
|
||||||
loginBackground := s.sysConfigService.SelectConfigValueByKey("sys.loginBackground")
|
|
||||||
infoMap["loginBackground"] = loginBackground
|
|
||||||
// 系统设置-官网网址
|
|
||||||
officialUrl := s.sysConfigService.SelectConfigValueByKey("sys.officialUrl")
|
|
||||||
infoMap["officialUrl"] = officialUrl
|
|
||||||
// 系统设置-系统使用文档
|
|
||||||
helpDoc := s.sysConfigService.SelectConfigValueByKey("sys.helpDoc")
|
|
||||||
infoMap["helpDoc"] = helpDoc
|
|
||||||
// 国际化切换
|
|
||||||
i18nOpen := s.sysConfigService.SelectConfigValueByKey("sys.i18n.open")
|
|
||||||
infoMap["i18nOpen"] = i18nOpen
|
|
||||||
// 国际化默认语言
|
|
||||||
i18nDefault := s.sysConfigService.SelectConfigValueByKey("sys.i18n.default")
|
|
||||||
infoMap["i18nDefault"] = i18nDefault
|
|
||||||
return infoMap
|
|
||||||
}
|
|
||||||
@@ -28,10 +28,10 @@ func GetCDRConnectByIMS(requestID string, data any) ([]byte, error) {
|
|||||||
}
|
}
|
||||||
query.RmUID = neInfo.RmUID
|
query.RmUID = neInfo.RmUID
|
||||||
|
|
||||||
dataMap := neDataService.NewCDREventIMS.SelectPage(query)
|
rows, total := neDataService.NewCDREventIMS.SelectPage(query)
|
||||||
resultByte, err := json.Marshal(result.Ok(map[string]any{
|
resultByte, err := json.Marshal(result.Ok(map[string]any{
|
||||||
"requestId": requestID,
|
"requestId": requestID,
|
||||||
"data": dataMap,
|
"data": map[string]any{"rows": rows, "total": total},
|
||||||
}))
|
}))
|
||||||
return resultByte, err
|
return resultByte, err
|
||||||
}
|
}
|
||||||
@@ -53,10 +53,10 @@ func GetCDRConnectBySMF(requestID string, data any) ([]byte, error) {
|
|||||||
}
|
}
|
||||||
query.RmUID = neInfo.RmUID
|
query.RmUID = neInfo.RmUID
|
||||||
|
|
||||||
dataMap := neDataService.NewCDREventSMF.SelectPage(query)
|
rows, total := neDataService.NewCDREventSMF.SelectPage(query)
|
||||||
resultByte, err := json.Marshal(result.Ok(map[string]any{
|
resultByte, err := json.Marshal(result.Ok(map[string]any{
|
||||||
"requestId": requestID,
|
"requestId": requestID,
|
||||||
"data": dataMap,
|
"data": map[string]any{"rows": rows, "total": total},
|
||||||
}))
|
}))
|
||||||
return resultByte, err
|
return resultByte, err
|
||||||
}
|
}
|
||||||
@@ -78,10 +78,10 @@ func GetCDRConnectBySMSC(requestID string, data any) ([]byte, error) {
|
|||||||
}
|
}
|
||||||
query.RmUID = neInfo.RmUID
|
query.RmUID = neInfo.RmUID
|
||||||
|
|
||||||
dataMap := neDataService.NewCDREventSMSC.SelectPage(query)
|
rows, total := neDataService.NewCDREventSMSC.SelectPage(query)
|
||||||
resultByte, err := json.Marshal(result.Ok(map[string]any{
|
resultByte, err := json.Marshal(result.Ok(map[string]any{
|
||||||
"requestId": requestID,
|
"requestId": requestID,
|
||||||
"data": dataMap,
|
"data": map[string]any{"rows": rows, "total": total},
|
||||||
}))
|
}))
|
||||||
return resultByte, err
|
return resultByte, err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user