12345678910111213141516171819202122232425262728293031323334353637383940 |
- //
- // IAPProductInfo.cpp
- // bulldog_sdk
- //
- // Created by zhuge on 2024/3/14.
- //
- #include "IAPProductInfo.h"
- #include "cocos2d.h"
- iap::IAPProductInfo::IAPProductInfo(const std::string& productId, const std::string& name, const std::string& desc, const std::string& displayPrice )
- : _productId(productId)
- , _name(name)
- , _desc(desc)
- , _displayPrice(displayPrice)
- {
-
- }
- iap::IAPProductInfo::IAPProductInfo(const std::string& jsonString)
- : _productId("")
- , _name("")
- , _desc("")
- , _displayPrice("")
- {
- std::string err = "";
- json11::Json json = json11::Json::parse(jsonString, err);
- if (!err.empty() && json.is_null()) {
- // log error
- } else {
- auto joRoot = json.object_items();
- _productId = joRoot.at("productId").string_value();
- _name = joRoot.at("name").string_value();
- _desc = joRoot.at("desc").string_value();
- _displayPrice = joRoot.at("displayPrice").string_value();
- }
- }
- iap::IAPProductInfo::~IAPProductInfo() {}
|