12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- package config
- import (
- "bp.jydev.jianyu360.cn/BaseService/powerCheckCenter/rpc/powercheck"
- "bp.jydev.jianyu360.cn/BaseService/resourceCenter/rpc/resource"
- "bp.jydev.jianyu360.cn/BaseService/userCenter/entity"
- "github.com/zeromicro/go-zero/core/conf"
- "github.com/zeromicro/go-zero/core/discov"
- "github.com/zeromicro/go-zero/zrpc"
- )
- func init() {
- conf.MustLoad("etc/usercenter.yaml", &entity.ConfigJson)
- //初始化资源中台相关
- resourceClient := zrpc.MustNewClient(zrpc.RpcClientConf{
- Etcd: discov.EtcdConf{
- Hosts: entity.ConfigJson.ResourceEtcdConf.Etcd.Hosts,
- Key: entity.ConfigJson.ResourceEtcdConf.Etcd.Key,
- },
- })
- entity.ResourceLib = resource.NewResource(resourceClient)
- //初始化权益中台相关
- powersClient := zrpc.MustNewClient(zrpc.RpcClientConf{
- Etcd: discov.EtcdConf{
- Hosts: entity.ConfigJson.PowersEtcdConf.Etcd.Hosts,
- Key: entity.ConfigJson.PowersEtcdConf.Etcd.Key,
- },
- })
- entity.PowerCheck = powercheck.NewPowerCheck(powersClient)
- //菜单表 外网
- if entity.ConfigJson.WorkTableOut == "" {
- entity.ConfigJson.WorkTableOut = "work_menu"
- }
- //菜单表 内网
- if entity.ConfigJson.WorkTableInside == "" {
- entity.ConfigJson.WorkTableInside = "work_menu"
- }
- if len(entity.ConfigJson.PopupIds) > 0 {
- for _, id := range entity.ConfigJson.PopupIds {
- entity.PopupIdMap[id] = true
- }
- }
- }
|