!2305 修复cjson不支持int64类型的卡片id,导致精度科学计数法。影响卡片展示

Merge pull request !2305 from wangjiaqiang/master
This commit is contained in:
openharmony_ci 2024-09-21 11:27:18 +00:00 committed by Gitee
commit 50a446df79
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 12 additions and 4 deletions

View File

@ -59,7 +59,14 @@ bool TemplateRootNode::Unmarshal(const DistributedData::Serializable::json &node
{
bool ret = GetValue(node, GET_NAME(uri), uri);
ret = ret && GetValue(node, GET_NAME(bundleName), bundleName);
ret = ret && GetValue(node, GET_NAME(subscriberId), subscriberId);
if (!GetValue(node, GET_NAME(subscriberId), subscriberId)) {
int64_t subId;
if (GetValue(node, GET_NAME(subscriberId), subId)) {
subscriberId = std::to_string(subId);
} else {
ret = false;
}
}
ret = ret && GetValue(node, GET_NAME(userId), userId);
ret = ret && GetValue(node, GET_NAME(templat), tpl);
return ret;
@ -67,7 +74,7 @@ bool TemplateRootNode::Unmarshal(const DistributedData::Serializable::json &node
TemplateRootNode::TemplateRootNode(const std::string &uri, const std::string &bundleName, const int64_t subscriberId,
const int32_t userId, const Template &tpl)
: uri(uri), bundleName(bundleName), subscriberId(subscriberId), userId(userId), tpl(tpl)
: uri(uri), bundleName(bundleName), subscriberId(std::to_string(subscriberId)), userId(userId), tpl(tpl)
{
}

View File

@ -50,7 +50,7 @@ struct TemplateRootNode final: public DistributedData::Serializable {
private:
std::string uri;
std::string bundleName;
int64_t subscriberId;
std::string subscriberId;
int32_t userId;
TemplateNode tpl;
};

View File

@ -344,7 +344,8 @@ int RdbSubscriberManager::Notify(const Key &key, int32_t userId, const std::vect
changeNode.data_.emplace_back("{\"" + predicate.key_ + "\":" + result + "}");
}
ZLOGI("emit, size %{public}zu %{private}s", val.size(), changeNode.uri_.c_str());
ZLOGI("emit, valSize: %{public}zu, dataSize:%{public}zu, uri:%{public}s,",
val.size(), changeNode.data_.size(), DistributedData::Anonymous::Change(changeNode.uri_).c_str());
for (const auto &callback : val) {
if (callback.enabled && callback.observer != nullptr) {
callback.observer->OnChangeFromRdb(changeNode);