mirror of
https://github.com/whitechi73/OpenShamrock.git
synced 2024-08-14 13:12:17 +08:00
Shamrock
: 好友请求系统消息
This commit is contained in:
parent
1d0a0731fb
commit
5776524579
@ -23,7 +23,7 @@ internal object ActionManager {
|
|||||||
// UserActions
|
// UserActions
|
||||||
GetProfileCard, GetFriendList, SendLike, GetUid, GetUinByUid, ScanQRCode, SetProfileCard,
|
GetProfileCard, GetFriendList, SendLike, GetUid, GetUinByUid, ScanQRCode, SetProfileCard,
|
||||||
GetCookies, GetCSRF, GetCredentials, RestartMe, CleanCache, GetModelShow, SetModelShow,
|
GetCookies, GetCSRF, GetCredentials, RestartMe, CleanCache, GetModelShow, SetModelShow,
|
||||||
GetModelShowList, GetOnlineClients, GetStrangerInfo, IsBlackListUin, GetHttpCookies,
|
GetModelShowList, GetOnlineClients, GetStrangerInfo, IsBlackListUin, GetHttpCookies, GetFriendSystemMsg,
|
||||||
|
|
||||||
// GroupInfo
|
// GroupInfo
|
||||||
GetTroopList, GetTroopInfo, GetTroopList, GetTroopMemberInfo, GetTroopMemberList,
|
GetTroopList, GetTroopInfo, GetTroopList, GetTroopMemberInfo, GetTroopMemberList,
|
||||||
@ -42,7 +42,7 @@ internal object ActionManager {
|
|||||||
DeleteGroupFile, GetGroupFileSystemInfo, GetGroupRootFiles, GetGroupSubFiles,
|
DeleteGroupFile, GetGroupFileSystemInfo, GetGroupRootFiles, GetGroupSubFiles,
|
||||||
GetGroupFileUrl, UploadPrivateFile,
|
GetGroupFileUrl, UploadPrivateFile,
|
||||||
|
|
||||||
//REQUEST ACTION
|
// REQUEST ACTION
|
||||||
SetFriendAddRequest, SetGroupAddRequest,
|
SetFriendAddRequest, SetGroupAddRequest,
|
||||||
|
|
||||||
// GUILD
|
// GUILD
|
||||||
|
@ -0,0 +1,45 @@
|
|||||||
|
package moe.fuqiuluo.shamrock.remote.action.handlers
|
||||||
|
|
||||||
|
import kotlinx.serialization.json.JsonElement
|
||||||
|
import moe.fuqiuluo.qqinterface.servlet.FriendSvc
|
||||||
|
import moe.fuqiuluo.shamrock.helper.Level
|
||||||
|
import moe.fuqiuluo.shamrock.helper.LogCenter
|
||||||
|
import moe.fuqiuluo.shamrock.remote.action.ActionSession
|
||||||
|
import moe.fuqiuluo.shamrock.remote.action.IActionHandler
|
||||||
|
import moe.fuqiuluo.shamrock.remote.service.data.FriendRequest
|
||||||
|
import moe.fuqiuluo.shamrock.tools.EmptyJsonString
|
||||||
|
|
||||||
|
internal object GetFriendSystemMsg : IActionHandler() {
|
||||||
|
override suspend fun internalHandle(session: ActionSession): String {
|
||||||
|
return invoke(echo = session.echo)
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend operator fun invoke(echo: JsonElement = EmptyJsonString): String {
|
||||||
|
val list = FriendSvc.requestFriendSystemMsgNew(20)
|
||||||
|
val msgs = list
|
||||||
|
// 13 是加别人好友
|
||||||
|
?.filter { it.msg.sub_type.get() != 13 }
|
||||||
|
?.map {
|
||||||
|
LogCenter.log(it.toString(), Level.WARN)
|
||||||
|
FriendRequest(
|
||||||
|
seq = it.msg_seq.get(),
|
||||||
|
userId = it.req_uin.get(),
|
||||||
|
name = it.msg.req_uin_nick.get(),
|
||||||
|
source = it.msg.msg_source.get(),
|
||||||
|
subId = it.msg.src_id.get(),
|
||||||
|
subSrcId = it.msg.sub_src_id.get(),
|
||||||
|
msg = it.msg.msg_additional.get(),
|
||||||
|
sourceGroupName = it.msg.group_name.get(),
|
||||||
|
sourceGroupCode = it.msg.group_code.get(),
|
||||||
|
flag = "${it.msg_seq.get()};${it.msg.src_id.get()};${it.msg.sub_src_id.get()};${it.req_uin.get()}",
|
||||||
|
sex = if (it.msg.req_uin_gender.get() == 1) "female" else "male",
|
||||||
|
age = it.msg.req_uin_age.get(),
|
||||||
|
msgDetail = it.msg.msg_detail.get(),
|
||||||
|
status = it.msg.msg_decided.get()
|
||||||
|
)
|
||||||
|
} ?: mutableListOf()
|
||||||
|
return ok(msgs, echo = echo)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun path(): String = "get_friend_system_msg"
|
||||||
|
}
|
@ -61,7 +61,5 @@ internal object GetGroupSystemMsg: IActionHandler() {
|
|||||||
return ok(msgs, echo = echo)
|
return ok(msgs, echo = echo)
|
||||||
}
|
}
|
||||||
|
|
||||||
override val requiredParams: Array<String> = arrayOf("group_id", "folder_id")
|
override fun path(): String = "get_group_system_msg"
|
||||||
|
|
||||||
override fun path(): String = "get_group_files_by_folder"
|
|
||||||
}
|
}
|
@ -8,6 +8,7 @@ import io.ktor.server.response.respondText
|
|||||||
import io.ktor.server.routing.Routing
|
import io.ktor.server.routing.Routing
|
||||||
import io.ktor.server.routing.get
|
import io.ktor.server.routing.get
|
||||||
import moe.fuqiuluo.shamrock.remote.action.handlers.GetFriendList
|
import moe.fuqiuluo.shamrock.remote.action.handlers.GetFriendList
|
||||||
|
import moe.fuqiuluo.shamrock.remote.action.handlers.GetFriendSystemMsg
|
||||||
import moe.fuqiuluo.shamrock.remote.action.handlers.GetStrangerInfo
|
import moe.fuqiuluo.shamrock.remote.action.handlers.GetStrangerInfo
|
||||||
import moe.fuqiuluo.shamrock.remote.action.handlers.IsBlackListUin
|
import moe.fuqiuluo.shamrock.remote.action.handlers.IsBlackListUin
|
||||||
import moe.fuqiuluo.shamrock.tools.fetchGetOrThrow
|
import moe.fuqiuluo.shamrock.tools.fetchGetOrThrow
|
||||||
@ -30,4 +31,9 @@ fun Routing.friendAction() {
|
|||||||
val uin = fetchOrThrow("user_id")
|
val uin = fetchOrThrow("user_id")
|
||||||
call.respondText(IsBlackListUin(uin), ContentType.Application.Json)
|
call.respondText(IsBlackListUin(uin), ContentType.Application.Json)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getOrPost("/get_friend_system_msg") {
|
||||||
|
call.respondText(GetFriendSystemMsg(), ContentType.Application.Json)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -16,3 +16,22 @@ internal data class FriendEntry(
|
|||||||
@SerialName("term_type") val termType: Int,
|
@SerialName("term_type") val termType: Int,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
internal data class FriendRequest(
|
||||||
|
@SerialName("request_id") val seq: Long = 0,
|
||||||
|
@SerialName("requester_uin") val userId: Long = 0,
|
||||||
|
@SerialName("requester_nick") val name: String?,
|
||||||
|
val source: String?,
|
||||||
|
@SerialName("sub_id") val subId: Int?,
|
||||||
|
@SerialName("sub_src_id") val subSrcId: Int?,
|
||||||
|
@SerialName("message") val msg: String?,
|
||||||
|
@SerialName("source_group_name") val sourceGroupName: String?,
|
||||||
|
@SerialName("source_group_id") val sourceGroupCode: Long?,
|
||||||
|
val flag: String,
|
||||||
|
val sex: String?,
|
||||||
|
val age: Int?,
|
||||||
|
@SerialName("msg_detail") val msgDetail: String?,
|
||||||
|
val status: String?,
|
||||||
|
|
||||||
|
)
|
Loading…
x
Reference in New Issue
Block a user