Sha256: 161d6a8e71339646ea28886eacb45e5451a5c9ed27c4bf1a1ee7a424477e7259

Contents?: true

Size: 687 Bytes

Versions: 2

Compression:

Stored size: 687 Bytes

Contents

require "pp"
module EricWeixin
  class WeixinController < ActionController::Base
    # 第一次接入时,用于微信服务器验证开者服务器的真实性。
    def index
      render  :text => params[:echostr]
    end

    def reply
      request_body = request.body.read
      weixin_secret_key = ::EricWeixin::PublicAccount.get_secret params[:app_id]

      "message from wechat: ".to_logger
      request_body.to_logger
      weixin_message = MultiXml.parse(request_body).deep_symbolize_keys[:xml]

      message = ::EricWeixin::ReplyMessageRule.process_rule(weixin_message, weixin_secret_key)
      render xml: message
    end

    def aa
      @ee = 12
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
eric_weixin-0.0.4 lib/eric_weixin/app/controllers/weixin/weixin_controller.rb
eric_weixin-0.0.3 lib/eric_weixin/app/controllers/weixin/weixin_controller.rb