1
This commit is contained in:
parent
1386cdfc66
commit
6c39f8b684
@ -178,6 +178,38 @@ func (this *friendMgr) AsyncGetApplyList(lastIdx int64, accountId string, cb fun
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *friendMgr) AsyncAddFriend(senderId string, targetId string, cb func(int32, string)) {
|
func (this *friendMgr) AsyncAddFriend(senderId string, targetId string, cb func(int32, string)) {
|
||||||
|
if this.IsFriend(senderId, targetId) {
|
||||||
|
cb(0, "")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
nowTime := f5.GetApp().GetNowSeconds()
|
||||||
|
f5.GetJsStyleDb().Upsert(
|
||||||
|
constant.FRIEND_DB,
|
||||||
|
"t_friend_apply",
|
||||||
|
[][]string{
|
||||||
|
{"sender_id", senderId},
|
||||||
|
{"target_id", targetId},
|
||||||
|
},
|
||||||
|
[][]string{
|
||||||
|
{"status", q5.ToString(0)},
|
||||||
|
{"last_apply_time", q5.ToString(nowTime)},
|
||||||
|
},
|
||||||
|
[][]string{
|
||||||
|
{"sender_id", senderId},
|
||||||
|
{"target_id", targetId},
|
||||||
|
{"status", q5.ToString(0)},
|
||||||
|
{"last_apply_time", q5.ToString(nowTime)},
|
||||||
|
{"createtime", q5.ToString(nowTime)},
|
||||||
|
{"modifytime", q5.ToString(nowTime)},
|
||||||
|
},
|
||||||
|
func (err error, lastInsertId int64, rowsAffected int64) {
|
||||||
|
if err != nil {
|
||||||
|
cb(1, "")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.asyncSetApplyStatus(senderId, targetId, 1)
|
||||||
|
cb(0, "")
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *friendMgr) AsyncAccpetApply(senderId string, targetId string, cb func(int32, string)) {
|
func (this *friendMgr) AsyncAccpetApply(senderId string, targetId string, cb func(int32, string)) {
|
||||||
@ -185,6 +217,7 @@ func (this *friendMgr) AsyncAccpetApply(senderId string, targetId string, cb fun
|
|||||||
cb(1, "")
|
cb(1, "")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
accountId1, accountId2 := this.sortAccounts(senderId, targetId)
|
||||||
queryCb := func () {
|
queryCb := func () {
|
||||||
if this.IsFriend(senderId, targetId) {
|
if this.IsFriend(senderId, targetId) {
|
||||||
this.asyncSetApplyStatus(senderId, targetId, 1)
|
this.asyncSetApplyStatus(senderId, targetId, 1)
|
||||||
@ -192,7 +225,6 @@ func (this *friendMgr) AsyncAccpetApply(senderId string, targetId string, cb fun
|
|||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
nowTime := f5.GetApp().GetNowSeconds()
|
nowTime := f5.GetApp().GetNowSeconds()
|
||||||
accountId1, accountId2 := this.sortAccounts(senderId, targetId)
|
|
||||||
f5.GetJsStyleDb().Upsert(
|
f5.GetJsStyleDb().Upsert(
|
||||||
constant.FRIEND_DB,
|
constant.FRIEND_DB,
|
||||||
"t_friend_relationship",
|
"t_friend_relationship",
|
||||||
@ -218,6 +250,7 @@ func (this *friendMgr) AsyncAccpetApply(senderId string, targetId string, cb fun
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.asyncSetApplyStatus(senderId, targetId, 1)
|
this.asyncSetApplyStatus(senderId, targetId, 1)
|
||||||
|
this.addFriendShip(accountId1, accountId2, int32(nowTime))
|
||||||
cb(0, "")
|
cb(0, "")
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user