try fix `_set_model_show`API

This commit is contained in:
owo233 2023-10-04 00:59:51 +08:00
parent 8e84f61ccb
commit ccf670b98f
No known key found for this signature in database
GPG Key ID: 5D538586B03AFDAB
4 changed files with 22 additions and 20 deletions

2
.gitignore vendored
View File

@ -7,3 +7,5 @@ build/
.externalNativeBuild
.cxx
app/app/release
app/arm64/release
app/x64/release

View File

@ -7,15 +7,19 @@ import moe.protocol.servlet.CardSvc
internal object SetModelShow: IActionHandler() {
override suspend fun internalHandle(session: ActionSession): String {
val model = session.getString("model")
return invoke(model, session.echo)
val manu = session.getString("manu")
val modelshow = session.getString("modelshow")
val imei = session.getString("imei")
val show = session.getBoolean("show")
return invoke(model, manu, modelshow, imei, show, session.echo)
}
suspend operator fun invoke(model: String, echo: String = ""): String {
CardSvc.setModelShow(model)
suspend operator fun invoke(model: String, manu: String, modelshow: String, imei: String, show: Boolean, echo: String = ""): String {
CardSvc.setModelShow(model, manu, modelshow, imei, show)
return ok("成功", echo = echo)
}
override val requiredParams: Array<String> = arrayOf("model")
override val requiredParams: Array<String> = arrayOf("model", "manu", "modelshow", "imei", "show")
override fun path(): String = "_set_model_show"
}

View File

@ -27,8 +27,12 @@ fun Routing.userAction() {
}
getOrPost("/_set_model_show") {
val modelShow = fetchOrThrow("model")
call.respondText(SetModelShow(modelShow))
val model = fetchOrThrow("model")
val manu = fetchOrThrow("manu")
val modelshow = fetchOrThrow("modelshow")
val imei = fetchOrThrow("imei")
val show = fetchOrThrow("show").toBoolean()
call.respondText(SetModelShow(model, manu, modelshow, imei, show))
}
getOrPost("/get_model_show") {

View File

@ -55,31 +55,23 @@ internal object CardSvc: BaseSvc() {
}
}
/**
* TODO: 出现问题无法设置
*/
suspend fun setModelShow(model: String) {
suspend fun setModelShow(model: String, manu: String, modelshow: String? = "Android", imei: String, show: Boolean = true) {
val cookie = TicketSvc.getCookie("vip.qq.com")
val csrf = TicketSvc.getCSRF(TicketSvc.getUin(), "vip.qq.com")
val p4token = TicketSvc.getPt4Token(TicketSvc.getUin(), "vip.qq.com") ?: ""
GlobalClient.post("https://club.vip.qq.com/srf-cgi-node?srfname=VIP.CustomOnlineStatusServer.CustomOnlineStatusObj.SetCustomOnlineStatus&ts=${System.currentTimeMillis()}&daid=18&g_tk=$csrf&pt4_token=$p4token") {
header("Cookie", cookie)
//header("referer", "https://club.vip.qq.com/onlinestatus/set?_wv=67109895&_wvx=10&_proxy=1&src=1&systemName=android&model=&msfImei=&identifier=")
contentType(Json)
setBody(mapOf(
"servicesName" to "VIP.CustomOnlineStatusServer.CustomOnlineStatusObj",
"cmd" to "SetCustomOnlineStatus",
"args" to listOf(mapOf(
"iAppType" to 3,
"sIMei" to "",
"sModel" to model.replace("+", "%20"),
"sDeviceInfo" to "",
"sVer" to PlatformUtils.getVersion(MobileQQ.getContext()),
"sManu" to "undefined",
"sIMei" to imei,
"sModel" to model,
"sManu" to manu,
"lUin" to app.currentUin.toLong(),
"bShowInfo" to true,
"sDesc" to "",
"sModelShow" to model.replace("+", "%20"),
"bShowInfo" to show,
"sModelShow" to modelshow
))
).json.toString())
}.bodyAsText().let {