IAPUserData.hpp 792 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. //
  2. // IAPUserData.hpp
  3. // TileManor
  4. //
  5. // Created by 徐炼新 on 2024/9/30.
  6. //
  7. #ifndef IAPUserData_hpp
  8. #define IAPUserData_hpp
  9. #include <cocos2d.h>
  10. #include "IAPDefine.hpp"
  11. NS_IAP_BEGIN
  12. class IAPUserData {
  13. public:
  14. static IAPUserData* getInstance();
  15. IAPUserData();
  16. // 添加购买信息
  17. // 参数说明 : 商品id
  18. void addBuyInfo(std::string commodityID);
  19. void addBuyInfo(std::vector<std::string> commodityIDs);
  20. // 获取用户购买记录
  21. std::vector<std::string> getBuyInfos();
  22. // 清除所有购买信息
  23. void clearBuyInfo();
  24. private:
  25. void init();
  26. private:
  27. static IAPUserData* _instance;
  28. std::vector<std::string> _buyInfos; // 用户购买信息
  29. };
  30. NS_IAP_END
  31. #endif /* IAPUserData_hpp */