zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    DPDK安装方法 17.12.13
    numa.h:No such file or directory 解决方法
    17秋 软件工程 第六次作业 Beta冲刺 Scrum3
    17秋 软件工程 第六次作业 Beta冲刺 总结博客
    17秋 软件工程 第六次作业 Beta冲刺 Scrum2
    Paper Reviews and Presentations
    17秋 软件工程 第六次作业 Beta冲刺 Scrum1
    17秋 软件工程 第六次作业 Beta冲刺
    error: could not create '/System/Library/Frameworks/Python.framework/Versions/2.7/share': Operation not permitted
    17秋 软件工程 个人作业 软件产品案例分析
  • 原文地址:https://www.cnblogs.com/devinlee/p/4565933.html
Copyright © 2011-2022 走看看