MCPcopy Create free account
hub / github.com/altairwei/WizNotePlus / downloadTemplatePurchaseRecord

Method downloadTemplatePurchaseRecord

src/core/WizNoteManager.cpp:231–255  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

229}
230
231void WizNoteManager::downloadTemplatePurchaseRecord()
232{
233 //下载用户购买的模板列表
234 WizExecuteOnThread(WIZ_THREAD_NETWORK, [=]() {
235 WizEnsurePathExists(Utils::WizPathResolve::customNoteTemplatesPath());
236 //
237 QNetworkAccessManager manager;
238 QString url = WizCommonApiEntry::asServerUrl() + "/a/templates/record?token=" + WizToken::token();
239 //
240 QByteArray ba;
241 {
242 QNetworkReply* reply = manager.get(QNetworkRequest(url));
243 WizAutoTimeOutEventLoop loop(reply);
244 loop.exec();
245 //
246 if (loop.error() != QNetworkReply::NoError || loop.result().isEmpty())
247 return;
248
249 ba = loop.result();
250 QString jsonFile = Utils::WizPathResolve::wizTemplatePurchaseRecordFile();
251 std::ofstream recordFile(jsonFile.toUtf8().constData(), std::ios::out | std::ios::trunc);
252 recordFile << ba.constData();
253 }
254 });
255}
256
257bool WizNoteManager::updateLocalTemplates(const QByteArray& newJsonData, QNetworkAccessManager& manager)
258{

Callers 4

WizDocTemplateDialogMethod · 0.80
purchaseFinishedMethod · 0.80
showTemplateIAPDlgMethod · 0.80
mainCoreFunction · 0.80

Calls 7

WizExecuteOnThreadFunction · 0.85
WizEnsurePathExistsFunction · 0.85
errorMethod · 0.80
isEmptyMethod · 0.80
resultMethod · 0.80
getMethod · 0.45
execMethod · 0.45

Tested by

no test coverage detected