From 7081e9a8cb6155cfaf74084022b7234585802ef2 Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Tue, 14 Jun 2022 15:36:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=8E=A5=E5=8F=A3=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/model/dbservice_comp.go | 4 ++-- modules/model/mail_test.go | 8 ++------ modules/model/module.go | 2 ++ sys/cache/cache.go | 2 +- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/modules/model/dbservice_comp.go b/modules/model/dbservice_comp.go index cfaa543b4..bf6056c8a 100644 --- a/modules/model/dbservice_comp.go +++ b/modules/model/dbservice_comp.go @@ -27,9 +27,9 @@ func (this *DBService_Comp) run() { for { select { case v := <-this.task: - this.module.DB().(*DB_Comp).Model_UpdateUserDataByUid(v) + this.module.db_comp.Model_UpdateUserDataByUid(v) case <-time.After(time.Second): - this.module.DB().(*DB_Comp).Model_UpdateDBByLog() + this.module.db_comp.Model_UpdateDBByLog() } } } diff --git a/modules/model/mail_test.go b/modules/model/mail_test.go index 4329db094..a16685f61 100644 --- a/modules/model/mail_test.go +++ b/modules/model/mail_test.go @@ -1,4 +1,4 @@ -package modules +package model import ( "go_dreamfactory/lego/sys/log" @@ -7,10 +7,6 @@ import ( "time" ) -var ( - obj MComp_DBComp -) - func TestCreatemoudles(t *testing.T) { _mail := &pb.DB_MailData{ @@ -23,7 +19,7 @@ func TestCreatemoudles(t *testing.T) { Check: false, Reward: false, } - obj.InsertModelLogs("mail", "uid123", _mail) + // obj.InsertModelLogs("mail", "uid123", _mail) log.Debugf("insert : %v", _mail) } diff --git a/modules/model/module.go b/modules/model/module.go index 0b32766bd..e2ac54346 100644 --- a/modules/model/module.go +++ b/modules/model/module.go @@ -15,6 +15,7 @@ func NewModule() core.IModule { type Model struct { modules.ModuleBase api_comp *Api_Comp + db_comp *DB_Comp configure_comp *Configure_Comp } @@ -37,6 +38,7 @@ func (this *Model) GetType() core.M_Modules { func (this *Model) OnInstallComp() { this.ModuleBase.OnInstallComp() this.api_comp = this.RegisterComp(new(Api_Comp)).(*Api_Comp) + this.db_comp = this.RegisterComp(new(DB_Comp)).(*DB_Comp) this.configure_comp = this.RegisterComp(new(Configure_Comp)).(*Configure_Comp) } diff --git a/sys/cache/cache.go b/sys/cache/cache.go index cb284640a..924bbaa54 100644 --- a/sys/cache/cache.go +++ b/sys/cache/cache.go @@ -21,7 +21,7 @@ type Cache struct { func (this *Cache) init() (err error) { this.redis, err = redis.NewSys( redis.SetRedisType(redis.Redis_Cluster), - redis.Redis_Cluster_Addr(this.options.Redis_Addr), + redis.SetRedis_Cluster_Addr(this.options.Redis_Addr), redis.SetRedis_Cluster_Password(this.options.Redis_Password)) return }