|
@@ -1863,53 +1863,57 @@ void CMainWnd::InitSettingStatus()
|
|
|
//先清空一次分类(主要考虑退出登陆重新登录的情况)
|
|
//先清空一次分类(主要考虑退出登陆重新登录的情况)
|
|
|
CSetting::ClearFoodtype();
|
|
CSetting::ClearFoodtype();
|
|
|
|
|
|
|
|
- std::map<string, string> params;
|
|
|
|
|
- params["shop_id"] = "424298";
|
|
|
|
|
|
|
+ std::string shop_id = CLewaimaiHttpClient::getShopId();
|
|
|
|
|
+ if (shop_id != "0")
|
|
|
|
|
+ {
|
|
|
|
|
+ std::map<string, string> params;
|
|
|
|
|
+ params["shop_id"] = shop_id;
|
|
|
|
|
|
|
|
- std::string response;
|
|
|
|
|
|
|
+ std::string response;
|
|
|
|
|
|
|
|
- std::string url = "/goodstype/getlist";
|
|
|
|
|
|
|
+ std::string url = "/goodstype/getlist";
|
|
|
|
|
|
|
|
- CLewaimaiHttpClient::Request(url.c_str(), params, response);
|
|
|
|
|
|
|
+ CLewaimaiHttpClient::Request(url.c_str(), params, response);
|
|
|
|
|
|
|
|
- rapidjson::Document document;
|
|
|
|
|
- document.Parse(response.c_str());
|
|
|
|
|
|
|
+ rapidjson::Document document;
|
|
|
|
|
+ document.Parse(response.c_str());
|
|
|
|
|
|
|
|
- if(document.HasParseError())
|
|
|
|
|
- {
|
|
|
|
|
- LOG_INFO("parse response error!");
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if (document.HasParseError())
|
|
|
|
|
+ {
|
|
|
|
|
+ LOG_INFO("parse response error!");
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- if(!document.HasMember("errcode") || !document.HasMember("errmsg") || !document.HasMember("data"))
|
|
|
|
|
- {
|
|
|
|
|
- LOG_INFO("json error!");
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if (!document.HasMember("errcode") || !document.HasMember("errmsg") || !document.HasMember("data"))
|
|
|
|
|
+ {
|
|
|
|
|
+ LOG_INFO("json error!");
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- rapidjson::Value& v_errcode = document["errcode"];
|
|
|
|
|
- int errcode = v_errcode.GetInt();
|
|
|
|
|
|
|
+ rapidjson::Value& v_errcode = document["errcode"];
|
|
|
|
|
+ int errcode = v_errcode.GetInt();
|
|
|
|
|
|
|
|
- if(errcode != 0)
|
|
|
|
|
- {
|
|
|
|
|
- LOG_INFO("response failed! message:" << document["errmsg"].GetString());
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if (errcode != 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ LOG_INFO("response failed! message:" << document["errmsg"].GetString());
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- //获得数据成功,把分类信息保存起来
|
|
|
|
|
- rapidjson::Value& data = document["data"];
|
|
|
|
|
|
|
+ //获得数据成功,把分类信息保存起来
|
|
|
|
|
+ rapidjson::Value& data = document["data"];
|
|
|
|
|
|
|
|
- rapidjson::Value& v_rows = data["goods_types"];
|
|
|
|
|
|
|
+ rapidjson::Value& v_rows = data["goods_types"];
|
|
|
|
|
|
|
|
- for(rapidjson::SizeType i = 0; i < v_rows.Size(); ++i)
|
|
|
|
|
- {
|
|
|
|
|
- rapidjson::Value& v_row_i = v_rows[i];
|
|
|
|
|
|
|
+ for (rapidjson::SizeType i = 0; i < v_rows.Size(); ++i)
|
|
|
|
|
+ {
|
|
|
|
|
+ rapidjson::Value& v_row_i = v_rows[i];
|
|
|
|
|
|
|
|
- std::string type_id = v_row_i["type_id"].GetString();
|
|
|
|
|
- std::string name = v_row_i["name"].GetString();
|
|
|
|
|
|
|
+ std::string type_id = v_row_i["type_id"].GetString();
|
|
|
|
|
+ std::string name = v_row_i["name"].GetString();
|
|
|
|
|
|
|
|
- CSetting::AddFoodtype(name, type_id);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ CSetting::AddFoodtype(name, type_id);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
//获取厨房打印机的集合
|
|
//获取厨房打印机的集合
|
|
|
std::vector<ChufangPrinter> printers = CSetting::getChufangPrints();
|
|
std::vector<ChufangPrinter> printers = CSetting::getChufangPrints();
|