123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- #ifndef MODULE_CALL_HELP_H
- #define MODULE_CALL_HELP_H
- #include <mutex>
- #include <map>
- #include <chrono>
- #include <boost/thread.hpp>
- #include <boost/enable_shared_from_this.hpp>
- #include "module_web.h"
- #include "module_const.h"
- class module_call_help : public i_thread, public singleton_base<module_call_help>
- {
- private:
- friend class singleton_base<module_call_help>;
- module_call_help()
- {
- }
- public:
-
- void rev_help(std::shared_ptr<card> card_ptr)
- {
- }
-
- void accept_deal_help(std::map<std::string, sio::message::ptr> data_map)
- {
- }
-
- std::string response_login()
- {
- std::vector<std::shared_ptr<ya_event>> arr;
- get_all_events(arr);
- if(!arr.empty())
- {
- return tool_json::evs_to_json(arr);
- }
- return "";
- }
-
- void init()
- {}
- private:
-
- void run()
- {
- std::vector<std::shared_ptr<ya_event>> arr;
- get_all_events(arr);
- if(!arr.empty())
- {
- swsClientMgr.send(JSON_CMD_VALUE_PUSH, tool_json::evs_to_json(arr));
- }
- }
-
- void get_all_events(std::vector<std::shared_ptr<ya_event>>& arr)
- {
- {
- std::lock_guard<std::mutex> lock(_mutex);
- auto it_map = _map.begin();
- for(;it_map!=_map.end();++it_map)
- {
- arr.push_back(it_map->second);
- if(ES_DEAL_HELP== it_map->second->m_status)
- {
- _map.erase(it_map--);
- }
- }
- }
- }
- std::map<uint64_t, std::shared_ptr<ya_event>> _map;
- };
- #endif
|