上传db保护代码
This commit is contained in:
parent
df28036e54
commit
0c5a38f403
@ -68,11 +68,19 @@ func (this *Battle) QueryBattleRecord(oid string) (code pb.ErrorCode, record *pb
|
|||||||
|
|
||||||
//创建pve战斗
|
//创建pve战斗
|
||||||
func (this *Battle) CreatePveBattle(session comm.IUserSession, req *pb.BattlePVEReq) (code pb.ErrorCode, record *pb.DBBattleRecord) {
|
func (this *Battle) CreatePveBattle(session comm.IUserSession, req *pb.BattlePVEReq) (code pb.ErrorCode, record *pb.DBBattleRecord) {
|
||||||
var conn *db.DBConn
|
var (
|
||||||
|
conn *db.DBConn
|
||||||
|
err error
|
||||||
|
)
|
||||||
if this.service.GetTag() == session.GetServiecTag() {
|
if this.service.GetTag() == session.GetServiecTag() {
|
||||||
conn = db.Local()
|
conn, err = db.Local()
|
||||||
} else {
|
} else {
|
||||||
conn = db.ServerDBConn(session.GetServiecTag())
|
conn, err = db.ServerDBConn(session.GetServiecTag())
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
code = pb.ErrorCode_DBError
|
||||||
|
this.Errorf("session:%v err:", session, err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
if req.Ptype < 0 || req.Ptype > 4 ||
|
if req.Ptype < 0 || req.Ptype > 4 ||
|
||||||
req.Teamids == nil || len(req.Teamids) != 5 {
|
req.Teamids == nil || len(req.Teamids) != 5 {
|
||||||
@ -87,11 +95,19 @@ func (this *Battle) CreatePveBattle(session comm.IUserSession, req *pb.BattlePVE
|
|||||||
|
|
||||||
//创建pve战斗
|
//创建pve战斗
|
||||||
func (this *Battle) CreatePvbBattle(session comm.IUserSession, req *pb.BattlePVEReq) (code pb.ErrorCode, record *pb.DBBattleRecord) {
|
func (this *Battle) CreatePvbBattle(session comm.IUserSession, req *pb.BattlePVEReq) (code pb.ErrorCode, record *pb.DBBattleRecord) {
|
||||||
var conn *db.DBConn
|
var (
|
||||||
|
conn *db.DBConn
|
||||||
|
err error
|
||||||
|
)
|
||||||
if this.service.GetTag() == session.GetServiecTag() {
|
if this.service.GetTag() == session.GetServiecTag() {
|
||||||
conn = db.Local()
|
conn, err = db.Local()
|
||||||
} else {
|
} else {
|
||||||
conn = db.ServerDBConn(session.GetServiecTag())
|
conn, err = db.ServerDBConn(session.GetServiecTag())
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
code = pb.ErrorCode_DBError
|
||||||
|
this.Errorf("session:%v err:", session, err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
if req.Ptype < 0 || req.Ptype > 4 ||
|
if req.Ptype < 0 || req.Ptype > 4 ||
|
||||||
req.Teamids == nil || len(req.Teamids) != 5 {
|
req.Teamids == nil || len(req.Teamids) != 5 {
|
||||||
|
@ -125,10 +125,15 @@ func (this *modelForumComp) like(heroid, id string, islike bool) (comment *pb.DB
|
|||||||
|
|
||||||
//查看
|
//查看
|
||||||
func (this *modelForumComp) watchHero(stage string, uid string, herocid string) (hero *pb.DBHero, err error) {
|
func (this *modelForumComp) watchHero(stage string, uid string, herocid string) (hero *pb.DBHero, err error) {
|
||||||
tcoon := db.ServerDBConn(stage)
|
|
||||||
var (
|
var (
|
||||||
c *mongo.Cursor
|
tcoon *db.DBConn
|
||||||
|
c *mongo.Cursor
|
||||||
)
|
)
|
||||||
|
if tcoon, err = db.ServerDBConn(stage); err != nil {
|
||||||
|
this.module.Errorf("stage:%s err:%v", stage, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
if c, err = tcoon.Mgo.Find(comm.TableHero, bson.M{"uid": uid, "heroID": herocid}); err != nil {
|
if c, err = tcoon.Mgo.Find(comm.TableHero, bson.M{"uid": uid, "heroID": herocid}); err != nil {
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user