上传接口调整代码

This commit is contained in:
liwei1dao 2022-06-14 15:36:58 +08:00
parent 8ff4813033
commit 7081e9a8cb
4 changed files with 7 additions and 9 deletions

View File

@ -27,9 +27,9 @@ func (this *DBService_Comp) run() {
for { for {
select { select {
case v := <-this.task: case v := <-this.task:
this.module.DB().(*DB_Comp).Model_UpdateUserDataByUid(v) this.module.db_comp.Model_UpdateUserDataByUid(v)
case <-time.After(time.Second): case <-time.After(time.Second):
this.module.DB().(*DB_Comp).Model_UpdateDBByLog() this.module.db_comp.Model_UpdateDBByLog()
} }
} }
} }

View File

@ -1,4 +1,4 @@
package modules package model
import ( import (
"go_dreamfactory/lego/sys/log" "go_dreamfactory/lego/sys/log"
@ -7,10 +7,6 @@ import (
"time" "time"
) )
var (
obj MComp_DBComp
)
func TestCreatemoudles(t *testing.T) { func TestCreatemoudles(t *testing.T) {
_mail := &pb.DB_MailData{ _mail := &pb.DB_MailData{
@ -23,7 +19,7 @@ func TestCreatemoudles(t *testing.T) {
Check: false, Check: false,
Reward: false, Reward: false,
} }
obj.InsertModelLogs("mail", "uid123", _mail) // obj.InsertModelLogs("mail", "uid123", _mail)
log.Debugf("insert : %v", _mail) log.Debugf("insert : %v", _mail)
} }

View File

@ -15,6 +15,7 @@ func NewModule() core.IModule {
type Model struct { type Model struct {
modules.ModuleBase modules.ModuleBase
api_comp *Api_Comp api_comp *Api_Comp
db_comp *DB_Comp
configure_comp *Configure_Comp configure_comp *Configure_Comp
} }
@ -37,6 +38,7 @@ func (this *Model) GetType() core.M_Modules {
func (this *Model) OnInstallComp() { func (this *Model) OnInstallComp() {
this.ModuleBase.OnInstallComp() this.ModuleBase.OnInstallComp()
this.api_comp = this.RegisterComp(new(Api_Comp)).(*Api_Comp) 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) this.configure_comp = this.RegisterComp(new(Configure_Comp)).(*Configure_Comp)
} }

2
sys/cache/cache.go vendored
View File

@ -21,7 +21,7 @@ type Cache struct {
func (this *Cache) init() (err error) { func (this *Cache) init() (err error) {
this.redis, err = redis.NewSys( this.redis, err = redis.NewSys(
redis.SetRedisType(redis.Redis_Cluster), 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)) redis.SetRedis_Cluster_Password(this.options.Redis_Password))
return return
} }