#ifndef __CORPORATIONCONTEXT_H__ #define __CORPORATIONCONTEXT_H__ #include "Singleton.h" #include #include class CorporationContext : public std::enable_shared_from_this { friend class Amass::Singleton; public: enum MessageType { Text, Markdown, }; using RequestType = boost::beast::http::request; void sendMessage(MessageType type, const std::string &message); void start(); /** * @brief * * @param request * @example curl -H "Content-Type: application/json" -X POST -d '{"user_id": "123", "msg":"OK!" }' * https://amass.fun/notify */ void notify(const RequestType &request); protected: CorporationContext(boost::asio::io_context &ioContext); void updateAccessToken(); private: boost::asio::io_context &m_ioContext; boost::asio::steady_timer m_timer; std::string m_accessToken; constexpr static auto host = "qyapi.weixin.qq.com"; constexpr static auto port = "443"; constexpr static auto corpid = "ww1a786851749bdadc"; constexpr static auto corpsecret = "LlyJmYLIBOxJkQxkhwyqNVf550AUQ3JT2MT4yuS31i0"; constexpr static auto agentid = 1000002; }; #endif // __CORPORATIONCONTEXT_H__