1 Star 0 Fork 0

BOBO/创想空间服务逻辑库

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
common_new.go 1.40 KB
一键复制 编辑 原始数据 按行查看 历史
zhouyp 提交于 2024-06-21 17:51 . 初始化代码
package common
import (
"context"
"gitee.com/bobo-rs/creative-services/maps"
"github.com/gogf/gf/v2/errors/gerror"
)
type (
CommonStringInterfaceMap map[string]interface{}
)
func New() *sCommon {
return &sCommon{}
}
// CommonMaps 公共map列表
func (c *sCommon) CommonMaps(ctx context.Context, mapKey ...string) (map[string]interface{}, error) {
// map列表
mapList := CommonStringInterfaceMap{
`attachment`: CommonStringInterfaceMap{},
`common`: CommonStringInterfaceMap{
`channel_id`: maps.ChannelId,
`vip_type`: maps.VipType,
`language`: maps.Language,
},
`user`: CommonStringInterfaceMap{
`status`: maps.UserStatus,
`credential_type`: maps.UserCredentialType,
`credential_expire_type`: maps.UserCredentialExpireType,
`device_disabled`: maps.UserDeviceDisabled,
`login_status`: maps.UserLoginStatus,
`login_is_use`: maps.UserLoginIsUse,
`login_is_new_device`: maps.UserLoginIsNewDevice,
},
`sms_template`: CommonStringInterfaceMap{
`status`: maps.SmsTemplateStatus,
`sms_type`: maps.SmsTemplateSmsType,
`var_alias`: maps.SmsTemplateVarAlias,
},
}
// 是否指定MAP
if len(mapKey) > 0 && len(mapKey[0]) > 0 {
if _, ok := mapList[mapKey[0]]; !ok {
return nil, gerror.New(`Map标签不存在`)
}
return mapList[mapKey[0]].(CommonStringInterfaceMap), nil
}
// 返回所有
return mapList, nil
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/bobo-rs/creative-services.git
git@gitee.com:bobo-rs/creative-services.git
bobo-rs
creative-services
创想空间服务逻辑库
v1.0.7

搜索帮助