50 lines
1.2 KiB
Go
50 lines
1.2 KiB
Go
package smithy
|
|
|
|
import (
|
|
"go_dreamfactory/comm"
|
|
"go_dreamfactory/lego/core"
|
|
"go_dreamfactory/modules"
|
|
"go_dreamfactory/pb"
|
|
|
|
"go.mongodb.org/mongo-driver/mongo"
|
|
"go.mongodb.org/mongo-driver/x/bsonx"
|
|
)
|
|
|
|
type modelTask struct {
|
|
modules.MCompModel
|
|
module *Smithy
|
|
}
|
|
|
|
func (this *modelTask) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
|
this.TableName = string(comm.TableSmithyTask)
|
|
err = this.MCompModel.Init(service, module, comp, options)
|
|
this.module = module.(*Smithy)
|
|
this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
|
|
Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}},
|
|
})
|
|
// event.Register(comm.EventBuriedComplete, this.TCondFinishNotify)
|
|
return
|
|
}
|
|
|
|
func (this *modelTask) getTaskRecord(uid string) (*pb.DBTujianTask, error) {
|
|
tt := &pb.DBTujianTask{Uid: uid}
|
|
if err := this.Get(uid, tt); err != nil {
|
|
return tt, err
|
|
}
|
|
return tt, nil
|
|
}
|
|
|
|
// 红点检测 2023/9/25需求 屏蔽铁匠铺任务红点
|
|
func (this *modelTask) checkReddot17107(uid string) bool {
|
|
// dt, err := this.getTaskRecord(uid)
|
|
// if err != nil {
|
|
// return false
|
|
// }
|
|
// for _, v := range dt.Tasks {
|
|
// if v.Received == 1 {
|
|
// return true
|
|
// }
|
|
// }
|
|
return false
|
|
}
|