MCPcopy Create free account
hub / github.com/DSVVA/MHY_Scanner / pBtStream

Method pBtStream

src/UI/WindowMain.cpp:243–304  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

241}
242
243void WindowMain::pBtStream(bool clicked)
244{
245 ui.pBtstartScreen->setEnabled(false);
246 ui.pBtStream->setEnabled(false);
247 ui.pBtStream->setText("加载中。。。");
248 QApplication::processEvents();
249
250 QThreadPool::globalInstance()->start([&, clicked]() {
251 if (!clicked)
252 {
253 emit StopScanner();
254 return;
255 }
256 if (countA == -1)
257 {
258 emit AccountNotSelected();
259 return;
260 }
261 std::string stream_link;
262 std::map<std::string, std::string> heards;
263 //检查直播间状态
264 if (!GetStreamLink(ui.lineEditLiveId->text().toStdString(), stream_link, heards))
265 {
266 emit StopScanner();
267 return;
268 }
269 else
270 {
271 t2.setUrl(stream_link, heards);
272 }
273 if (const std::string& type = userinfo["account"][countA]["type"]; type == "官服")
274 {
275 std::string stoken = userinfo["account"][countA]["access_key"];
276 std::string uid = userinfo["account"][countA]["uid"];
277 std::string mid = userinfo["account"][countA]["mid"];
278 auto [code, game_token] = GetGameTokenByStoken(stoken, mid);
279 if (code != 0)
280 {
281 emit AccountError();
282 return;
283 }
284 t2.setServerType(ServerType::Official);
285 t2.setLoginInfo(uid, game_token);
286 }
287 else if (type == "崩坏3B服")
288 {
289 std::string stoken{ userinfo["account"][countA]["access_key"] };
290 std::string uid{ userinfo["account"][countA]["uid"] };
291 //可用性检查
292 auto result{ BSGameSDK::BH3::GetUserInfo(uid, stoken) };
293 if (result.code != 0)
294 {
295 emit AccountError();
296 return;
297 }
298 t2.setServerType(ServerType::BH3_BiliBili);
299 t2.setLoginInfo(uid, stoken, result.uname);
300 }

Callers

nothing calls this directly

Calls 5

GetGameTokenByStokenFunction · 0.85
GetUserInfoFunction · 0.85
setUrlMethod · 0.80
setServerTypeMethod · 0.45
setLoginInfoMethod · 0.45

Tested by

no test coverage detected