Class: Wechat::WechatsController
- Inherits:
-
BaseController
- Object
- BaseController
- BaseController
- Wechat::WechatsController
- Defined in:
- app/controllers/wechat/wechats_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/controllers/wechat/wechats_controller.rb', line 16 def create r = Hash.from_xml(request.raw_post).fetch('xml', {}) @receive = @app.receives.build if r['Encrypt'] @receive.encrypt_data = r['Encrypt'] else @receive. = r end @receive.save render plain: @receive.request.to_wechat end |
#show ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'app/controllers/wechat/wechats_controller.rb', line 7 def show if @app.is_a?(WorkApp) echostr, _corp_id = Cipher.unpack(Cipher.decrypt(Base64.decode64(params[:echostr]), @app.encoding_aes_key)) render plain: echostr else render plain: params[:echostr] end end |