Giter Club home page Giter Club logo

weixin_rails_middleware's Introduction

WeixinRailsMiddleware

Gem Version

This project rocks and uses MIT-LICENSE.

https://rubygems.org/gems/weixin_rails_middleware

已经实现消息体签名及加解密,升级与使用,详见Wiki 实现消息体签名及加解密

微信企业版本

https://github.com/lanrion/qy_wechat

https://github.com/lanrion/qy_wechat_api

使用特别说明

支持Rails版本

已经支持 Rails 3, Rails 4

参考示例

Rails 4: https://github.com/lanrion/weixin_rails_middleware_example

Rails 3: https://github.com/lanrion/weixin_rails_3

相关gem推荐使用

使用公司列表

如果您或者您的公司正在使用当中,欢迎加入此列表:

https://github.com/lanrion/weixin_rails_middleware/wiki/gem-users-list

实现功能

  • 自动验证微信请求。

  • 无需拼接XML格式,只需要使用 ReplyWeixinMessageHelper 辅助方法,即可快速回复。 使用方法: render xml: reply_text_message("Your Message: #{current_message.Content}")

  • 支持自定义token,适合一个用户使用。

  • 支持多用户token: 适合多用户注册网站,每个用户有不同的token,通过 weixin_rails_middleware.rb 配置好存储token的Model与字段名,即可。

  • 文本回复: reply_text_message(content)

  • 音乐回复: reply_music_message(music), generate_music(title, desc, music_url, hq_music_url)

  • 图文回复: reply_news_message(articles), generate_article(title, desc, pic_url, link_url)

  • 视频回复: reply_video_message(video)

  • 语音回复: reply_voice_message(voice)

  • 图片回复: reply_image_message(image)

  • 地理位置回复: 自定义需求。

  • 其他高级API实现:weixin_authorize

如何测试?

安装 ngrok,解压后跑 ngrok 4000

然后会产生以下信息:

Tunnel Status                 online
Version                       1.6/1.5
Forwarding                    http://e0ede89.ngrok.com -> 127.0.0.1:4000
Forwarding                    https://e0ede89.ngrok.com -> 127.0.0.1:4000
Web Interface                 127.0.0.1:4040
# Conn                        67
Avg Conn Time                 839.50ms

域名为 http://e0ede89.ngrok.com。 注意非付费版本域名每次会随机生成,不是固定的。

Ngrok已墙,你懂得的,ngrok 已墙,请使用localtunnel.me,使用方法:

npm install -g localtunnel

$ lt --port 8000
# your url is: https://gqgh.localtunnel.me

贡献你的代码

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature).
  3. Commit your changes (git commit -am 'Add some feature').
  4. Push to the branch (git push origin my-new-feature).
  5. Create new Pull Request.
  6. Test with weixin_rails_middleware_example, and push your changes.

Bugs 和反馈

如果你发现有出现任何的bug,请在 https://github.com/lanrion/weixin_rails_middleware/issues 记录你的bug详细信息,

或者在 Ruby China 开帖 @ruby_sky, 个人邮箱回复速度相对慢.

推荐阅读

参考致谢

在微信回复信息XML的封装方法,借鉴了 rack-weixin 实现,特此感谢!

捐赠支持

如果你觉得我的gem对你有帮助,欢迎打赏支持,:smile:

weixin_rails_middleware's People

Contributors

akirapanda avatar denleyhsiao avatar lanrion avatar u0x01 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.