三消异常处理

This commit is contained in:
meixiongfeng 2023-12-01 09:20:30 +08:00
parent c8927cde3d
commit cf64fd4877
2 changed files with 18 additions and 13 deletions

View File

@ -1,6 +1,8 @@
package entertainment
import (
"errors"
"fmt"
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
@ -43,6 +45,8 @@ func (this *modelComp) getEntertainmList(uid string) (result *pb.DBXXLData, err
if conn, err := db.ServerDBConn(tag); err == nil {
dbModel = db.NewDBModel(comm.TableEntertainm, conn)
}
} else {
err = errors.New(fmt.Sprintf("split uid err: %s", uid))
}
}
if dbModel == nil {

View File

@ -565,22 +565,23 @@ func (this *Room) GameOver() (errdata *pb.ErrorData) {
}
}
// 查看能不能获得箱子
if list, err := this.module.model.getEntertainmList(winner.Userinfo.Uid); err == nil {
if len(list.Box) < 3 { // 可以获得一个宝箱
if c, err := this.module.configure.GetGameRandomConsumeBoxConf(); err == nil {
if c.Color != 0 {
box = &pb.BoxData{
Boxid: c.Boxid,
Opentime: int64(c.Cd) + configure.Now().Unix(),
}
list.Box = append(list.Box, box)
if winner.Userinfo.Uid != "999" {
if list, err := this.module.model.getEntertainmList(winner.Userinfo.Uid); err == nil {
if len(list.Box) < 3 { // 可以获得一个宝箱
if c, err := this.module.configure.GetGameRandomConsumeBoxConf(); err == nil {
if c.Color != 0 {
box = &pb.BoxData{
Boxid: c.Boxid,
Opentime: int64(c.Cd) + configure.Now().Unix(),
}
list.Box = append(list.Box, box)
this.module.model.modifyEntertainmList(winner.Userinfo.Uid, map[string]interface{}{
"box": list.Box,
})
this.module.model.modifyEntertainmList(winner.Userinfo.Uid, map[string]interface{}{
"box": list.Box,
})
}
}
}
}
}