123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- package models
- import (
- "github.com/beego/beego/v2/client/orm"
- _ "github.com/go-sql-driver/mysql"
- "hongze/hongze_open_api/models/tables"
- "hongze/hongze_open_api/models/tables/admin"
- "hongze/hongze_open_api/models/tables/company"
- "hongze/hongze_open_api/models/tables/company_product"
- "hongze/hongze_open_api/models/tables/cygx/article"
- "hongze/hongze_open_api/models/tables/cygx/cygx_activity"
- "hongze/hongze_open_api/models/tables/cygx/cygx_chart"
- "hongze/hongze_open_api/models/tables/cygx/cygx_three_api_log"
- "hongze/hongze_open_api/models/tables/day_new"
- "hongze/hongze_open_api/models/tables/open_api_user"
- "hongze/hongze_open_api/models/tables/qs_event"
- "hongze/hongze_open_api/models/tables/qs_event_user"
- "hongze/hongze_open_api/models/tables/wx_user"
- "hongze/hongze_open_api/models/tables/yb_activity"
- "hongze/hongze_open_api/utils"
- "time"
- )
- func init() {
- _ = orm.RegisterDataBase("default", "mysql", utils.MYSQL_URL)
- orm.SetMaxIdleConns("default", 50)
- orm.SetMaxOpenConns("default", 100)
- db, _ := orm.GetDB("default")
- db.SetConnMaxLifetime(10 * time.Minute)
- //rddp数据库
- _ = orm.RegisterDataBase("rddp", "mysql", utils.MYSQL_URL_RDDP)
- orm.SetMaxIdleConns("rddp", 50)
- orm.SetMaxOpenConns("rddp", 100)
- report_db, _ := orm.GetDB("rddp")
- report_db.SetConnMaxLifetime(10 * time.Minute)
- _ = orm.RegisterDataBase("hz_cygx", "mysql", utils.MYSQL_URL_CYGX)
- orm.SetMaxIdleConns("hz_cygx", 50)
- orm.SetMaxOpenConns("hz_cygx", 100)
- cygx_db, _ := orm.GetDB("hz_cygx")
- cygx_db.SetConnMaxLifetime(10 * time.Minute)
- //注册对象
- orm.RegisterModel(
- new(open_api_user.OpenApiUser), //开放API用户表
- new(admin.Admin), //系统用户表
- new(article.CygxArticleCeluePush), //策略平台推送过来更新的文章
- new(cygx_chart.CygxChartCeluePush), //策略平台推送过来更新的图表
- new(cygx_activity.CygxActivitySignup), //易董报名审核
- new(cygx_activity.CygxYidongActivitySignupLog), //易董报名记录日志
- new(cygx_activity.CygxYidongActivityExamineStatus), //易董审核记录日志
- new(cygx_activity.CygxMySchedule), //易董审核通过之后添加我的日程
- new(cygx_three_api_log.CygxThreeApiLog), //易董审核通过之后添加我的日程
- )
- orm.Debug = true
- orm.DebugLog = orm.NewLog(utils.Binlog)
- // 注册研报相关的表
- initYb()
- // 注册客户相关的表
- initCompany()
- initEnglishReport()
- }
- // initYb 研报活动相关
- func initYb() {
- orm.RegisterModel(
- new(yb_activity.Activity), //研报活动
- new(qs_event.QsEvent), //全时与ficc研报活动的关系表
- new(qs_event_user.QsEventUser), //全时参会信息
- new(day_new.WeworkMsg), // 企业微信会话存档表
- new(day_new.WeworkMsgLog), // 企业微信群消息拉取日志表
- new(day_new.WeworkUser), // 企业微信用户信息表
- )
- }
- // initCompany 注册客户相关的
- func initCompany() {
- orm.RegisterModel(
- new(company.Company), //company客户表
- new(company_product.CompanyProduct), //company_product客户产品表
- new(wx_user.WxUser), //微信用户表
- )
- }
- // initEnglishReport 英文研报
- func initEnglishReport() {
- orm.RegisterModel(
- new(tables.EnglishClassify), //EnglishClassify 英文分类表
- new(tables.EnglishPolicyReport), //EnglishPolicyReport 英文策略表
- new(tables.EnglishReport), //英文研报表
- )
- }
|