Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
a31a8eb6c3
@ -4,10 +4,14 @@ import (
|
|||||||
"go_dreamfactory/comm"
|
"go_dreamfactory/comm"
|
||||||
"go_dreamfactory/modules"
|
"go_dreamfactory/modules"
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
|
"go_dreamfactory/sys/db"
|
||||||
|
"go_dreamfactory/utils"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"go_dreamfactory/lego/core"
|
"go_dreamfactory/lego/core"
|
||||||
"go_dreamfactory/lego/sys/log"
|
"go_dreamfactory/lego/sys/log"
|
||||||
|
|
||||||
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||||
)
|
)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -38,16 +42,6 @@ func (this *Mail) OnInstallComp() {
|
|||||||
this.configure_comp = this.RegisterComp(new(Configure_Comp)).(*Configure_Comp)
|
this.configure_comp = this.RegisterComp(new(Configure_Comp)).(*Configure_Comp)
|
||||||
}
|
}
|
||||||
|
|
||||||
// mail := &pb.DBMailData{
|
|
||||||
// ObjId: primitive.NewObjectID().Hex(),
|
|
||||||
// Uid: uId,
|
|
||||||
// Title: "系统邮件",
|
|
||||||
// Contex: "恭喜获得专属礼包一份",
|
|
||||||
// CreateTime: uint64(time.Now().Unix()),
|
|
||||||
// DueTime: uint64(time.Now().Unix()) + 30*24*3600, // 30天需要走配置文件
|
|
||||||
// Check: false,
|
|
||||||
// Reward: false,
|
|
||||||
// }
|
|
||||||
func (this *Mail) CreateNewMail(session comm.IUserSession, mail *pb.DBMailData) bool {
|
func (this *Mail) CreateNewMail(session comm.IUserSession, mail *pb.DBMailData) bool {
|
||||||
t := time.Now()
|
t := time.Now()
|
||||||
defer func() {
|
defer func() {
|
||||||
@ -56,11 +50,28 @@ func (this *Mail) CreateNewMail(session comm.IUserSession, mail *pb.DBMailData)
|
|||||||
if mail == nil {
|
if mail == nil {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
if db.IsCross() { // 如果是跨服 则取本服的db
|
||||||
|
tag, _, b := utils.UIdSplit(session.GetUserId())
|
||||||
|
if b {
|
||||||
|
if conn, err := db.ServerDBConn(tag); err == nil {
|
||||||
|
dbModel := db.NewDBModel(comm.TableMail, time.Hour, conn)
|
||||||
|
mail.ObjId = primitive.NewObjectID().Hex()
|
||||||
|
mail.Check = false
|
||||||
|
mail.Reward = false
|
||||||
|
|
||||||
|
if len(mail.GetItems()) > 0 {
|
||||||
|
mail.Reward = false
|
||||||
|
}
|
||||||
|
_, err = dbModel.DB.InsertOne(comm.TableMail, mail)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
err := this.modelMail.MailInsertUserMail(mail)
|
err := this.modelMail.MailInsertUserMail(mail)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
this.Errorf("create mail failed :%v", err)
|
this.Errorf("create mail failed :%v", err)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// 通知玩家
|
// 通知玩家
|
||||||
this.AddNewMailPush(session, mail)
|
this.AddNewMailPush(session, mail)
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.PagodaGetListReq
|
|||||||
var (
|
var (
|
||||||
list *pb.DBPagoda
|
list *pb.DBPagoda
|
||||||
)
|
)
|
||||||
|
this.GetListCheck(session, req)
|
||||||
expand, err := this.module.ModuleUser.GetUserExpand(session.GetUserId())
|
expand, err := this.module.ModuleUser.GetUserExpand(session.GetUserId())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
code = pb.ErrorCode_DBError
|
code = pb.ErrorCode_DBError
|
||||||
|
@ -89,5 +89,34 @@ func Test_Modules(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestXxx(t *testing.T) {
|
func TestXxx(t *testing.T) {
|
||||||
|
// if !this.module.IsCross() {
|
||||||
|
// if conn, err := db.Cross(); err == nil {
|
||||||
|
// userinfo := this.module.ModuleUser.GetUser(session.GetUserId())
|
||||||
|
// newData := &pb.DBPagodaRecord{
|
||||||
|
// Id: primitive.NewObjectID().Hex(),
|
||||||
|
// Uid: session.GetUserId(),
|
||||||
|
// PagodaId: 100,
|
||||||
|
// Type: 201,
|
||||||
|
// Nickname: userinfo.Name,
|
||||||
|
// Icon: "", // icon 暂无
|
||||||
|
// Lv: userinfo.Lv,
|
||||||
|
// CostTime: 1001,
|
||||||
|
// }
|
||||||
|
// menbers := make([]*redis.Z, 2)
|
||||||
|
|
||||||
|
// menbers[0] = &redis.Z{Score: float64(123), Member: "dfmxf_001"}
|
||||||
|
// menbers[1] = &redis.Z{Score: float64(13), Member: "dfmxf_002"}
|
||||||
|
// pipe := conn.Redis.RedisPipe(context.TODO())
|
||||||
|
// if cmd := pipe.ZAdd("ranklist", menbers...); err != nil {
|
||||||
|
// this.module.Errorln(err)
|
||||||
|
// } else {
|
||||||
|
// if _, err = cmd.Result(); err != nil {
|
||||||
|
// this.module.Errorln(err)
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// conn.Mgo.InsertOne(comm.TablePagodaRecord, newData)
|
||||||
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user