IAPUserData.hpp 773 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. void init();
  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. private:
  26. static IAPUserData* _instance;
  27. std::vector<std::string> _buyInfos; // 用户购买信息
  28. };
  29. NS_IAP_END
  30. #endif /* IAPUserData_hpp */