Merge branch 'dev' of git.kingsome.cn:server/game2006go into dev

This commit is contained in:
yangduo 2024-10-17 14:44:17 +08:00
commit 3b1bbffc6c
2 changed files with 33 additions and 3 deletions

View File

@ -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) {
})
}

View File

@ -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())