This commit is contained in:
aozhiwei 2024-04-11 20:35:18 +08:00
parent 500324ad90
commit d1621300ff
3 changed files with 54 additions and 20 deletions

View File

@ -5,6 +5,7 @@ import (
"f5"
"fmt"
"main/constant"
"main/model"
)
type friendMgr struct {
@ -208,26 +209,7 @@ func (this *friendMgr) AsyncApplyFriend(senderId string, targetId string, cb fun
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(constant.FRIEND_APPLY_STATUS_NONE)},
{"last_apply_time", q5.ToString(nowTime)},
},
[][]string{
{"sender_id", senderId},
{"target_id", targetId},
{"status", q5.ToString(constant.FRIEND_APPLY_STATUS_NONE)},
{"last_apply_time", q5.ToString(nowTime)},
{"createtime", q5.ToString(nowTime)},
{"modifytime", q5.ToString(nowTime)},
},
model.FriendApply.Force(senderId, targetId,
func (err error, lastInsertId int64, rowsAffected int64) {
if err != nil {
cb(1, "")

View File

@ -0,0 +1,14 @@
package model
/*
import (
"q5"
"f5"
"main/constant"
)*/
type friend struct {
}
var Friend = new (friend)

View File

@ -0,0 +1,38 @@
package model
import (
"q5"
"f5"
"main/constant"
)
type friendApply struct {
}
var FriendApply = new (friendApply)
func (this *friendApply) Force(senderId string, targetId string,
cb func (error, int64, int64)) {
nowTime := f5.GetApp().GetNowSeconds()
f5.GetJsStyleDb().Upsert(
constant.FRIEND_DB,
"t_friend_apply",
[][]string{
{"sender_id", senderId},
{"target_id", targetId},
},
[][]string{
{"status", q5.ToString(constant.FRIEND_APPLY_STATUS_NONE)},
{"last_apply_time", q5.ToString(nowTime)},
},
[][]string{
{"sender_id", senderId},
{"target_id", targetId},
{"status", q5.ToString(constant.FRIEND_APPLY_STATUS_NONE)},
{"last_apply_time", q5.ToString(nowTime)},
{"createtime", q5.ToString(nowTime)},
{"modifytime", q5.ToString(nowTime)},
},
cb)
}