package models import ( "github.com/beego/beego/v2/client/orm" _ "github.com/go-sql-driver/mysql" "hongze/hongze_mobile_admin/models/cygx" "hongze/hongze_mobile_admin/models/roadshow" "hongze/hongze_mobile_admin/models/tables/admin" "hongze/hongze_mobile_admin/models/tables/admin_record" "hongze/hongze_mobile_admin/models/tables/approval_flow" "hongze/hongze_mobile_admin/models/tables/approval_flow_node" "hongze/hongze_mobile_admin/models/tables/business_trip" "hongze/hongze_mobile_admin/models/tables/chart_permission" "hongze/hongze_mobile_admin/models/tables/company" "hongze/hongze_mobile_admin/models/tables/company_approval" "hongze/hongze_mobile_admin/models/tables/company_approval_message" "hongze/hongze_mobile_admin/models/tables/company_contract" "hongze/hongze_mobile_admin/models/tables/company_delay_permission" "hongze/hongze_mobile_admin/models/tables/company_log" "hongze/hongze_mobile_admin/models/tables/company_operation_record" "hongze/hongze_mobile_admin/models/tables/company_permission_log" "hongze/hongze_mobile_admin/models/tables/company_product" "hongze/hongze_mobile_admin/models/tables/company_product_log" "hongze/hongze_mobile_admin/models/tables/company_product_try_out_update_log" "hongze/hongze_mobile_admin/models/tables/company_product_try_out_update_permission_log" "hongze/hongze_mobile_admin/models/tables/company_product_update_log" "hongze/hongze_mobile_admin/models/tables/company_renewal_record" "hongze/hongze_mobile_admin/models/tables/company_report_permission" "hongze/hongze_mobile_admin/models/tables/contract" "hongze/hongze_mobile_admin/models/tables/contract_approval" "hongze/hongze_mobile_admin/models/tables/contract_approval_record" "hongze/hongze_mobile_admin/models/tables/contract_operation_record" "hongze/hongze_mobile_admin/models/tables/contract_service_detail" "hongze/hongze_mobile_admin/models/tables/contract_service_template" "hongze/hongze_mobile_admin/models/tables/contract_template" "hongze/hongze_mobile_admin/models/tables/cygx_allocation_company_contract" "hongze/hongze_mobile_admin/models/tables/cygx_company_user_type" "hongze/hongze_mobile_admin/models/tables/english_company" "hongze/hongze_mobile_admin/models/tables/h5_admin_session" "hongze/hongze_mobile_admin/models/tables/report" "hongze/hongze_mobile_admin/models/tables/research_variety_tag_relation" "hongze/hongze_mobile_admin/models/tables/resource" "hongze/hongze_mobile_admin/models/tables/seal" "hongze/hongze_mobile_admin/models/tables/sys_role" "hongze/hongze_mobile_admin/models/tables/sys_role_admin" "hongze/hongze_mobile_admin/models/tables/user_template_record" "hongze/hongze_mobile_admin/models/tables/variety_classify" "hongze/hongze_mobile_admin/models/tables/variety_tag" "hongze/hongze_mobile_admin/models/tables/wx_token" "hongze/hongze_mobile_admin/models/tables/wx_user" "hongze/hongze_mobile_admin/models/tables/yb_community_question" "hongze/hongze_mobile_admin/models/tables/yb_community_question_comment" "hongze/hongze_mobile_admin/models/tables/yb_price_driven_tag" "hongze/hongze_mobile_admin/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.Debug = true orm.DebugLog = orm.NewLog(utils.Binlog) //注册对象 orm.RegisterModel( new(admin.Admin), new(admin_record.AdminRecord), new(sys_role.SysRole), new(sys_role_admin.SysRoleAdmin), new(approval_flow.ApprovalFlow), new(approval_flow_node.ApprovalFlowNode), new(company.Company), new(company_approval.CompanyApproval), new(company_approval_message.CompanyApprovalMessage), new(company_contract.CompanyContract), new(company_delay_permission.CompanyDelayPermission), new(company_log.CompanyLog), new(company_operation_record.CompanyOperationRecord), new(company_permission_log.CompanyPermissionLog), new(company_product.CompanyProduct), new(company_product_log.CompanyProductLog), new(company_report_permission.CompanyReportPermission), new(contract.Contract), new(contract_approval.ContractApproval), new(contract_approval_record.ContractApprovalRecord), new(contract_operation_record.ContractOperationRecord), new(contract_service_detail.ContractServiceDetail), new(contract_service_template.ContractServiceTemplate), new(contract_template.ContractTemplate), new(h5_admin_session.H5AdminSession), new(report.Report), new(resource.Resource), new(wx_token.WxToken), new(wx_user.WxUser), new(seal.Seal), //用印表 new(seal.SealOperationRecord), // 用印操作记录表 new(seal.Attachment), //用印附件 new(roadshow.RsCalendar), new(roadshow.RsCalendarResearcher), new(roadshow.RsMatters), new(roadshow.RsCalendarRelation), new(roadshow.RsCalendarApiLog), new(company_product_update_log.CompanyProductUpdateLog), //客户产品状态变更记录表 new(user_template_record.UserTemplateRecord), //模版消息记录表 new(chart_permission.ChartPermission), // 品种权限表 new(company_product_try_out_update_log.CompanyProductTryOutUpdateLog), //客户产品试用变更状态表 new(company_product_try_out_update_permission_log.CompanyProductTryOutUpdatePermissionLog), //客户产品试用变更品种详情表 new(english_company.EnglishCompany), // 英文客户表 new(cygx_company_user_type.CygxCompanyUserType), // 英文客户表 new(cygx.CygxActivitySpecialTripBill), // 专项调研确定行程活动报名流水表 new(cygx.CygxActivitySpecialPermissionPoints), //权益公司专项调研各行业点数剩余表 new(cygx_allocation_company_contract.CygxAllocationCompanyContract), //权益合同派点(研究员) new(cygx_allocation_company_contract.CygxAllocationCompanyContractLog), //权益合同派点日志(研究员) new(cygx_allocation_company_contract.CygxAllocationCompanyContractPermission), //权益合同派点(行业) new(cygx_allocation_company_contract.CygxAllocationCompanyContractPermissionLog), //权益合同派点日志(行业) new(company_renewal_record.CompanyRenewalRecord), // 客户续约状态记录表 ) // 社区问答相关 initCommunity() // 品种标签相关 initVariety() // 价格驱动相关 initPriceDriven() //出差相关 initBusinessTrip() } // initCommunity 社区问答相关 func initCommunity() { orm.RegisterModel( new(yb_community_question.CommunityQuestion), //社区问答 new(yb_community_question_comment.YbCommunityQuestionComment), //社区问答评论 ) } // initVariety 品种标签相关 func initVariety() { orm.RegisterModel( new(variety_classify.VarietyClassify), //品种标签分类 new(variety_tag.VarietyTag), //品种标签 new(research_variety_tag_relation.ResearchVarietyTagRelation), //品种标签关系 ) } // initPriceDriven 价格驱动相关 func initPriceDriven() { orm.RegisterModel( new(yb_price_driven_tag.PriceDrivenTag), //价格驱动标签 ) } func InitDb() {} // 出差 func initBusinessTrip() { orm.RegisterModel( new(business_trip.BusinessApply), new(business_trip.BusinessApplyPeer), ) }