diff --git a/data/activity.go b/data/activity.go index 89793e9..150c41b 100644 --- a/data/activity.go +++ b/data/activity.go @@ -143,8 +143,8 @@ func StatActivity(actLog *LogActivity, act Activity) (int64, error) { switch act.Type { case int32(pb.ACT_TYPE0): endTime := utils.TimestampTodayTime() - startTime := actLog.Jtime //参加开始时间 - if endTime.Sub(actLog.Jtime).Hours() > 7 * 24 { //参加超过7天,统计7日内 + startTime := actLog.Jtime //参加开始时间 + if endTime.Sub(actLog.Jtime).Hours() > 7*24 { //参加超过7天,统计7日内 startTime = endTime.AddDate(0, 0, -7) } q := bson.M{"agentid": actLog.Userid} @@ -166,8 +166,8 @@ func StatActivity(actLog *LogActivity, act Activity) (int64, error) { return 0, err } endTime := utils.TimestampTodayTime() - startTime := actLog.Jtime //参加开始时间 - if endTime.Sub(actLog.Jtime).Hours() > 30 * 24 { //参加超过30天,统计30日内 + startTime := actLog.Jtime //参加开始时间 + if endTime.Sub(actLog.Jtime).Hours() > 30*24 { //参加超过30天,统计30日内 startTime = endTime.AddDate(0, 0, -30) } q := bson.M{"agentid": bson.M{"$in": ids}} @@ -240,4 +240,4 @@ func getAgentChildsCount(q bson.M) (int64, error) { func GetLogActivityList(arg *pb.AgentActivityNotice) ([]*LogActivity, error) { q := bson.M{"actid": arg.GetActid(), "type": arg.GetType()} return getLogActivityList(int(arg.GetPage()), q) -} \ No newline at end of file +} diff --git a/data/lucky.go b/data/lucky.go index 6b99c73..ecf4545 100644 --- a/data/lucky.go +++ b/data/lucky.go @@ -9,7 +9,7 @@ import ( //Lucky 幸运星 type Lucky struct { ID string `bson:"_id" json:"id"` //unique ID - Luckyid int32 `bson:"luckyid" json:"luckyid"` //unique + Luckyid int32 `bson:"luckyid" json:"luckyid"` //unique Gtype int32 `bson:"gtype" json:"gtype"` //游戏类型1 niu,2 san,3 jiu Name string `bson:"name" json:"name"` //名称 Count uint32 `bson:"count" json:"count"` //任务数值 @@ -28,8 +28,8 @@ func GetLuckyList() []Lucky { //LuckyInfo 幸运星信息 type LuckyInfo struct { - Luckyid int32 `bson:"luckyid" json:"luckyid"` //unique - Num uint32 `bson:"num" json:"num"` //完成数值 + Luckyid int32 `bson:"luckyid" json:"luckyid"` //unique + Num uint32 `bson:"num" json:"num"` //完成数值 } //Save 写入数据库 diff --git a/data/task.go b/data/task.go index 6b71ab2..07fda16 100644 --- a/data/task.go +++ b/data/task.go @@ -40,4 +40,4 @@ type TaskInfo struct { func (t *Task) Save() bool { //t.Ctime = bson.Now() return Insert(Tasks, t) -} \ No newline at end of file +} diff --git a/dbms/role_agent.go b/dbms/role_agent.go index d89f9c0..28601bf 100644 --- a/dbms/role_agent.go +++ b/dbms/role_agent.go @@ -335,7 +335,7 @@ func (a *RoleActor) agentBuildUpdate(arg *pb.AgentBuildUpdate) { } handler.AgentBuildUpdate2(arg, user) //暂时实时写入, TODO 异步数据更新 //邀请每10人,奖励100豆子 - if arg.Build != 0 && (user.Build % 10 == 0) { + if arg.Build != 0 && (user.Build%10 == 0) { a.sendCurrency(user.GetUserid(), 0, 100, int32(pb.LOG_TYPE55)) //消息提醒 record, msg2 := handler.BuildNotice(100, user.Build, user.GetUserid()) @@ -469,7 +469,7 @@ func (a *RoleActor) agentOauth2Build(arg *pb.AgentOauth2Build, ctx actor.Context } msg2 := &pb.SetAgentBuild{ Userid: user.GetUserid(), - Agent: arg.GetAgentid(), + Agent: arg.GetAgentid(), } handler.SetAgentBuild(msg2, user) user.UpdateAgent() @@ -500,4 +500,4 @@ func (a *RoleActor) agentActivityProfit(arg *pb.AgentActivityProfit, ctx actor.C return } a.syncCurrency(0, arg.GetProfit(), 0, 0, arg.GetType(), arg.GetUserid()) -} \ No newline at end of file +} diff --git a/dbms/role_user.go b/dbms/role_user.go index 09a2337..3c83461 100644 --- a/dbms/role_user.go +++ b/dbms/role_user.go @@ -4,8 +4,8 @@ import ( "time" "gohappy/data" - "gohappy/game/login" "gohappy/game/handler" + "gohappy/game/login" "gohappy/glog" "gohappy/pb" "utils" @@ -642,7 +642,7 @@ func (a *RoleActor) luckyUpdate(arg *pb.LuckyUpdate) { } else { luckyInfo := data.LuckyInfo{ Luckyid: int32(arg.GetLuckyid()), - Num: arg.Num, + Num: arg.Num, } user.Lucky[luckyidStr] = luckyInfo } @@ -696,4 +696,4 @@ func (a *RoleActor) send2userid(userid string, msg interface{}) { if v, ok := a.roles[userid]; ok { v.Pid.Tell(msg) } -} \ No newline at end of file +} diff --git a/ebg/desk_coin.go b/ebg/desk_coin.go index 9636558..444cc38 100644 --- a/ebg/desk_coin.go +++ b/ebg/desk_coin.go @@ -617,47 +617,47 @@ func (t *Desk) deal() { //(通比牛牛 | 牛牛坐庄)前4张牌不广播 switch t.DeskData.Dtype { case int32(pb.DESK_TYPE3): //疯狂,抢庄 - hand = 1 - //发牌消息 - cards := make([]uint32, hand, hand) - copy(cards, t.DeskGame.Cards[:hand]) - t.DeskGame.Cards = t.DeskGame.Cards[hand:] - v.Cards = append(v.Cards, cards...) - switch t.state { - case int32(pb.STATE_DEALER): - //一明一暗 + hand = 1 + //发牌消息 + cards := make([]uint32, hand, hand) + copy(cards, t.DeskGame.Cards[:hand]) + t.DeskGame.Cards = t.DeskGame.Cards[hand:] + v.Cards = append(v.Cards, cards...) + switch t.state { + case int32(pb.STATE_DEALER): + //一明一暗 cards2 := make([]uint32, hand+1, hand+1) msg2 := resDraw(k, t.state, cards2) t.broadcast3(k, msg2) - //可看到自己牌值 + //可看到自己牌值 cards3 := append(v.Cards, 0) - msg := resDraw(k, t.state, cards3) - t.send2seat(k, msg) - case int32(pb.STATE_BET): - //可看到自己牌值 - msg := resDraw(k, t.state, v.Cards) - t.send2seat(k, msg) - } + msg := resDraw(k, t.state, cards3) + t.send2seat(k, msg) + case int32(pb.STATE_BET): + //可看到自己牌值 + msg := resDraw(k, t.state, v.Cards) + t.send2seat(k, msg) + } case int32(pb.DESK_TYPE2), // int32(pb.DESK_TYPE1), // int32(pb.DESK_TYPE0): //普通,随机庄、固定庄、轮流庄 - hand = 2 - switch t.state { - case int32(pb.STATE_DEALER): - //二暗,看不到牌值,发牌消息 - cards2 := make([]uint32, hand, hand) - msg2 := resDraw(k, t.state, cards2) - t.broadcast(msg2) - case int32(pb.STATE_BET): - //发牌 - cards := make([]uint32, hand, hand) - copy(cards, t.DeskGame.Cards[:hand]) - t.DeskGame.Cards = t.DeskGame.Cards[hand:] - v.Cards = append(v.Cards, cards...) - //自己可看到牌值 - msg := resDraw(k, t.state, cards) - t.send2seat(k, msg) - } + hand = 2 + switch t.state { + case int32(pb.STATE_DEALER): + //二暗,看不到牌值,发牌消息 + cards2 := make([]uint32, hand, hand) + msg2 := resDraw(k, t.state, cards2) + t.broadcast(msg2) + case int32(pb.STATE_BET): + //发牌 + cards := make([]uint32, hand, hand) + copy(cards, t.DeskGame.Cards[:hand]) + t.DeskGame.Cards = t.DeskGame.Cards[hand:] + v.Cards = append(v.Cards, cards...) + //自己可看到牌值 + msg := resDraw(k, t.state, cards) + t.send2seat(k, msg) + } } } } diff --git a/ebg/desk_ebg.go b/ebg/desk_ebg.go index 971638a..a1fbb12 100644 --- a/ebg/desk_ebg.go +++ b/ebg/desk_ebg.go @@ -9,11 +9,11 @@ package main import ( "gohappy/game/algo" + "gohappy/game/config" "gohappy/game/handler" "gohappy/glog" "gohappy/pb" "utils" - "gohappy/game/config" ) //'进入房间响应消息 @@ -603,7 +603,7 @@ func (t *Desk) pailiOver1(score map[uint32]int64) map[uint32]int64 { case v.Power == a: //麻将牌:庄家跟闲家为0点时闲家赢,否则庄家赢 if a != algo.EBG0 { - //if t.pailiCompare(dealerSeat, k) { + //if t.pailiCompare(dealerSeat, k) { val := int64(v.Bet * int64(algo.EbgMultiple(t.DeskData.Mode, a)) * ante) score = t.over3(dealerSeat, k, val, score) } else { @@ -646,7 +646,7 @@ func (t *Desk) pailiOver3(score map[uint32]int64) (uint32, map[uint32]int64) { case v == val: //麻将牌:庄家跟闲家为0点时闲家赢,否则庄家赢 if val == algo.EBG0 { - //if !t.pailiCompare(seat, a[0]) { + //if !t.pailiCompare(seat, a[0]) { seat = a[0] val = v } @@ -871,7 +871,7 @@ func (t *Desk) powerAward() { } var num = t.DeskData.Ante switch v.Power { - case algo.EBG10, algo.EBGDui, algo.BAIBAN: + case algo.EBG10, algo.EBGDui, algo.BAIBAN: num += algo.EbgMultiple(t.DeskData.Mode, v.Power) default: continue diff --git a/game/config/activity.go b/game/config/activity.go index 74f2d54..edce9be 100644 --- a/game/config/activity.go +++ b/game/config/activity.go @@ -116,4 +116,4 @@ func GetActivity1(id string) data.Activity { } } return data.Activity{} -} \ No newline at end of file +} diff --git a/game/handler/activity.go b/game/handler/activity.go index c21c4e6..430f288 100644 --- a/game/handler/activity.go +++ b/game/handler/activity.go @@ -2,20 +2,21 @@ package handler import ( "errors" + "time" "gohappy/data" "gohappy/game/config" "gohappy/glog" "gohappy/pb" "utils" - "time" + "github.com/globalsign/mgo/bson" ) func packLogActivityMsg(v *data.LogActivity) (msg *pb.Activity) { msg = &pb.Activity{ - Id: v.Actid, - JoinTime: utils.Time2LocalStr(v.Jtime), + Id: v.Actid, + JoinTime: utils.Time2LocalStr(v.Jtime), } switch v.Type { case int32(pb.ACT_TYPE0): @@ -91,9 +92,9 @@ func JoinActivity(arg *pb.CJoinActivity) (msg *pb.SJoinActivity) { return } joinAct := &data.LogActivity{ - Actid: act.Id, - Type: act.Type, - Etime: act.EndTime, + Actid: act.Id, + Type: act.Type, + Etime: act.EndTime, Userid: arg.GetSelfid(), } if joinAct.Has() { @@ -181,10 +182,10 @@ func statActivityMsg(userid, actid, title string, Type int32, msg = &pb.AgentActivityProfit{ Userid: userid, Profit: profit, - Type: Type, - Actid: actid, - Title: title, - Num: num, + Type: Type, + Actid: actid, + Title: title, + Num: num, } return } @@ -193,16 +194,15 @@ func statActivityMsg(userid, actid, title string, Type int32, func StatActivityUpdate(arg *pb.AgentActivityProfit) { d := &data.LogActivity{ Userid: arg.GetUserid(), - Actid: arg.GetActid(), - Prize: arg.GetProfit(), - Num: arg.GetNum(), + Actid: arg.GetActid(), + Prize: arg.GetProfit(), + Num: arg.GetNum(), } if !d.Update() { glog.Errorf("StatActivityUpdate filed %#v", d) } } - //SetActivityList 配置活动数据,测试数据 func SetActivityList() { var startTime, endTime time.Time @@ -219,13 +219,13 @@ func SetActivityList() { func NewActivity(Type int32, title, content string, startTime, endTime time.Time) { t := data.Activity{ //Id: bson.NewObjectId().String(), - Id: data.ObjectIdString(bson.NewObjectId()), - Ctime: bson.Now(), - Type: Type, - Title: title, - Content: content, + Id: data.ObjectIdString(bson.NewObjectId()), + Ctime: bson.Now(), + Type: Type, + Title: title, + Content: content, StartTime: startTime, - EndTime: endTime, + EndTime: endTime, } config.SetActivity(t) t.Save() @@ -245,4 +245,4 @@ func NoticeActivity(arg *pb.AgentActivityNotice) (recordList []*pb.LogNotice, msgList = append(msgList, msg) } return -} \ No newline at end of file +} diff --git a/game/handler/agent.go b/game/handler/agent.go index 9b0fe21..621024c 100644 --- a/game/handler/agent.go +++ b/game/handler/agent.go @@ -9,8 +9,8 @@ import ( "gohappy/pb" "utils" - jsoniter "github.com/json-iterator/go" "github.com/globalsign/mgo/bson" + jsoniter "github.com/json-iterator/go" ) //PackAgentProfitRankMsg 获取排行榜信息 @@ -289,8 +289,8 @@ func PackAgentDayProfitMsg(arg *pb.CAgentDayProfit) (msg *pb.SAgentDayProfit) { glog.Debugf("PackAgentProfitMsg list %#v", list) for _, v := range list { msg2 := new(pb.AgentDayProfitDetail) - msg2.Userid = v.Userid //代理id - msg2.Profit = v.Profit //收益 + msg2.Userid = v.Userid //代理id + msg2.Profit = v.Profit //收益 msg2.Day = uint32(v.Day) //日期20180728 msg2.Agentnote = v.AgentNote msg2.Nickname = v.Nickname @@ -479,15 +479,15 @@ func agentTitle(AgentLevel, AgentState uint32, Agent string, ProfitRate int64) i func AgentProfitInfoMsg(userid, nickname, agentnote, agentid string, agent bool, gtype int32, level, rate uint32, profit int64) (msg *pb.AgentProfitInfo) { msg = &pb.AgentProfitInfo{ - Userid: userid, - Agentid: agentid, - Gtype: gtype, - Level: level, - Rate: rate, - Profit: profit, - Agent: agent, - Nickname: nickname, - Agentnote:agentnote, + Userid: userid, + Agentid: agentid, + Gtype: gtype, + Level: level, + Rate: rate, + Profit: profit, + Agent: agent, + Nickname: nickname, + Agentnote: agentnote, } return } @@ -496,15 +496,15 @@ func AgentProfitInfoMsg(userid, nickname, agentnote, agentid string, agent bool, func AgentProfitMonthInfoMsg(userid, nickname, agentnote, agentid string, agent bool, gtype int32, level, rate uint32, profit int64) (msg *pb.AgentProfitMonthInfo) { msg = &pb.AgentProfitMonthInfo{ - Userid: userid, - Agentid: agentid, - Gtype: gtype, - Level: level, - Rate: rate, - Profit: profit, - Agent: agent, - Nickname: nickname, - Agentnote:agentnote, + Userid: userid, + Agentid: agentid, + Gtype: gtype, + Level: level, + Rate: rate, + Profit: profit, + Agent: agent, + Nickname: nickname, + Agentnote: agentnote, } return } @@ -553,13 +553,13 @@ func AgentProfitMonthSendCheck(user *data.User) (msg3 *pb.LogProfit, msg5 *pb.Ag func agentProfitMonthSendCheck2(user *data.User) (msg3 *pb.LogProfit, msg5 *pb.AgentProfitMonthSend) { if user.GetMonth() == int(utils.Month()) { - //if user.GetMonth() == int(utils.Day()) { //TODO test + //if user.GetMonth() == int(utils.Day()) { //TODO test return } //发放消息 msg5 = &pb.AgentProfitMonthSend{ Userid: user.GetUserid(), - Profit: user.GetProfitMonth(),//为0时依然发送 + Profit: user.GetProfitMonth(), //为0时依然发送 Month: int32(user.GetMonth()), } AgentProfitMonthSend(msg5, user) @@ -627,7 +627,7 @@ func AddProfit(arg *pb.AgentProfitInfo, user *data.User) (msg1 *pb.AgentProfitIn Userid: user.GetUserid(), Profit: profit, Isagent: arg.Agent, - Level: arg.GetLevel(), + Level: arg.GetLevel(), } } if user.GetAgent() == "" { @@ -638,7 +638,7 @@ func AddProfit(arg *pb.AgentProfitInfo, user *data.User) (msg1 *pb.AgentProfitIn } //反给上级消息 msg1 = AgentProfitInfoMsg(user.GetUserid(), user.GetNickname(), user.GetAgentNote(), - user.GetAgent(),false, arg.Gtype, arg.Level+1, 0, arg.Profit) //level表示相对当前代理的等级,不是user.AgentLevel + user.GetAgent(), false, arg.Gtype, arg.Level+1, 0, arg.Profit) //level表示相对当前代理的等级,不是user.AgentLevel if IsAgent(user) { msg1.Agent = true } @@ -784,12 +784,12 @@ func SetAgentState(arg *pb.SetAgentState, user *data.User) { //GetAgentMsg 获取代理信息 func GetAgentMsg(user *data.User) (msg *pb.SGetAgent) { msg = &pb.SGetAgent{ - Agentid: user.GetUserid(), - Nickname: user.GetNickname(), + Agentid: user.GetUserid(), + Nickname: user.GetNickname(), Agentname: user.AgentName, - Realname: user.RealName, - Weixin: user.Weixin, - Vaild: IsVaild(user), + Realname: user.RealName, + Weixin: user.Weixin, + Vaild: IsVaild(user), } return -} \ No newline at end of file +} diff --git a/game/handler/logger.go b/game/handler/logger.go index 7b13646..ef7319a 100644 --- a/game/handler/logger.go +++ b/game/handler/logger.go @@ -211,17 +211,17 @@ func RoleRecordMsg(msg *data.RoleRecord) *pb.RoleRecord { //LogProfitMsg 打包收益日志消息 func LogProfitMsg(agentid, userid, nickname, agentnote string, - gtype, rtype int32, level, rate uint32, profit int64) (msg *pb.LogProfit) { + gtype, rtype int32, level, rate uint32, profit int64) (msg *pb.LogProfit) { msg = &pb.LogProfit{ - Agentid: agentid, - Userid: userid, - Gtype: gtype, - Level: level, - Rate: rate, - Profit: profit, - Type: rtype, + Agentid: agentid, + Userid: userid, + Gtype: gtype, + Level: level, + Rate: rate, + Profit: profit, + Type: rtype, Agentnote: agentnote, - Nickname: nickname, + Nickname: nickname, } return } diff --git a/game/handler/lucky.go b/game/handler/lucky.go index 0520b6a..e7b6df5 100644 --- a/game/handler/lucky.go +++ b/game/handler/lucky.go @@ -38,7 +38,7 @@ func NewLucky(luckyid, gtype int32, name string, count uint32, //ID: bson.NewObjectId().String(), ID: data.ObjectIdString(bson.NewObjectId()), Ctime: bson.Now(), - Luckyid: luckyid, + Luckyid: luckyid, Name: name, Gtype: gtype, Count: count, diff --git a/game/handler/notice.go b/game/handler/notice.go index 04cff0e..5c60ca6 100644 --- a/game/handler/notice.go +++ b/game/handler/notice.go @@ -36,10 +36,10 @@ func PackNotice(msg *pb.SNotice) { func packNoticeMsg(v *data.Notice) (msg *pb.Notice) { msg = &pb.Notice{ - Rtype: int32(v.Rtype), - Acttype: int32(v.Acttype), - Content: v.Content, - Time: utils.Time2LocalStr(v.Ctime), + Rtype: int32(v.Rtype), + Acttype: int32(v.Acttype), + Content: v.Content, + Time: utils.Time2LocalStr(v.Ctime), ExpireTime: utils.Time2LocalStr(v.Etime), } return @@ -176,4 +176,4 @@ func TaskNotice(coin int64, name, userid string) (record *pb.LogNotice, } content := fmt.Sprintf("恭喜你完成任务%s获得%d金豆", name, coin) return NewNotice(data.NOTICE_TYPE3, 0, userid, content) -} \ No newline at end of file +} diff --git a/game/handler/task.go b/game/handler/task.go index 19b5f50..b217b8d 100644 --- a/game/handler/task.go +++ b/game/handler/task.go @@ -119,7 +119,7 @@ func NewTask(taskid, taskType, nextid int32, name string, count uint32, Name: name, Count: count, Diamond: diamond, - Coin: coin, + Coin: coin, } config.SetTask(t) t.Save() diff --git a/gate/rs_handler_agent.go b/gate/rs_handler_agent.go index bb34e57..143284d 100644 --- a/gate/rs_handler_agent.go +++ b/gate/rs_handler_agent.go @@ -213,9 +213,9 @@ func (rs *RoleActor) agentProfitNum(arg *pb.AgentProfitNum) { } //发送消息给代理 msg2 := handler.AgentProfitInfoMsg(rs.User.GetUserid(), rs.User.GetNickname(), rs.User.GetAgentNote(), - rs.User.GetAgent(),false, arg.Gtype, 1, 0, rest) //level表示相对当前代理的等级,不是rs.User.AgentLevel + rs.User.GetAgent(), false, arg.Gtype, 1, 0, rest) //level表示相对当前代理的等级,不是rs.User.AgentLevel msg3 := handler.AgentProfitMonthInfoMsg(rs.User.GetUserid(), rs.User.GetNickname(), rs.User.GetAgentNote(), - rs.User.GetAgent(),false, arg.Gtype, 1, 0, rest) //level表示相对当前代理的等级,不是rs.User.AgentLevel + rs.User.GetAgent(), false, arg.Gtype, 1, 0, rest) //level表示相对当前代理的等级,不是rs.User.AgentLevel if handler.IsAgent(rs.User) { msg2.Agent = true msg3.Agent = true @@ -431,8 +431,8 @@ func (rs *RoleActor) agentProfitApply(arg *pb.CAgentProfitApply, ctx actor.Conte Userid: rs.User.GetUserid(), //申请人玩家id Nickname: rs.User.GetNickname(), //玩家昵称 //Profit: int64(profit), //提取金额 - Profit: rs.User.GetProfit(), - ProfitFirst: rs.User.GetProfitFirst(), + Profit: rs.User.GetProfit(), + ProfitFirst: rs.User.GetProfitFirst(), ProfitSecond: rs.User.GetProfitSecond(), } res1 := rs.reqRole(msg, ctx) @@ -641,10 +641,10 @@ func (rs *RoleActor) agentProfitManage2(arg *pb.SAgentProfitManage, ctx actor.Co list := make([]*pb.AgentProfitManage, 0) msg2 := &pb.AgentProfitManage{ AgentTitle: handler.GetAgentTitle(rs.User), - Agentid: rs.User.GetUserid(), - Nickname: rs.User.GetNickname(), - Agentnote: rs.User.AgentNote, - Rate: rs.User.ProfitRate, + Agentid: rs.User.GetUserid(), + Nickname: rs.User.GetNickname(), + Agentnote: rs.User.AgentNote, + Rate: rs.User.ProfitRate, } for _, v := range arg.List { if v.GetAgentTitle() == 4 || v.GetAgentid() == rs.User.GetUserid() { @@ -658,4 +658,4 @@ func (rs *RoleActor) agentProfitManage2(arg *pb.SAgentProfitManage, ctx actor.Co } arg.List = list rs.Send(arg) -} \ No newline at end of file +} diff --git a/gate/rs_handler_desk.go b/gate/rs_handler_desk.go index ee5c654..f9eebb0 100644 --- a/gate/rs_handler_desk.go +++ b/gate/rs_handler_desk.go @@ -1,11 +1,11 @@ package main import ( + "gohappy/game/handler" "gohappy/glog" "gohappy/pb" "github.com/AsynkronIT/protoactor-go/actor" - "gohappy/game/handler" ) //玩家桌子常用共有操作请求处理 @@ -36,7 +36,7 @@ func (rs *RoleActor) handlerDesk(msg interface{}, ctx actor.Context) { rs.status = true rs.User.SetRecord(arg.Rtype) } - if rs.User.GetAgent() != "" && (rs.User.Win + rs.User.Lost + rs.User.Ping) == 10 { + if rs.User.GetAgent() != "" && (rs.User.Win+rs.User.Lost+rs.User.Ping) == 10 { //更新有效代理绑定 msg := handler.AgentBuildUpdateMsg(rs.User.GetAgent(), rs.User.GetUserid(), 0, 1, 0) rs.rolePid.Tell(msg) @@ -389,14 +389,14 @@ func (rs *RoleActor) matchedDeskErr(msg *pb.MatchedDesk, ctx actor.Context) { func (rs *RoleActor) createdDesk(arg *pb.CreatedDesk, ctx actor.Context) { if arg.Error != pb.OK { glog.Errorf("created desk filed arg %#v", arg) - rs.createdDeskMsg(arg.Gtype, arg.Error) + rs.createdDeskMsg(arg.Gtype, arg.Error) return } msg := new(pb.EnterDesk) msg.Gtype = arg.Gtype msg.Rtype = arg.Rtype if !rs.enterDeskMsg(msg, ctx) || arg.Desk == nil { - rs.createdDeskMsg(arg.Gtype, arg.Error) + rs.createdDeskMsg(arg.Gtype, arg.Error) return } arg.Desk.Request(msg, ctx.Self()) @@ -404,26 +404,26 @@ func (rs *RoleActor) createdDesk(arg *pb.CreatedDesk, ctx actor.Context) { //失败消息 func (rs *RoleActor) createdDeskMsg(Gtype int32, errcode pb.ErrCode) { - switch Gtype { - case int32(pb.NIU): - rsp := new(pb.SNNCreateRoom) - rsp.Error = pb.CreateRoomFail - rs.Send(rsp) - case int32(pb.SAN): - rsp := new(pb.SSGCreateRoom) - rsp.Error = pb.CreateRoomFail - rs.Send(rsp) - case int32(pb.HUA): - rsp := new(pb.SJHCreateRoom) - rsp.Error = pb.CreateRoomFail - rs.Send(rsp) - case int32(pb.EBG): - rsp := new(pb.SEBCreateRoom) - rsp.Error = pb.CreateRoomFail - rs.Send(rsp) - default: - glog.Errorf("matched DeskErr fail %d, %d", Gtype, errcode) - } + switch Gtype { + case int32(pb.NIU): + rsp := new(pb.SNNCreateRoom) + rsp.Error = pb.CreateRoomFail + rs.Send(rsp) + case int32(pb.SAN): + rsp := new(pb.SSGCreateRoom) + rsp.Error = pb.CreateRoomFail + rs.Send(rsp) + case int32(pb.HUA): + rsp := new(pb.SJHCreateRoom) + rsp.Error = pb.CreateRoomFail + rs.Send(rsp) + case int32(pb.EBG): + rsp := new(pb.SEBCreateRoom) + rsp.Error = pb.CreateRoomFail + rs.Send(rsp) + default: + glog.Errorf("matched DeskErr fail %d, %d", Gtype, errcode) + } } //换房间结果 diff --git a/gate/rs_handler_login.go b/gate/rs_handler_login.go index 7ce1a0a..2a0e1a2 100644 --- a/gate/rs_handler_login.go +++ b/gate/rs_handler_login.go @@ -5,9 +5,9 @@ import ( "gohappy/data" "gohappy/game/config" + "gohappy/game/handler" "gohappy/glog" "gohappy/pb" - "gohappy/game/handler" "utils" "github.com/AsynkronIT/protoactor-go/actor" diff --git a/gate/rs_handler_user.go b/gate/rs_handler_user.go index 5ca2641..9fe73bf 100644 --- a/gate/rs_handler_user.go +++ b/gate/rs_handler_user.go @@ -323,7 +323,7 @@ func (rs *RoleActor) bank(arg *pb.CBank) { msg.Error = pb.BankNotOpen } else if arg.GetPassword() != rs.User.BankPassword { msg.Error = pb.PwdError - //} else if amount > rs.User.GetBank() { + //} else if amount > rs.User.GetBank() { } else if amount > rs.User.GetCoin() { //修改成赠送bank外面的 msg.Error = pb.NotEnoughCoin } else if amount < data.DRAW_MONEY { @@ -612,7 +612,7 @@ func (rs *RoleActor) lucky() { list := config.GetLuckys() for _, v := range list { msg2 := &pb.Lucky{ - Luckyid: v.Luckyid, + Luckyid: v.Luckyid, Name: v.Name, Count: v.Count, Coin: v.Coin, @@ -660,7 +660,7 @@ func (rs *RoleActor) luckyUpdate(arg *pb.LuckyUpdate) { } else { luckyInfo := data.LuckyInfo{ Luckyid: arg.GetLuckyid(), - Num: arg.Num, + Num: arg.Num, } rs.User.Lucky[luckyidStr] = luckyInfo } diff --git a/niu/desk_coin.go b/niu/desk_coin.go index de14d59..33254c1 100644 --- a/niu/desk_coin.go +++ b/niu/desk_coin.go @@ -236,7 +236,7 @@ func (t *Desk) getCardsMsg(k uint32, msg2 *pb.NNRoomUser) { msg2.Cards = t.getHandCards(k) case int32(pb.DESK_TYPE1): //通比牛牛 switch t.DeskData.Mode { - case 0://普通 + case 0: //普通 switch t.state { case int32(pb.STATE_DEALER): case int32(pb.STATE_BET), int32(pb.STATE_NIU): @@ -639,7 +639,7 @@ func (t *Desk) deal() { t.send2seat(k, msg) case int32(pb.DESK_TYPE1): //通比牛牛 switch t.DeskData.Mode { - case 0://普通 + case 0: //普通 t.deal2(k, hand, v.Cards) default: t.deal3(k, hand, cards) diff --git a/niu/desk_niu.go b/niu/desk_niu.go index ed73079..2ead1fa 100644 --- a/niu/desk_niu.go +++ b/niu/desk_niu.go @@ -9,11 +9,11 @@ package main import ( "gohappy/game/algo" + "gohappy/game/config" "gohappy/game/handler" "gohappy/glog" "gohappy/pb" "utils" - "gohappy/game/config" ) //'进入房间响应消息 @@ -873,10 +873,10 @@ func (t *Desk) powerAward() { } t.sendCoin(v.Userid, int64(num), int32(pb.LOG_TYPE51)) msg := &pb.SNNPushAward{ - Power: v.Power, - Seat: k, - Userid: v.Userid, - Coin: int64(num), + Power: v.Power, + Seat: k, + Userid: v.Userid, + Coin: int64(num), } t.broadcast(msg) luckyid := int32(v.Power) * t.DeskData.Gtype * 10 diff --git a/robot/recv.go b/robot/recv.go index 42607be..01eb77e 100644 --- a/robot/recv.go +++ b/robot/recv.go @@ -393,7 +393,7 @@ func (r *Robot) recvNNFreeStart(s2c *pb.SNNFreeGamestart) { func (r *Robot) recvNNReady(s2c *pb.SNNReady) { if s2c.GetSeat() == r.seat { r.ready = s2c.GetReady() - } else if !r.ready { + } else if !r.ready { r.sendNNReady() } } @@ -508,7 +508,7 @@ func (r *Robot) recvEBFreeStart(s2c *pb.SEBFreeGamestart) { func (r *Robot) recvEBReady(s2c *pb.SEBReady) { if s2c.GetSeat() == r.seat { r.ready = s2c.GetReady() - } else if !r.ready { + } else if !r.ready { r.sendEBReady() } } @@ -528,8 +528,8 @@ func (r *Robot) recvEBDealer(s2c *pb.SEBDealer) { //庄家 func (r *Robot) recvEBPushDealer(s2c *pb.SEBPushDealer) { } -//. +//. //' 进入房间 func (r *Robot) recvEBFreeEnter(s2c *pb.SEBFreeEnterRoom) { diff --git a/san/desk_coin.go b/san/desk_coin.go index fad3432..1b79a60 100644 --- a/san/desk_coin.go +++ b/san/desk_coin.go @@ -304,7 +304,7 @@ func (t *Desk) gameStart() { case int32(pb.DESK_TYPE1): //通比牛牛 t.dealerHandler() switch t.DeskData.Mode { - case 0://普通 + case 0: //普通 t.betTimeout() //去掉下注流程 default: } diff --git a/san/desk_respond.go b/san/desk_respond.go index 0a9919e..726b9ca 100644 --- a/san/desk_respond.go +++ b/san/desk_respond.go @@ -95,7 +95,7 @@ func (t *Desk) chatEmoji(userid, context string) pb.ErrCode { } } //TODO 货币变更消息广播 - t.sendDiamond(userid, -1 * num, int32(pb.LOG_TYPE50)) + t.sendDiamond(userid, -1*num, int32(pb.LOG_TYPE50)) return pb.OK } diff --git a/san/desk_san.go b/san/desk_san.go index 9dbf26a..e9137ca 100644 --- a/san/desk_san.go +++ b/san/desk_san.go @@ -9,11 +9,11 @@ package main import ( "gohappy/game/algo" + "gohappy/game/config" "gohappy/game/handler" "gohappy/glog" "gohappy/pb" "utils" - "gohappy/game/config" ) //'进入房间响应消息