123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 |
- package config
- import (
- "app.yhyue.com/moapp/jybase/common"
- qrpc "app.yhyue.com/moapp/message/model"
- "github.com/gogf/gf/v2/frame/g"
- "github.com/gogf/gf/v2/os/gcfg"
- "github.com/gogf/gf/v2/os/gctx"
- )
- type config struct {
- Nsq struct {
- Address string
- }
- Redis struct {
- Address string
- }
- Mongodb struct {
- Address string
- Size int
- DbName string
- ReplSet string
- UserName string
- Password string
- }
- Etcd struct {
- Hosts []string
- Key string
- }
- DocPoints struct {
- AppId string
- Open struct {
- Max int64
- Jyweb_article_open int64
- Jydocs_doc_open int64
- }
- Jywx_subscribe_new int64
- Jywx_subscribe_invite int64
- Jywx_subscribe_invited int64
- }
- }
- type msgConf struct {
- Title string
- Content string
- MsgType int64
- Appid string
- PcUrl string
- MobileUrl string
- }
- var (
- PushConfig *pushConfig
- TaskConf *taskConf
- )
- type LotteryReceiveReq struct {
- UserName string `json:"userName"`
- UserId string `json:"userId"`
- LotteryIdArr string `json:"lotteryIdArr"`
- }
- type pushConfig struct {
- Webdomain string `json:"webdomain"`
- Weixinrpc string `json:"weixinrpc"`
- PushPoolSize int `json:"pushPoolSize"`
- WxMsg struct {
- Id string
- First *qrpc.TmplItem
- Keyword1 *qrpc.TmplItem
- Keyword2 *qrpc.TmplItem
- Keyword3 *qrpc.TmplItem
- Keyword4 *qrpc.TmplItem
- Remark *qrpc.TmplItem
- } `json:"wxTplMsg"`
- TestId string `json:"testId"`
- DelayedTime int `json:"delayedTime"`
- Subvip string `json:"subvip"`
- Points string `json:"points"`
- FullReduce string `json:"fullReduce"`
- Messages struct {
- NewUser *msgConf
- ConfirmChallenge *msgConf
- GetVip *msgConf
- }
- }
- type OrderMonitorConfig struct {
- DateSpecial string // 特别奖品活动日期
- OpenCron string // 每天开启订单查询的任务
- SelectCron string // 每5分钟查询一次
- WinNumberDaily int // 每天第xx个付款获得奖品
- WinNumbersSpecial int // 第xxx个付款获得特殊奖品
- Switch bool // 是否开启定时任务
- ActivityMode int // # 1. 每天第多少名 2. 活动期间内一共第多少名(双十二)
- Rules []struct { // 双十二活动规则
- WinNum []int // 获奖的下单顺序
- Mold int // 奖品 3 免单
- Products []string // # 参加活动的产品
- PriceLimit bool // 是否有实付金额限制
- PriceStart int // 实付金额最低 单位(分)
- PriceEnd int // 实付金额最高 单位(分)
- }
- }
- type taskConf struct {
- TaskStartTime int64 `json:"taskStartTime"` //限时活动开始时间
- NewTask []*TaskStruct `json:"newTask"` //新手任务
- OldTask []*TaskStruct `json:"oldTask"` //老用户限时任务
- TaskDayTime int64 `json:"taskDayTime"` //活动时间
- }
- type TaskStruct struct {
- Name string `json:"name"`
- Desc string `json:"desc"`
- PcHref string `json:"pcHref"`
- AppHref string `json:"appHref"`
- WxHref string `json:"wxHref"`
- Point int `json:"point"`
- Icon string `json:"icon"`
- Type string `json:"type"`
- Distinguish int `json:"distinguish"` // 0不用区分身份 1区分身份
- }
- type SaveLogConfig struct {
- Name string // 日志名称
- CollName string // 保存的coll
- MgoSaveCacheSize int // 缓存通道大小
- SPSize int // 数据库并发数据
- BulkSize int // 每批的数量
- TimeAfter int // 定时保存 毫秒
- Timeout int // 超时丢弃毫秒
- }
- //var Config *config
- var NsqLogConfig SaveLogConfig
- func init() {
- //推送配置文件
- common.ReadConfig("./etc/push.json", &PushConfig)
- //系统配置文件
- //common.ReadConfig(&Config)
- g.Cfg().GetAdapter().(*gcfg.AdapterFile).SetFileName("./etc/config.yaml")
- //任务配置文件
- common.ReadConfig("./etc/task.json", &TaskConf)
- NsqLogConfig = SaveLogConfig{
- Name: gcfg.Instance().MustGet(gctx.New(), "NsqLog.Name").String(),
- CollName: gcfg.Instance().MustGet(gctx.New(), "NsqLog.CollName").String(),
- MgoSaveCacheSize: gcfg.Instance().MustGet(gctx.New(), "NsqLog.MgoSaveCacheSize").Int(),
- SPSize: gcfg.Instance().MustGet(gctx.New(), "NsqLog.SPSize").Int(),
- BulkSize: gcfg.Instance().MustGet(gctx.New(), "NsqLog.BulkSize").Int(),
- TimeAfter: gcfg.Instance().MustGet(gctx.New(), "NsqLog.TimeAfter").Int(),
- Timeout: gcfg.Instance().MustGet(gctx.New(), "NsqLog.Timeout").Int(),
- }
- }
|