Delphi XE7 用indy开发微信公众平台所有功能,可刷阅读,可刷赞,可加推广(除微支付)
Posted 我的学习笔记
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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开发微信公众平台所有功能,可刷阅读,可刷赞,可加推广(除微支付)的主要内容,如果未能解决你的问题,请参考以下文章