秋·风

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

UNIGUI验证微信服务器的有效性:

////////////////////////////////////////////

//UniGUIServerModuleHTTPCommand

//公众平台验证服务器地址的有效性

////////////////////////////////////////////

procedure TUniServerModule.UniGUIServerModuleHTTPCommand(

  ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo;

  var Handled: Boolean);

begin

    if CheckSignature(ARequestInfo) then//微信验证服务器地址的有效性

    begin

      if ARequestInfo.Params.Values['echostr']<>'' then

      begin

        Handled := true;

        AResponseInfo.CharSet := 'UTF-8';

        AResponseInfo.ContentType := 'UTF-8';

        AResponseInfo.ContentText :=ARequestInfo.Params.Values['echostr'];//签名比较成功后返回echostr的内容就可以。

      end;

    end;

 end;

posted on 2017-05-30 15:38  秋·风  阅读(924)  评论(0编辑  收藏  举报