From c6156418dd1b9c081843a952b0b7a3f3c11e0315 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Sat, 30 Mar 2019 13:35:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/payserver/ordermgr.h | 56 ++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 32 deletions(-) diff --git a/server/payserver/ordermgr.h b/server/payserver/ordermgr.h index e43729d..44e3210 100644 --- a/server/payserver/ordermgr.h +++ b/server/payserver/ordermgr.h @@ -14,10 +14,10 @@ struct OrderInfo std::string seqid; std::string orderid; std::string accountid; - int itemid; - int price; - int customprice; - int serverid; + int itemid = 0; + int price = 0; + int customprice = 0; + int serverid = 0; std::string roleid; std::string rolename; std::string sp_accountid; @@ -25,27 +25,13 @@ struct OrderInfo std::string itemname; std::string itemmemo; std::string sp_orderid; - time_t lastchecktime; - - OrderInfo() - { - serverid = 0; - itemid = 0; - price = 0; - lastchecktime = 0; - customprice = 0; - } + time_t lastchecktime = 0; }; struct AddOrderResult { - bool isok; + bool isok = false; OrderInfo orderinfo; - - AddOrderResult() - { - isok = false; - } }; struct AddOrderNode; @@ -140,25 +126,31 @@ class OrderMgr : public a8::Singleton const std::string& rolename); private: - a8::mysql::Connection* mysql_conn_; - a8::mysql::Query* query_; + a8::mysql::Connection* mysql_conn_ = nullptr; + a8::mysql::Query* query_ = nullptr; a8::tick_t last_ping_db_tick_ = 0; std::mutex *add_order_mutex_ = nullptr; - AddOrderNode *top_node_, *bot_node_, *work_node_; + AddOrderNode *top_node_ = nullptr; + AddOrderNode *bot_node_ = nullptr; + AddOrderNode *work_node_ = nullptr; - std::mutex *pay_notify_mutex_; - PayNotifyNode *pay_notify_top_node_, *pay_notify_bot_node_, *pay_notify_work_node_; + std::mutex *pay_notify_mutex_ = nullptr; + PayNotifyNode *pay_notify_top_node_ = nullptr; + PayNotifyNode *pay_notify_bot_node_ = nullptr; + PayNotifyNode *pay_notify_work_node_ = nullptr; - std::mutex *reissue_mutex_; - ReissueNode *reissue_top_node_, *reissue_bot_node_, *reissue_work_node_; + std::mutex *reissue_mutex_ = nullptr; + ReissueNode *reissue_top_node_ = nullptr; + ReissueNode *reissue_bot_node_ = nullptr; + ReissueNode *reissue_work_node_ = nullptr; - int last_gen_order_time_; - int sub_orderid_; + int last_gen_order_time_ = 0; + int sub_orderid_ = 0; - std::mutex *seq_mutex_; - volatile int current_seqid_; - std::mutex *add_order_result_mutex_; + std::mutex *seq_mutex_ = nullptr; + volatile int current_seqid_ = 0; + std::mutex *add_order_result_mutex_ = nullptr; std::map add_order_results_; std::mutex *pay_notify_result_mutex_;