|
@@ -1,116 +1,116 @@
|
|
|
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/compatible"
|
|
|
- ma "app.yhyue.com/moapp/jypkg/marketanalysis"
|
|
|
- "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"
|
|
|
- "jy/src/jfw/modules/bigmember/src/restriction"
|
|
|
+ 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/compatible"
|
|
|
+ ma "app.yhyue.com/moapp/jypkg/marketanalysis"
|
|
|
+ "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"
|
|
|
+ "jy/src/jfw/modules/bigmember/src/restriction"
|
|
|
)
|
|
|
|
|
|
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"` //自定义报告限制项目个数
|
|
|
- KeyWordsCount int `json:"keyWordsCount"` // 关键词数量附加词排除词加起来限制
|
|
|
- } `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"` //自定义报告限制项目个数
|
|
|
+ KeyWordsCount int `json:"keyWordsCount"` // 关键词数量附加词排除词加起来限制
|
|
|
+ } `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"`
|
|
|
- ContextOldVipLimit int64 `json:"contextOldVipLimit"` //超级订阅部分用户:--- 超前项目权限
|
|
|
- PotentialCount int `json:"potentialCount"` //潜在客户 潜在竞争对手数据量
|
|
|
- NewDataTime int64 `json:"newDataTime"` // 用于周边月报区分是否为新数据 、配置为p350发版的时间
|
|
|
- ProjectCount int `json:"projectCount"` //画像和报告项目明细最大数量
|
|
|
- PortraitStartTime int `json:"portraitStartTime"`
|
|
|
- PortraitDynamicTime int `json:"portraitDynamicTime"`
|
|
|
- PortraitCount int `json:"portraitCount"`
|
|
|
- Nsq string `json:"nsq"`
|
|
|
- Nsq_topic string `json:"nsq_topic"`
|
|
|
- AttachmentResPower []string `json:"attachmentResPower"`
|
|
|
- MsgMaxCount int `json:"msgMaxCount"`
|
|
|
- AnalysisPDFPhone string `json:"analysisPDFPhone"`
|
|
|
- PayUserCollLimit int64 `json:"payUserCollLimit"` //付费用户收藏数量最大限制
|
|
|
- FreeUserCollLimit int64 `json:"freeUserCollLimit"` //免费用户收藏数量最大限制
|
|
|
- FollowCustomer struct {
|
|
|
- Member map[string]int //大会员 default 10个,商机版2.0 100个,专家版2.0 500个
|
|
|
- Vip struct { //超级订阅 新老版都是10个
|
|
|
- New int
|
|
|
- Old int
|
|
|
- }
|
|
|
- Ent struct { //商机管理 新老版都是10个
|
|
|
- New int
|
|
|
- Old int
|
|
|
- }
|
|
|
- EntService int //企业管理服务 10个
|
|
|
- Free int //免费用户 0个
|
|
|
- }
|
|
|
- MiniPortraitCacheTime int
|
|
|
- RestrictionSwitch bool
|
|
|
- RestrictionDoPool int
|
|
|
- RestrictionWaitPool int
|
|
|
- BidSearchOldUserLimit int64 // p480 原/publicapply/bidcoll/power 接口返回值的isOld添加到isAdd接口
|
|
|
+ Claim struct {
|
|
|
+ Details string `json:"details"`
|
|
|
+ ListPage string `json:"listPage"`
|
|
|
+ } `json:"claim"`
|
|
|
+ ContextOldVipLimit int64 `json:"contextOldVipLimit"` //超级订阅部分用户:--- 超前项目权限
|
|
|
+ PotentialCount int `json:"potentialCount"` //潜在客户 潜在竞争对手数据量
|
|
|
+ NewDataTime int64 `json:"newDataTime"` // 用于周边月报区分是否为新数据 、配置为p350发版的时间
|
|
|
+ ProjectCount int `json:"projectCount"` //画像和报告项目明细最大数量
|
|
|
+ PortraitStartTime int `json:"portraitStartTime"`
|
|
|
+ PortraitDynamicTime int `json:"portraitDynamicTime"`
|
|
|
+ PortraitCount int `json:"portraitCount"`
|
|
|
+ Nsq string `json:"nsq"`
|
|
|
+ Nsq_topic string `json:"nsq_topic"`
|
|
|
+ AttachmentResPower []string `json:"attachmentResPower"`
|
|
|
+ MsgMaxCount int `json:"msgMaxCount"`
|
|
|
+ AnalysisPDFPhone string `json:"analysisPDFPhone"`
|
|
|
+ PayUserCollLimit int64 `json:"payUserCollLimit"` //付费用户收藏数量最大限制
|
|
|
+ FreeUserCollLimit int64 `json:"freeUserCollLimit"` //免费用户收藏数量最大限制
|
|
|
+ FollowCustomer struct {
|
|
|
+ Member map[string]int //大会员 default 10个,商机版2.0 100个,专家版2.0 500个
|
|
|
+ Vip struct { //超级订阅 新老版都是10个
|
|
|
+ New int
|
|
|
+ Old int
|
|
|
+ }
|
|
|
+ Ent struct { //商机管理 新老版都是10个
|
|
|
+ New int
|
|
|
+ Old int
|
|
|
+ }
|
|
|
+ EntService int //企业管理服务 10个
|
|
|
+ Free int //免费用户 0个
|
|
|
+ }
|
|
|
+ MiniPortraitCacheTime int
|
|
|
+ RestrictionSwitch bool
|
|
|
+ RestrictionDoPool int
|
|
|
+ RestrictionWaitPool int
|
|
|
+ BidSearchOldUserLimit int64 // p480 原/publicapply/bidcoll/power 接口返回值的isOld添加到isAdd接口
|
|
|
}
|
|
|
|
|
|
type CustomerInfo struct {
|
|
|
- Name string `json:"name"`
|
|
|
- Wxer string `json:"wxer"`
|
|
|
- Remark string `json:"remark"`
|
|
|
- Vip bool `json:"vip"`
|
|
|
+ Name string `json:"name"`
|
|
|
+ Wxer string `json:"wxer"`
|
|
|
+ Remark string `json:"remark"`
|
|
|
+ Vip bool `json:"vip"`
|
|
|
}
|
|
|
type followConfig struct {
|
|
|
- Normal int
|
|
|
- BigVip int
|
|
|
+ Normal int
|
|
|
+ BigVip int
|
|
|
}
|
|
|
|
|
|
var Config *config
|
|
@@ -119,27 +119,30 @@ var Middleground *middleground.Middleground
|
|
|
var Compatible *compatible.Compatible
|
|
|
|
|
|
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()).
|
|
|
- RegPowerCheckCenter(g.Cfg().MustGet(ctx, "powerCheckCenterKey").String()).
|
|
|
- RegUserCenter(g.Cfg().MustGet(ctx, "userCenterKey").String()).
|
|
|
- RegResourceCenter(g.Cfg().MustGet(ctx, "resourceCenterKey").String())
|
|
|
- if Config.RestrictionSwitch {
|
|
|
- restriction.ReqLimitInit(Config.RestrictionDoPool, Config.RestrictionWaitPool)
|
|
|
- }
|
|
|
- //定制化报告
|
|
|
- ma.MAInit(Config.MarketAnalysisPool.Limit, Config.MarketAnalysisPool.TimeOut, Config.MarketAnalysisPool.ProjectNumLimit, Config.MarketAnalysisPool.KeyWordsCount, Config.ProjectCount)
|
|
|
+ //程序配置文件
|
|
|
+ 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()).
|
|
|
+ RegUserCenter(g.Cfg().MustGet(ctx, "userCenterKey").String()).
|
|
|
+ RegResourceCenter(g.Cfg().MustGet(ctx, "resourceCenterKey").String())
|
|
|
+ if Config.RestrictionSwitch {
|
|
|
+ restriction.ReqLimitInit(Config.RestrictionDoPool, Config.RestrictionWaitPool)
|
|
|
+ }
|
|
|
+ //定制化报告
|
|
|
+ ptIndex := g.Cfg().MustGet(gctx.New(), "ma.index").String()
|
|
|
+ ptType := g.Cfg().MustGet(gctx.New(), "ma.type").String()
|
|
|
+ fields := g.Cfg().MustGet(gctx.New(), "ma.fields").Strings()
|
|
|
+ ma.MAInit(Config.MarketAnalysisPool.Limit, Config.MarketAnalysisPool.TimeOut, Config.MarketAnalysisPool.ProjectNumLimit, Config.MarketAnalysisPool.KeyWordsCount, Config.ProjectCount, ptType, ptIndex, fields)
|
|
|
}
|