|
|
@@ -428,9 +428,20 @@ void CZhengcanPageUI::ClickTableAction()
|
|
|
|
|
|
if (ret == IDOK)
|
|
|
{
|
|
|
- //这说明折扣输入了
|
|
|
+ //这说明人数输入了
|
|
|
std::string renshu = pKaitaiDlg->getContent();
|
|
|
|
|
|
+ bool ret = this->Kaitai(table_id, renshu);
|
|
|
+
|
|
|
+ if (ret == true)
|
|
|
+ {
|
|
|
+ //开台成功,进入桌子
|
|
|
+ this->EnterTable(table_id);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ this->m_pMainWnd->ShowToast(L"开台失败!");
|
|
|
+ }
|
|
|
|
|
|
delete pKaitaiDlg;
|
|
|
}
|
|
|
@@ -451,4 +462,58 @@ void CZhengcanPageUI::ClickTableAction()
|
|
|
//已开台
|
|
|
|
|
|
}
|
|
|
+}
|
|
|
+
|
|
|
+bool CZhengcanPageUI::Kaitai(std::string table_id, std::string renshu)
|
|
|
+{
|
|
|
+ std::map<string, string> params;
|
|
|
+
|
|
|
+ params["table_id"] = table_id;
|
|
|
+ params["person"] = renshu;
|
|
|
+
|
|
|
+ std::string response;
|
|
|
+
|
|
|
+ std::string url = "/dinnercash/opentable";
|
|
|
+ bool ret = CZhipuziHttpClient::GetInstance()->Request(url.c_str(), params, response);
|
|
|
+ if (ret == false)
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ rapidjson::Document document;
|
|
|
+ document.Parse(response.c_str());
|
|
|
+
|
|
|
+ if (document.HasParseError())
|
|
|
+ {
|
|
|
+ LOG_INFO("parse response error!");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!document.HasMember("errcode") || !document.HasMember("errmsg"))
|
|
|
+ {
|
|
|
+ LOG_INFO("json error!");
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ rapidjson::Value& v_errcode = document["errcode"];
|
|
|
+ int errcode = v_errcode.GetInt();
|
|
|
+ if (errcode != 0)
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!document.HasMember("data"))
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ rapidjson::Value& data = document["data"];
|
|
|
+
|
|
|
+ return true;
|
|
|
+}
|
|
|
+
|
|
|
+void CZhengcanPageUI::EnterTable(std::string table_id)
|
|
|
+{
|
|
|
+
|
|
|
}
|