123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- #ifndef MODULE_AREA_H
- #define MODULE_AREA_H
- #include"area.h"
- #include"module_const.h"
- #include"module_web.h"
- class module_area:public i_thread, public singleton_base<module_area>
- {
- private:
- friend class singleton_base<module_area>;
- module_area()
- {
- }
- public:
- void on_hover(uint64_t card_id,std::shared_ptr<area_hover>&c,double speed);
- void on_enter(uint64_t card_id,std::shared_ptr<area_hover>&c,double speed);
- void on_leave(uint64_t card_id,std::shared_ptr<area_hover>&c,double speed);
-
- void init()
- {}
-
- 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 "";
- }
- 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
|