#ifndef __CORPORATIONCONTEXT_H__ #define __CORPORATIONCONTEXT_H__ #include #include class CorporationContext { public: enum MessageType { Text, Markdown, }; using RequestType = boost::beast::http::request; CorporationContext(boost::asio::io_context &ioContext); void sendMessage(MessageType type,const std::string &message); /** * @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: 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__