简单记录一下代码片段,没什么特别内容。参考微信接口API
int CWeChatHttp::get_new_openids_from_old_openids(const std::string& old_app_id, const std::string& access_token, std::list<std::string>& old_openid_lst)
{
int iSucCount = 0;
if (old_openid_lst.size() > 100)
{
return -1;
}
Document doc;
doc.SetObject();
Document::AllocatorType& allocate = doc.GetAllocator();
Value from_appid(StringRef(old_app_id.c_str()));
doc.AddMember("from_appid", from_appid, allocate);
rapidjson::Value openid_list(rapidjson::kArrayType);
std::list<std::string>::iterator it = old_openid_lst.begin();
for (; it != old_openid_lst.end(); ++it)
openid_list.PushBack(StringRef((*it).c_str()), allocate);
doc.