diff --git a/server/imserver/model/friend.go b/server/imserver/model/friend.go index dfbfeaad..62c9f01f 100644 --- a/server/imserver/model/friend.go +++ b/server/imserver/model/friend.go @@ -14,7 +14,7 @@ var Friend = new (friend) func (this *friend) Force(accountId1 string, accountId2 string, nowTime int64, cb func (error, int64, int64)) { - f5.GetJsStyleDb().Upsert( + f5.GetJsStyleDb().UpsertEx( constant.FRIEND_DB, "t_friend_relationship", [][]string{ @@ -33,7 +33,14 @@ func (this *friend) Force(accountId1 string, accountId2 string, nowTime int64, {"createtime", q5.ToString(nowTime)}, {"modifytime", q5.ToString(nowTime)}, }, - cb) + func (err error, lastInsertId int64, rowsAffected int64) { + cb(err, lastInsertId, rowsAffected) + this.updateAddFriendTask(accountId1, nowTime) + this.updateAddFriendTask(accountId2, nowTime) + }, + func (ds *f5.DataSet) bool { + return true + }) } func (this *friend) DeleteSoft(accountId1 string, accountId2 string, @@ -51,3 +58,26 @@ func (this *friend) DeleteSoft(accountId1 string, accountId2 string, }, cb) } + +func (this *friend) updateAddFriendTask(accountId string, nowTime int64) { + f5.GetJsStyleDb().Upsert( + constant.GAME_DB, + "t_rookie_task_value", + [][]string{ + {"account_id", accountId}, + {"task_type", "16"}, + }, + [][]string{ + {"!value", "value + 1"}, + {"modifytime", q5.ToString(nowTime)}, + }, + [][]string{ + {"account_id", accountId}, + {"task_type", "16"}, + {"value", "1"}, + {"createtime", q5.ToString(nowTime)}, + {"modifytime", q5.ToString(nowTime)}, + }, + func (err error, lastInsertId int64, rowsAffected int64) { + }) +} diff --git a/server/matchserver/history/historymgr.go b/server/matchserver/history/historymgr.go index fc910f9c..de715f83 100644 --- a/server/matchserver/history/historymgr.go +++ b/server/matchserver/history/historymgr.go @@ -56,7 +56,7 @@ func (this *historyMgr) PushLastBattleInfo(hum common.Player) { func (this *historyMgr) CanStart(accountId string, mapId int32, modeId int32) bool { u := this.getUser(accountId) - if u == nil && modeId == jccommon.MAP_MODE_CIRCUIT { + if u != nil && modeId == jccommon.MAP_MODE_CIRCUIT { key := q5.MkInt64(mapId, modeId) if startTime, ok := u.mapAndModeHash[key]; ok { nowTime := q5.ToInt32(f5.GetApp().GetRealSeconds())