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
|
||||
return
|
||||
}
|
||||
iCont := conf.EnchantbossInitial
|
||||
atn := conf.EnchantbossCos
|
||||
iCont := conf.HuntingNum
|
||||
atn := conf.HuntingCos
|
||||
if iCont > 0 {
|
||||
|
||||
this.module.DispenseRes(session, []*cfg.Gameatn{&cfg.Gameatn{
|
||||
|
@ -2,11 +2,14 @@ package viking
|
||||
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/lego/sys/mgo"
|
||||
"go_dreamfactory/pb"
|
||||
"go_dreamfactory/sys/configure"
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
"go_dreamfactory/utils"
|
||||
"strconv"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
@ -28,10 +31,37 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.VikingGetListReq
|
||||
}
|
||||
|
||||
list, err := this.module.modelViking.getVikingList(session.GetUserId())
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
if mgo.MongodbNil == err {
|
||||
list = &pb.DBViking{
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
// 校验 是不是当天
|
||||
if !utils.IsToday(list.CTime) {
|
||||
|
@ -3,10 +3,8 @@ package viking
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/lego/core"
|
||||
"go_dreamfactory/lego/sys/mgo"
|
||||
"go_dreamfactory/modules"
|
||||
"go_dreamfactory/pb"
|
||||
"strconv"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
"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),
|
||||
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
|
||||
}
|
||||
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
|
||||
return result, err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user