123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- #ifndef HTTPSCOKET
- #define HTTPSCOKET
- #include "funall.h"
- #include "webfun.h"
- class IIhttpsocket
- {
- public:
- std::function<void(weblib::httpinfo, std::function<void(std::string&, int)>&&)> m_gamemsg{ nullptr };
- std::function<void(std::string, boost::any)> m_updatestatic{ nullptr };
- std::function<void(std::function<void()>&&)> m_postmsg{ nullptr };
- std::function<void(std::string)> m_writelog{ nullptr };
- public:
- virtual void init() = 0;
- virtual bool postmsg(std::function<void(std::string&, int)> funhttpmsg, std::map<std::string, std::string> getdata) = 0;
- virtual void updatemsg(std::string strtype, boost::any getdata) = 0;
- };
- class HttpSocket:public IIhttpsocket
- {
- typedef std::function<std::string(std::map<std::string, std::string> getdata)> funcmsg;
- protected:
- bsoncxx::builder::basic::array m_useridarray;
- std::unordered_map<std::int64_t, std::string> m_mapuseridname;
- std::default_random_engine m_random;
- std::string m_strshahead;
- std::string m_strshaheadcontent;
- void* m_psendhttp;
- static std::uint32_t m_gucurid;
- std::uint32_t m_ucurid;
- //接受http消息
- std::map<std::string, funcmsg> m_callmsg;
- staticdata m_staticdata;
- //用户信息
- protected:
- boost::shared_ptr<mongocxx::uri> m_puri;
- boost::shared_ptr<mongocxx::client> m_pclient;
- //索引集合
- boost::shared_ptr<mongocxx::collection> m_pallindex;
- // 用户数据库
- boost::shared_ptr<mongocxx::database> m_pdb;
- // 日志库
- boost::shared_ptr<mongocxx::database> m_gamelog;
- // 推广数据库
- boost::shared_ptr<mongocxx::database> m_pvipuserdb;
- // 集合
- boost::shared_ptr<mongocxx::collection> m_pcoll;
- //用户在线集合
- boost::shared_ptr<mongocxx::collection> m_pplayuseronline;
- //用户登录集合
- boost::shared_ptr<mongocxx::collection> m_userloginonline;
- //输赢集合
- boost::shared_ptr<mongocxx::collection> m_plosewincoll;
- //游戏每局奖励记录
- boost::shared_ptr<mongocxx::collection> m_pgameprizelog;
- //推广集合
- boost::shared_ptr<mongocxx::collection> m_pvipuser;
- //转分集合
- boost::shared_ptr<mongocxx::collection> m_pusertradeinfo;
- //转分集合
- boost::shared_ptr<mongocxx::collection> m_pviptradeinfo;
- //操作日志集合
- boost::shared_ptr<mongocxx::collection> m_poperatinfo;
- //商家卖收分
- boost::shared_ptr<mongocxx::collection> m_pvipscore;
- //商家卖收分
- boost::shared_ptr<mongocxx::collection> m_pvipscoredate;
- //推广账号
- boost::shared_ptr<mongocxx::collection> m_pvipuseraccounts;
- //玩家每天日志信息
- boost::shared_ptr<mongocxx::collection> m_puserdatainfo;
- //第三方平台
- boost::shared_ptr<mongocxx::collection> m_pthreeadmin;
- //商家配置表
- boost::shared_ptr<mongocxx::collection> m_pvipconfigure;
- // 平台库
- boost::shared_ptr<mongocxx::database> m_platform;
- //游戏配置表
- boost::shared_ptr<mongocxx::collection> m_pgamelist;
- //三方转账记录
- boost::shared_ptr<mongocxx::collection> m_pthirdtranslog;
- // thirdplat 第3方厂商管理
- boost::shared_ptr<mongocxx::collection> m_pthirddeveloper;
- // 兑换码
- boost::shared_ptr<mongocxx::collection> m_predeemcode;
- public:
- HttpSocket();
- ~HttpSocket();
- void stopmsg();
- std::string getuseraccount(std::int32_t iregion);
- void makegamelist(staticdata& tstaticdata);
- void init();
- bool postmsg(std::function<void(std::string&, int)> funhttpmsg, std::map<std::string, std::string> getdata);
- void updatemsg(std::string strtype, boost::any getdata);
- protected:
- //获得游戏列表
- std::string getgamelist(std::map<std::string, std::string> getdata);
- //玩家账号注册
- std::string regaccount(std::map<std::string, std::string> getdata);
- //玩家更新分数
- std::string updateuserscore(std::map<std::string, std::string> getdata, std::function<void(std::string&, int)>& dofun);
- //把玩家踢出游戏
- std::string adminhituser(std::map<std::string, std::string> getdata, std::function<void(std::string&, int)>& dofun);
- //管理员禁止管理员所属玩家
- std::string adminforbiduser(std::map<std::string, std::string> getdata);
- //获取账号
- std::string getuseraccount(std::map<std::string, std::string> getdata);
- //修改下级玩家信息
- std::string modifyuserinfo(std::map<std::string, std::string> getdata);
- //管理员禁止自己直属玩家
- std::string adminforbidmyuser(std::map<std::string, std::string> getdata);
- //查询充值记录
- std::string sellbuyinfo(std::map<std::string, std::string> getdata);
- //查询游戏每局记录
- std::string playgameinfo(std::map<std::string, std::string> getdata);
- //获取总赌注和总输赢
- std::string getuserplayscoreinfo(std::map<std::string, std::string> getdata);
- //添加奖励码
- std::string updateuseringot(std::map<std::string, std::string> getdata);
- //回退奖励码
- std::string backuseringot(std::map<std::string, std::string> getdata);
- //获取所有总赌注和总输赢
- std::string getalluserplayscoreinfo(std::map<std::string, std::string> getdata);
- //-------------------------------真人视讯-----------------------------------------
- //登录真人视讯
- std::string reelplay(std::map<std::string, std::string> getdata, std::function<void(std::string&, int)>& dofun);
- void sendreelmsg(std::string stronly, std::string strtarget, std::string strjson, std::function<void(std::string, int)>&& dofun);
- //创建玩家
- void createreeluser(std::string struseracc, __int32 ikindid, std::int64_t iscore, __int64 iuserid, std::function<void(std::string&, int)> dofun);
- //玩家转账到三方
- void reelusertrans(std::string struseracc, __int32 ikindid, std::int64_t iscore, __int64 iuserid, std::function<void(std::string&, int)> dofun);
- bool updateusertrans(std::string struseracc, __int32 ikindid, std::string strtransid, std::int64_t iscore);
- //拉取游戏
- void getreelgameurl(std::string struseracc, __int32 ikindid, __int64 iuserid, std::function<void(std::string&, int)> dofun);
- //-------------------------------兑换码---------------------------------------
- std::string generateredeemcodes(std::map<std::string, std::string> getdata);
- };
- #endif
|