Merge branch 'meixiongfeng' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
3ae8b17509
@ -51,8 +51,8 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.HuntingGetListRe
|
|||||||
code = pb.ErrorCode_ConfigNoFound
|
code = pb.ErrorCode_ConfigNoFound
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
iCont := conf.EnchantbossInitial
|
iCont := conf.HuntingNum
|
||||||
atn := conf.EnchantbossCos
|
atn := conf.HuntingCos
|
||||||
if iCont > 0 {
|
if iCont > 0 {
|
||||||
|
|
||||||
this.module.DispenseRes(session, []*cfg.Gameatn{&cfg.Gameatn{
|
this.module.DispenseRes(session, []*cfg.Gameatn{&cfg.Gameatn{
|
||||||
|
@ -2,11 +2,14 @@ package viking
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"go_dreamfactory/comm"
|
"go_dreamfactory/comm"
|
||||||
|
"go_dreamfactory/lego/sys/mgo"
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
"go_dreamfactory/sys/configure"
|
"go_dreamfactory/sys/configure"
|
||||||
cfg "go_dreamfactory/sys/configure/structs"
|
cfg "go_dreamfactory/sys/configure/structs"
|
||||||
"go_dreamfactory/utils"
|
"go_dreamfactory/utils"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -28,9 +31,36 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.VikingGetListReq
|
|||||||
}
|
}
|
||||||
|
|
||||||
list, err := this.module.modelViking.getVikingList(session.GetUserId())
|
list, err := this.module.modelViking.getVikingList(session.GetUserId())
|
||||||
if err != nil {
|
if mgo.MongodbNil == err {
|
||||||
code = pb.ErrorCode_DBError
|
list = &pb.DBViking{
|
||||||
return
|
Id: primitive.NewObjectID().Hex(),
|
||||||
|
Uid: session.GetUserId(),
|
||||||
|
Boss: make(map[int32]int32),
|
||||||
|
BossTime: make(map[string]int32),
|
||||||
|
}
|
||||||
|
_cfg := this.module.configure.GetVikingBossTypeConfigData()
|
||||||
|
for k := range _cfg {
|
||||||
|
list.Boss[k] = 0
|
||||||
|
str := strconv.Itoa(int(k)) + "_1"
|
||||||
|
list.BossTime[str] = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
this.module.modelViking.Add(session.GetUserId(), list)
|
||||||
|
conf := this.module.configure.GetGlobalConf()
|
||||||
|
if conf == nil {
|
||||||
|
code = pb.ErrorCode_ConfigNoFound
|
||||||
|
return
|
||||||
|
}
|
||||||
|
iCont := conf.VikingNum
|
||||||
|
atn := conf.VikingExpeditionCos
|
||||||
|
if iCont > 0 {
|
||||||
|
|
||||||
|
this.module.DispenseRes(session, []*cfg.Gameatn{&cfg.Gameatn{
|
||||||
|
A: atn.A,
|
||||||
|
T: atn.T,
|
||||||
|
N: iCont,
|
||||||
|
}}, true)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 校验 是不是当天
|
// 校验 是不是当天
|
||||||
|
@ -3,10 +3,8 @@ package viking
|
|||||||
import (
|
import (
|
||||||
"go_dreamfactory/comm"
|
"go_dreamfactory/comm"
|
||||||
"go_dreamfactory/lego/core"
|
"go_dreamfactory/lego/core"
|
||||||
"go_dreamfactory/lego/sys/mgo"
|
|
||||||
"go_dreamfactory/modules"
|
"go_dreamfactory/modules"
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||||
"go.mongodb.org/mongo-driver/mongo"
|
"go.mongodb.org/mongo-driver/mongo"
|
||||||
@ -36,21 +34,11 @@ func (this *modelViking) getVikingList(uid string) (result *pb.DBViking, err err
|
|||||||
Boss: make(map[int32]int32),
|
Boss: make(map[int32]int32),
|
||||||
BossTime: make(map[string]int32),
|
BossTime: make(map[string]int32),
|
||||||
}
|
}
|
||||||
if err = this.Get(uid, result); err != nil && mgo.MongodbNil != err {
|
if err = this.Get(uid, result); err != nil {
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if mgo.MongodbNil == err {
|
|
||||||
if len(result.Boss) == 0 {
|
|
||||||
_cfg := this.module.configure.GetVikingBossTypeConfigData()
|
|
||||||
for k := range _cfg {
|
|
||||||
result.Boss[k] = 0
|
|
||||||
str := strconv.Itoa(int(k)) + "_1"
|
|
||||||
result.BossTime[str] = 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.Add(uid, result)
|
|
||||||
}
|
|
||||||
err = nil
|
err = nil
|
||||||
return result, err
|
return result, err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user