wangchuanjin 2 years ago
parent
commit
2ccd30ff98

+ 1 - 1
src/jfw/config/config.go

@@ -66,5 +66,5 @@ func init() {
 	}
 	ResourceApi.HasPowers = resourceCenter + util.ObjToString(resourceCenterUrl["haspowers"])
 	var ctx = gctx.New()
-	Middleground = middleground.NewMiddleground(g.Cfg().MustGet(ctx, "etcd.hosts").Strings()).RegUserCenter(g.Cfg().MustGet(ctx, "userCenterKey").String())
+	Middleground = middleground.NewMiddleground(g.Cfg().MustGet(ctx, "etcd.hosts").Strings()).RegUserCenter(g.Cfg().MustGet(ctx, "userCenterKey").String()).RegPowerCheckCenter(g.Cfg().MustGet(ctx, "powerCheckCenterKey").String())
 }

+ 1 - 1
src/jfw/modules/app/src/jfw/config/config.go

@@ -39,5 +39,5 @@ func init() {
 		GmailAuth = append(GmailAuth, mailConf)
 	}
 	var ctx = gctx.New()
-	Middleground = middleground.NewMiddleground(g.Cfg().MustGet(ctx, "etcd.hosts").Strings()).RegUserCenter(g.Cfg().MustGet(ctx, "userCenterKey").String()).RegPowerCheckCenter(g.Cfg().MustGet(ctx, "powerCheckKey").String())
+	Middleground = middleground.NewMiddleground(g.Cfg().MustGet(ctx, "etcd.hosts").Strings()).RegUserCenter(g.Cfg().MustGet(ctx, "userCenterKey").String()).RegPowerCheckCenter(g.Cfg().MustGet(ctx, "powerCheckCenterKey").String())
 }

+ 81 - 79
src/jfw/modules/bigmember/src/config/config.go

@@ -1,79 +1,81 @@
 package config
 
 import (
-    qutil "app.yhyue.com/moapp/jybase/common"
-    "app.yhyue.com/moapp/jybase/mail"
-    "app.yhyue.com/moapp/jypkg/common/src/qfw/util/middleGround"
-    "app.yhyue.com/moapp/jypkg/middleground"
-    "github.com/gogf/gf/v2/frame/g"
-    "github.com/gogf/gf/v2/os/gcfg"
-    "github.com/gogf/gf/v2/os/gctx"
+	"log"
+
+	qutil "app.yhyue.com/moapp/jybase/common"
+	"app.yhyue.com/moapp/jybase/mail"
+	"app.yhyue.com/moapp/jypkg/common/src/qfw/util/middleGround"
+	"app.yhyue.com/moapp/jypkg/middleground"
+	"github.com/gogf/gf/v2/frame/g"
+	"github.com/gogf/gf/v2/os/gcfg"
+	"github.com/gogf/gf/v2/os/gctx"
 )
 
 type config struct {
-    WebPort string
-    Mail    []struct {
-        Addr string
-        Port int
-        Pwd  string
-        User string
-    }
-    PortraitPool        int
-    PortraitCacheDay    int
-    PortraitScreenPool  int64
-    RdProLimit          int
-    FollowPushRpc       string
-    FollowEnt           followConfig
-    FollowProject       followConfig
-    AttachmentRPC       string
-    AttachmentMail      string
-    AttachmentMailTitle string
-    ReTry               int
-    Industry            map[string]interface{}
-    KeyMaxLength        int
-    WarnMailbox         []string
-    WarnMbTitle         string
-    TimeSpan            int
-    RegWinner           string
-    OldSubscribeMoveTip int64
-    Customers           []CustomerInfo
-    NewFreeUser         int64          //免费用户 -- 订阅升级新用户
-    FileUploadNum       map[string]int //每月附件下载次数
-    CreatePdfServer     string         //生成pdf文件服务地址
-    PdfServerPoor       int            //生成pdf线程数量控制
-    PdfDataApiWhiteList []string       //pdf数据接口白名单
-    MainWebDomain       string         //附件剑鱼地址
-    marketAnalysisPool  int
-    MarketAnalysisPool  struct {
-        Limit           int `json:"limit"`           //查询并发池
-        TimeOut         int `json:"timeOut"`         //并发池等待超时时长,单位秒
-        ProjectNumLimit int `json:"projectNumLimit"` //自定义报告限制项目个数
-    } `json:"marketAnalysisPool"` //市场分析
-    ForecastTime   int //中标预测结果redis 缓存时间
-    IsAddCacheTime int //isadd 接口数据存储时间 + 120 内随机数
-    IsAddUrls      struct {
-        Free      []string `json:"free"`
-        Vip       []string `json:"vip"`
-        BigMember []string `json:"bigMember"`
-        EntNiche  []string `json:"entNiche"`
-    }
-    PotentialSwitch       bool `json:"potentialSwitch"`       //潜在客户 潜在竞争对手 新逻辑开关
-    PortraitEntnicheCount int  `json:"portraitEntnicheCount"` //商机管理 默认画像每月权限次数
+	WebPort string
+	Mail    []struct {
+		Addr string
+		Port int
+		Pwd  string
+		User string
+	}
+	PortraitPool        int
+	PortraitCacheDay    int
+	PortraitScreenPool  int64
+	RdProLimit          int
+	FollowPushRpc       string
+	FollowEnt           followConfig
+	FollowProject       followConfig
+	AttachmentRPC       string
+	AttachmentMail      string
+	AttachmentMailTitle string
+	ReTry               int
+	Industry            map[string]interface{}
+	KeyMaxLength        int
+	WarnMailbox         []string
+	WarnMbTitle         string
+	TimeSpan            int
+	RegWinner           string
+	OldSubscribeMoveTip int64
+	Customers           []CustomerInfo
+	NewFreeUser         int64          //免费用户 -- 订阅升级新用户
+	FileUploadNum       map[string]int //每月附件下载次数
+	CreatePdfServer     string         //生成pdf文件服务地址
+	PdfServerPoor       int            //生成pdf线程数量控制
+	PdfDataApiWhiteList []string       //pdf数据接口白名单
+	MainWebDomain       string         //附件剑鱼地址
+	marketAnalysisPool  int
+	MarketAnalysisPool  struct {
+		Limit           int `json:"limit"`           //查询并发池
+		TimeOut         int `json:"timeOut"`         //并发池等待超时时长,单位秒
+		ProjectNumLimit int `json:"projectNumLimit"` //自定义报告限制项目个数
+	} `json:"marketAnalysisPool"` //市场分析
+	ForecastTime   int //中标预测结果redis 缓存时间
+	IsAddCacheTime int //isadd 接口数据存储时间 + 120 内随机数
+	IsAddUrls      struct {
+		Free      []string `json:"free"`
+		Vip       []string `json:"vip"`
+		BigMember []string `json:"bigMember"`
+		EntNiche  []string `json:"entNiche"`
+	}
+	PotentialSwitch       bool `json:"potentialSwitch"`       //潜在客户 潜在竞争对手 新逻辑开关
+	PortraitEntnicheCount int  `json:"portraitEntnicheCount"` //商机管理 默认画像每月权限次数
 
-    Claim struct {
-        Details  string `json:"details"`
-        ListPage string `json:"listPage"`
-    } `json:"claim"`
+	Claim struct {
+		Details  string `json:"details"`
+		ListPage string `json:"listPage"`
+	} `json:"claim"`
 }
 
 type CustomerInfo struct {
-    Name   string `json:"name"`
-    Wxer   string `json:"wxer"`
-    Remark string `json:"remark"`
+	Name   string `json:"name"`
+	Wxer   string `json:"wxer"`
+	Remark string `json:"remark"`
 }
 type followConfig struct {
-    Normal int
-    BigVip int
+	Normal int
+	BigVip int
 }
 
 var Config *config
@@ -81,19 +83,19 @@ var GmailAuth []*mail.GmailAuth
 var Middleground *middleground.Middleground
 
 func init() {
-    //程序配置文件
-    qutil.ReadConfig(&Config)
-    qutil.ReadConfig("./baseApi.json", &middleGround.JyApiConfig) //初始化中台请求接口
-    for _, v := range Config.Mail {
-        mail := &mail.GmailAuth{
-            SmtpHost: v.Addr,
-            SmtpPort: v.Port,
-            User:     v.User,
-            Pwd:      v.Pwd,
-        }
-        GmailAuth = append(GmailAuth, mail)
-    }
-    g.Cfg().GetAdapter().(*gcfg.AdapterFile).SetFileName("config.yaml")
-    var ctx = gctx.New()
-    Middleground = middleground.NewMiddleground(g.Cfg().MustGet(ctx, "etcd.hosts").Strings()).RegUserCenter(g.Cfg().MustGet(ctx, "userCenterKey").String()).RegPowerCheckCenter(g.Cfg().MustGet(ctx, "powerCheckKey").String())
+	//程序配置文件
+	qutil.ReadConfig(&Config)
+	qutil.ReadConfig("./baseApi.json", &middleGround.JyApiConfig) //初始化中台请求接口
+	for _, v := range Config.Mail {
+		mail := &mail.GmailAuth{
+			SmtpHost: v.Addr,
+			SmtpPort: v.Port,
+			User:     v.User,
+			Pwd:      v.Pwd,
+		}
+		GmailAuth = append(GmailAuth, mail)
+	}
+	g.Cfg().GetAdapter().(*gcfg.AdapterFile).SetFileName("config.yaml")
+	var ctx = gctx.New()
+	Middleground = middleground.NewMiddleground(g.Cfg().MustGet(ctx, "etcd.hosts").Strings()).RegPowerCheckCenter(g.Cfg().MustGet(ctx, "powerCheckCenterKey").String())
 }

+ 127 - 126
src/jfw/modules/distribution/src/service/config/config.go

@@ -1,154 +1,155 @@
 package config
 
 import (
-    util "app.yhyue.com/moapp/jybase/common"
-    "app.yhyue.com/moapp/jybase/mail"
-    m "app.yhyue.com/moapp/jybase/mongodb"
-    "app.yhyue.com/moapp/jybase/mysql"
-    "app.yhyue.com/moapp/jybase/redis"
-    "app.yhyue.com/moapp/jypkg/middleground"
-    "github.com/gogf/gf/v2/frame/g"
-    "github.com/gogf/gf/v2/os/gcfg"
-    "github.com/gogf/gf/v2/os/gctx"
-    "log"
+	"log"
+
+	util "app.yhyue.com/moapp/jybase/common"
+	"app.yhyue.com/moapp/jybase/mail"
+	m "app.yhyue.com/moapp/jybase/mongodb"
+	"app.yhyue.com/moapp/jybase/mysql"
+	"app.yhyue.com/moapp/jybase/redis"
+	"app.yhyue.com/moapp/jypkg/middleground"
+	"github.com/gogf/gf/v2/frame/g"
+	"github.com/gogf/gf/v2/os/gcfg"
+	"github.com/gogf/gf/v2/os/gctx"
 )
 
 type config struct {
-    Webport   string
-    Webdomain string
-    Mail      *[]mailConf
-    Mongodb   struct {
-        Main *mgoConf
-        Log  *mgoConf
-        Ent  *mgoConf
-    }
-    Elasticsearch struct {
-        Main *esConf
-    }
-    Redis struct {
-        Main  *redisConf
-        Login *redisConf
-    }
-    Mysql struct {
-        Main *mysqlConf
-        Push *mysqlConf
-    }
-    WorkerNum          int
-    JobNum             int
-    Modular            map[string]interface{}
-    UploadPath         string
-    CatchoutTimesMonth int64
-    AuthCost           float64
-    TermValidity       int
-    SourceCenter       string
-    PhoneFilterFlag    bool
-    AccountMergeOnline string
-    Regurl             []string
-    SmsServiceRpc      string
+	Webport   string
+	Webdomain string
+	Mail      *[]mailConf
+	Mongodb   struct {
+		Main *mgoConf
+		Log  *mgoConf
+		Ent  *mgoConf
+	}
+	Elasticsearch struct {
+		Main *esConf
+	}
+	Redis struct {
+		Main  *redisConf
+		Login *redisConf
+	}
+	Mysql struct {
+		Main *mysqlConf
+		Push *mysqlConf
+	}
+	WorkerNum          int
+	JobNum             int
+	Modular            map[string]interface{}
+	UploadPath         string
+	CatchoutTimesMonth int64
+	AuthCost           float64
+	TermValidity       int
+	SourceCenter       string
+	PhoneFilterFlag    bool
+	AccountMergeOnline string
+	Regurl             []string
+	SmsServiceRpc      string
 }
 
 type BalanceRes struct {
-    Code    int64                    `json:"code"`
-    Message string                   `json:"message"`
-    Data    []map[string]interface{} `json:"data"`
+	Code    int64                    `json:"code"`
+	Message string                   `json:"message"`
+	Data    []map[string]interface{} `json:"data"`
 }
 
 type mgoConf struct {
-    Address  string
-    Size     int
-    DbName   string
-    UserName string
-    Password string
+	Address  string
+	Size     int
+	DbName   string
+	UserName string
+	Password string
 }
 
 type esConf struct {
-    Address string
-    Size    int
+	Address string
+	Size    int
 }
 type redisConf struct {
-    Address string
+	Address string
 }
 type mysqlConf struct {
-    DbName       string
-    Address      string
-    UserName     string
-    PassWord     string
-    MaxOpenConns int
-    MaxIdleConns int
+	DbName       string
+	Address      string
+	UserName     string
+	PassWord     string
+	MaxOpenConns int
+	MaxIdleConns int
 }
 type mailConf struct {
-    Addr string
-    Port int
-    Pwd  string
-    User string
+	Addr string
+	Port int
+	Pwd  string
+	User string
 }
 
 var (
-    Sysconfig    *config
-    Mysql        *mysql.Mysql
-    MQFW         m.MongodbSim
-    Mgo_Log      m.MongodbSim
-    GmailAuth    []*mail.GmailAuth
-    Middleground *middleground.Middleground
+	Sysconfig    *config
+	Mysql        *mysql.Mysql
+	MQFW         m.MongodbSim
+	Mgo_Log      m.MongodbSim
+	GmailAuth    []*mail.GmailAuth
+	Middleground *middleground.Middleground
 )
 
 func init() {
-    util.ReadConfig(&Sysconfig)
-    if Sysconfig != nil {
-        //初始化redis
-        if Sysconfig.Redis.Main != nil {
-            log.Println("初始化 redis")
-            redis.InitRedisBySize(Sysconfig.Redis.Main.Address, 100, 30, 300)
-        }
-        //
-        if Sysconfig.Mongodb.Main != nil {
-            log.Println("初始化 mongodb main")
-            MQFW = m.MongodbSim{
-                MongodbAddr: Sysconfig.Mongodb.Main.Address,
-                Size:        Sysconfig.Mongodb.Main.Size,
-                DbName:      Sysconfig.Mongodb.Main.DbName,
-            }
-            MQFW.InitPool()
-        }
-        if Sysconfig.Mongodb.Log != nil {
-            log.Println("初始化 mongodb log")
-            Mgo_Log = m.MongodbSim{
-                MongodbAddr: Sysconfig.Mongodb.Log.Address,
-                Size:        Sysconfig.Mongodb.Log.Size,
-                DbName:      Sysconfig.Mongodb.Log.DbName,
-                UserName:    Sysconfig.Mongodb.Log.UserName,
-                Password:    Sysconfig.Mongodb.Log.Password,
-            }
-            Mgo_Log.InitPool()
-        }
-        if Sysconfig.Mysql.Main != nil {
-            log.Println("初始化 mysql")
-            Mysql = &mysql.Mysql{
-                Address:      Sysconfig.Mysql.Main.Address,
-                UserName:     Sysconfig.Mysql.Main.UserName,
-                PassWord:     Sysconfig.Mysql.Main.PassWord,
-                DBName:       Sysconfig.Mysql.Main.DbName,
-                MaxOpenConns: Sysconfig.Mysql.Main.MaxOpenConns,
-                MaxIdleConns: Sysconfig.Mysql.Main.MaxIdleConns,
-            }
-            Mysql.Init()
-        }
-        //
-        if Sysconfig.Mail != nil {
-            log.Println("初始化 Mail")
-            mailConfigArrMap := Sysconfig.Mail
-            for _, v := range *mailConfigArrMap {
-                mail := &mail.GmailAuth{
-                    SmtpHost: v.Addr,
-                    SmtpPort: v.Port,
-                    User:     v.User,
-                    Pwd:      v.Pwd,
-                }
-                GmailAuth = append(GmailAuth, mail)
-            }
-        }
-        g.Cfg().GetAdapter().(*gcfg.AdapterFile).SetFileName("config.yaml")
-        var ctx = gctx.New()
-        Middleground = middleground.NewMiddleground(g.Cfg().MustGet(ctx, "etcd.hosts").Strings()).RegUserCenter(g.Cfg().MustGet(ctx, "userCenterKey").String()).RegPowerCheckCenter(g.Cfg().MustGet(ctx, "powerCheckKey").String())
-    }
+	util.ReadConfig(&Sysconfig)
+	if Sysconfig != nil {
+		//初始化redis
+		if Sysconfig.Redis.Main != nil {
+			log.Println("初始化 redis")
+			redis.InitRedisBySize(Sysconfig.Redis.Main.Address, 100, 30, 300)
+		}
+		//
+		if Sysconfig.Mongodb.Main != nil {
+			log.Println("初始化 mongodb main")
+			MQFW = m.MongodbSim{
+				MongodbAddr: Sysconfig.Mongodb.Main.Address,
+				Size:        Sysconfig.Mongodb.Main.Size,
+				DbName:      Sysconfig.Mongodb.Main.DbName,
+			}
+			MQFW.InitPool()
+		}
+		if Sysconfig.Mongodb.Log != nil {
+			log.Println("初始化 mongodb log")
+			Mgo_Log = m.MongodbSim{
+				MongodbAddr: Sysconfig.Mongodb.Log.Address,
+				Size:        Sysconfig.Mongodb.Log.Size,
+				DbName:      Sysconfig.Mongodb.Log.DbName,
+				UserName:    Sysconfig.Mongodb.Log.UserName,
+				Password:    Sysconfig.Mongodb.Log.Password,
+			}
+			Mgo_Log.InitPool()
+		}
+		if Sysconfig.Mysql.Main != nil {
+			log.Println("初始化 mysql")
+			Mysql = &mysql.Mysql{
+				Address:      Sysconfig.Mysql.Main.Address,
+				UserName:     Sysconfig.Mysql.Main.UserName,
+				PassWord:     Sysconfig.Mysql.Main.PassWord,
+				DBName:       Sysconfig.Mysql.Main.DbName,
+				MaxOpenConns: Sysconfig.Mysql.Main.MaxOpenConns,
+				MaxIdleConns: Sysconfig.Mysql.Main.MaxIdleConns,
+			}
+			Mysql.Init()
+		}
+		//
+		if Sysconfig.Mail != nil {
+			log.Println("初始化 Mail")
+			mailConfigArrMap := Sysconfig.Mail
+			for _, v := range *mailConfigArrMap {
+				mail := &mail.GmailAuth{
+					SmtpHost: v.Addr,
+					SmtpPort: v.Port,
+					User:     v.User,
+					Pwd:      v.Pwd,
+				}
+				GmailAuth = append(GmailAuth, mail)
+			}
+		}
+		g.Cfg().GetAdapter().(*gcfg.AdapterFile).SetFileName("config.yaml")
+		var ctx = gctx.New()
+		Middleground = middleground.NewMiddleground(g.Cfg().MustGet(ctx, "etcd.hosts").Strings()).RegPowerCheckCenter(g.Cfg().MustGet(ctx, "powerCheckCenterKey").String())
+	}
 }

+ 1 - 1
src/jfw/modules/publicapply/src/config/config.go

@@ -75,5 +75,5 @@ func init() {
 	qutil.ReadConfig("./adLeague.json", &AdLeaguefig)
 	qutil.ReadConfig("./shareFission.json", &ShareConfig)
 	var ctx = gctx.New()
-	Middleground = middleground.NewMiddleground(g.Cfg().MustGet(ctx, "etcd.hosts").Strings()).RegUserCenter(g.Cfg().MustGet(ctx, "userCenterKey").String()).RegPowerCheckCenter(g.Cfg().MustGet(ctx, "powerCheckKey").String())
+	Middleground = middleground.NewMiddleground(g.Cfg().MustGet(ctx, "etcd.hosts").Strings()).RegUserCenter(g.Cfg().MustGet(ctx, "userCenterKey").String()).RegPowerCheckCenter(g.Cfg().MustGet(ctx, "powerCheckCenterKey").String())
 }

+ 3 - 2
src/jfw/modules/subscribepay/src/config/config.go

@@ -1,11 +1,12 @@
 package config
 
 import (
+	"time"
+
 	"app.yhyue.com/moapp/jypkg/middleground"
 	"github.com/gogf/gf/v2/frame/g"
 	"github.com/gogf/gf/v2/os/gcfg"
 	"github.com/gogf/gf/v2/os/gctx"
-	"time"
 
 	qutil "app.yhyue.com/moapp/jybase/common"
 	. "app.yhyue.com/moapp/jybase/date"
@@ -335,7 +336,7 @@ func init() {
 	qutil.ReadConfig("./baseApi.json", &middleGround.JyApiConfig) //初始化中台请求接口
 	g.Cfg().GetAdapter().(*gcfg.AdapterFile).SetFileName("config.yaml")
 	var ctx = gctx.New()
-	Middleground = middleground.NewMiddleground(g.Cfg().MustGet(ctx, "etcd.hosts").Strings()).RegUserCenter(g.Cfg().MustGet(ctx, "userCenterKey").String()).RegPowerCheckCenter(g.Cfg().MustGet(ctx, "powerCheckKey").String())
+	Middleground = middleground.NewMiddleground(g.Cfg().MustGet(ctx, "etcd.hosts").Strings()).RegPowerCheckCenter(g.Cfg().MustGet(ctx, "powerCheckCenterKey").String())
 
 	for _, v := range Config.Mail {
 		mail := &mail.GmailAuth{