mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-16 09:50:40 +08:00
feat.新增支持企鹅物流自动获取id
This commit is contained in:
@@ -362,3 +362,13 @@ Todo
|
||||
"index": 0 // 设施序号
|
||||
}
|
||||
```
|
||||
|
||||
- `PenguinId`
|
||||
企鹅物流 ID
|
||||
|
||||
```jsonc
|
||||
// 对应的 details 字段举例
|
||||
{
|
||||
"id": string
|
||||
}
|
||||
```
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
"penguinReport": {
|
||||
"Doc": "企鹅数据汇报:每次到结算界面,汇报掉落数据至企鹅数据 https://penguin-stats.cn/。true-开启,false-关闭,默认true",
|
||||
"enable": true,
|
||||
"cmdFormat": "curl -H \"Content-Type: application/json\" -d \"[body]\" \"https://penguin-stats.cn/PenguinStats/api/v2/report\" [extra]",
|
||||
"cmdFormat": "curl -H \"Content-Type: application/json\" -s -i -d \"[body]\" \"https://penguin-stats.cn/PenguinStats/api/v2/report\" [extra]",
|
||||
"cmdFormat_Doc": "命令格式,想打印详细信息可以尝试添加 -v -i"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
#include <regex>
|
||||
|
||||
#include "Controller.h"
|
||||
#include "Resource.h"
|
||||
@@ -164,6 +165,14 @@ void asst::StageDropsTaskPlugin::upload_to_penguin()
|
||||
|
||||
std::string response = utils::callcmd(cmd_line);
|
||||
|
||||
static const std::regex penguinid_regex(R"(X-Penguin-Set-Penguinid: (\d+))");
|
||||
std::smatch penguinid_sm;
|
||||
if (std::regex_search(response, penguinid_sm, penguinid_regex)) {
|
||||
json::value id_info = basic_info_with_what("PenguinId");
|
||||
id_info["details"]["id"] = std::string(penguinid_sm[1]);
|
||||
callback(AsstMsg::SubTaskExtraInfo, id_info);
|
||||
}
|
||||
|
||||
Log.trace("response:\n", response);
|
||||
|
||||
callback(AsstMsg::SubTaskCompleted, info);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// MeoAsstGui - A part of the MeoAssistantArknights project
|
||||
// MeoAsstGui - A part of the MeoAssistantArknights project
|
||||
// Copyright (C) 2021 MistEO and Contributors
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
@@ -465,6 +465,18 @@ namespace MeoAsstGui
|
||||
mainModel.AddLog("关卡识别错误", "darkred");
|
||||
}
|
||||
break;
|
||||
|
||||
case "PenguinId":
|
||||
{
|
||||
var settings = _container.Get<SettingsViewModel>();
|
||||
if (settings.PenguinId == String.Empty)
|
||||
{
|
||||
string id = subTaskDetails["id"].ToString();
|
||||
settings.PenguinId = id;
|
||||
AsstSetPenguinId(id);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user