通讯录也需要取得令牌
function TQyWeiXinHelp.GetQyWeiXinAPI(Ajson: TJsonObject): string;
var
URL,method: string;
vJson: TJsonObject;
Response: IHTTPResponse;
begin
Result := '';
WeChatErrcode := 0;
WeChatErrMsg := '';
URL := Ajson.S['APIURL'];
method := Ajson.S['method'];
if method='' then method:='Get';
URL := StringReplace(URL, 'access_token=%s',
'access_token=' + WeChatToken, [rfIgnoreCase]);
URL := StringReplace(URL, 'access_token=txl_access_token',
'access_token=' + WeChatTxlToken, [rfIgnoreCase]);
vJson:=TJsonObject.Create;
if method='Get' then
vJson.FromJSON(HttpGet(URL))
else
vJson.FromJSON(HttpPost(URL,WideToUTF8(Ajson.S['Ajson'])));
try
if vJson.Count > 0 then
begin
if vJson.I['errcode'] <> 0 then
begin
Result := vJson.ToJSON;
FWeChatErrcode := vJson.I['errcode'];
FWeChatErrMsg := vJson.S['errmsg'];
Gobal_Help.LogManage.WriteLog('取GetWeiXinAPI!错误信息:' + GetErrorMsgInfo);
end
else
begin
Result := vJson.ToJSON;
end;
end
Finally
FreeAndNil(vJson);
end;
标签:vJson,URL,微信,delphi,Ajson,access,token,通讯录,method From: https://www.cnblogs.com/xionda/p/17155704.html