Delphi XE7 用indy开发微信公众平台所有功能,可刷阅读,可刷赞,可加推广(除微支付)

http://www.cnblogs.com/devinlee/p/4565933.html Delphi XE7 用indy开发微信公众平台所有功能,可刷阅读,可刷赞,可加推广(除微支付) 关注作者的微信公众平台,测试效果 包含微信公众平台的所有功能(除微支付) 示例代码:(如需要全部代码,请加作者微信:Leedege) 复制代码 function UpNews(Num: Integer; AccessToken: String): String; var J: TJSONObject; N: array of TJSONObject; Url: String; temp: String; i: Integer; readnum, ad: TStringList; begin J := TJSONObject.Create; readnum := TStringList.Create; ad := TStringList.Create; ad.LoadFromFile(‘ad.txt‘); SetLength(N, Num); try J.AddPair(‘articles‘, TJSONArray.Create); with J.GetValue(‘articles‘) as TJSONArray do for i := 0 to Num - 1 do begin temp := TNewsMsg(NewsList.Items[i]^).Content; if TNewsMsg(NewsList.Items[i]^).AddTop then temp := TNewsMsg(NewsList.Items[i]^).adTop + temp; readnum.LoadFromFile(‘readnum.txt‘); if TNewsMsg(NewsList.Items[i]^).RefreshReadNum then readnum.Text := StringReplace(readnum.Text, ‘readNum‘, TNewsMsg(NewsList.Items[i]^).readnum, [rfReplaceAll]); if TNewsMsg(NewsList.Items[i]^).RefreshLikeNum then readnum.Text := StringReplace(readnum.Text, ‘likeNum">‘, TNewsMsg(NewsList.Items[i]^).LikeNum, [rfReplaceAll]); if TNewsMsg(NewsList.Items[i]^).SourceURL ‘‘ then readnum.Text := StringReplace(readnum.Text, ‘href=""‘, Format(‘href="%s"‘, [TNewsMsg(NewsList.Items[i]^).SourceURL]), [rfReplaceAll]); temp := temp + readnum.Text; readnum.Clear; if TNewsMsg(NewsList.Items[i]^).AddBottom then temp := temp + ad.Text + TNewsMsg(NewsList.Items[i]^).adBottom; N[i] := TJSONObject.Create; N[i].AddPair(‘thumb_media_id‘, UpMedia(AccessToken, ‘image‘, TNewsMsg(NewsList.Items[i]^).CoverFile)); N[i].AddPair(‘author‘, TNewsMsg(NewsList.Items[i]^).Author); N[i].AddPair(‘title‘, TNewsMsg(NewsList.Items[i]^).Title); N[i].AddPair(‘content_source_url‘, ‘‘); N[i].AddPair(‘content‘, temp); N[i].AddPair(‘digest‘, TNewsMsg(NewsList.Items[i]^).Digest); N[i].AddPair(‘show_cover_pic‘, TNewsMsg(NewsList.Items[i]^) .ShowCover.ToString); Add(N[i]); temp := ‘‘; end; Url := Format(UpNewsUrl, [AccessToken]); temp := PostMethod(Url, UTF8Encode(J.ToString), 1); J := TJSONObject.ParseJSONValue(temp) as TJSONObject; if J.Count > 0 then Result := J.GetValue(‘media_id‘).Value; finally J.Free; readnum.Free; ad.Free; end; end; 复制代码 作者微信:Leedege

Delphi XE7 用indy开发微信公众平台所有功能,可刷阅读,可刷赞,可加推广(除微支付)

上一篇:java 开发微信中回调验证一直提示 解密失败处理(Java)


下一篇:hello-weapp 微信小程序最简示例教程