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

Method document_postDataNew

src/sync/WizKMServer.cpp:1455–1691  ·  view source on GitHub ↗

! Post document information \a dataTemp or data (via \a withData argument) to server side. */

Source from the content-addressed store, hash-verified

1453 Post document information \a dataTemp or data (via \a withData argument) to server side.
1454 */
1455bool WizKMDatabaseServer::document_postDataNew(const WIZDOCUMENTDATAEX& dataTemp, bool withData, __int64& nServerVersion)
1456{
1457 m_strLastLocalError.clear();
1458 // 拷贝笔记数据
1459 WIZDOCUMENTDATAEX data = dataTemp;
1460 // 构建地址
1461 QString url_main = buildUrl("/ks/note/upload/" + m_userInfo.strKbGUID + "/" + data.strGUID);
1462 QString url_res = buildUrl("/ks/object/upload/" + m_userInfo.strKbGUID + "/" + data.strGUID);
1463 //
1464 if (withData && data.arrayData.length() > 2)
1465 {
1466 if (data.arrayData[0] == 'P' && data.arrayData[1] == 'K')
1467 {
1468 if (data.nProtected != 0)
1469 {
1470 TOLOG("note is not encrypted, but protected is 1");
1471 data.nProtected = 0;
1472 }
1473 }
1474 else
1475 {
1476 if (data.nProtected != 1)
1477 {
1478 TOLOG("note is encrypted, but protected is 0");
1479 data.nProtected = 1;
1480 }
1481 }
1482 }
1483 //
1484 CString tags;
1485 ::WizStringArrayToText(data.arrayTagGUID, tags, "*");
1486 // 准备要发送的笔记数据
1487 Json::Value doc;
1488 doc["kbGuid"] = m_userInfo.strKbGUID.toStdString();
1489 doc["docGuid"] = data.strGUID.toStdString();
1490 doc["title"] = data.strTitle.toStdString();
1491 doc["dataMd5"] = data.strDataMD5.toStdString();
1492 doc["dataModified"] = (Json::UInt64)data.tDataModified.toTime_t() * (Json::UInt64)1000;
1493 doc["category"] = data.strLocation.toStdString();
1494 doc["owner"] = data.strOwner.toStdString();
1495 doc["protected"] = (int)data.nProtected;
1496 doc["readCount"] = (int)data.nReadCount;
1497 doc["attachmentCount"] = (int)data.nAttachmentCount;
1498 doc["type"] = data.strType.toStdString();
1499 doc["fileType"] = data.strFileType.toStdString();
1500 doc["created"] = (Json::UInt64)data.tCreated.toTime_t() * (Json::UInt64)1000;
1501 doc["accessed"] = (Json::UInt64)data.tAccessed.toTime_t() * (Json::UInt64)1000;
1502 doc["url"] = data.strURL.toStdString();
1503 doc["styleGuid"] = data.strStyleGUID.toStdString();
1504 doc["seo"] = data.strSEO.toStdString();
1505 doc["author"] = data.strAuthor.toStdString();
1506 doc["keywords"] = data.strKeywords.toStdString();
1507 doc["tags"] = tags.toStdString();
1508 doc["withData"] = withData;
1509 //
1510 std::vector<WIZZIPENTRYDATA> allLocalResources;
1511 WizUnzipFile zip;
1512 // 如果有数据且笔记不是受保护的

Callers

nothing calls this directly

Calls 15

TOLOGFunction · 0.85
WizStringArrayToTextFunction · 0.85
execStandardJsonRequestFunction · 0.85
uploadObjectFunction · 0.85
uploadResourcesFunction · 0.85
lengthMethod · 0.80
asStringMethod · 0.80
asInt64Method · 0.80
sizeMethod · 0.80
extractFileMethod · 0.80
QStringClass · 0.70

Tested by

no test coverage detected