Code Monkey home page Code Monkey logo

qy_wechat's Introduction

对接企业微信应答: https://github.com/lanrion/qy_wechat

(对应公众号gem:https://github.com/lanrion/weixin_rails_middleware)

企业微信高级API:https://github.com/lanrion/qy_wechat_api

Gem Version

特别注意: 由于一个企业号,可以对应多个应用,可以根据 corp_id 关联你保存对应的企业号应用。

重要说明:后期开发,不再支持Rails 4以下版本!

Rails 3 版本请使用(不再维护):

gem 'qy_wechat', git: 'https://github.com/lanrion/qy_wechat.git', branch: "rails3"

安装

gem 'qy_wechat', '~> 1.0.1'
# 或者
gem 'qy_wechat', git: 'https://github.com/lanrion/qy_wechat.git'

安装。

使用

示例:https://github.com/lanrion/qy_wechat_example

rails g qy_wechat:install
rails g qy_wechat:migration QyApp # QyAapp 你保存企业号应用的Model

分别会产生:

配置保存企业微信账号的Model: qy_wechat_example/config/initializers/qy_wechat_config.rb

这里实现你的业务逻辑: qy_wechat_example/app/decorators/controllers/qy_wechat/qy_wechat_controller_decorator.rb

同时添加以下4个字段:

  • qy_token
  • encoding_aes_key # 长度固定为43个字符,从a-z, A-Z, 0-9共62个字符中选取
  • corp_id
  • qy_secret_key # 用于标志属于哪个应用

最后在你的QyApp中添加如下代码生成你的qy_secret_key:

class QyApp < ActiveRecord::Base

  before_create :init_qy_secret_key

  private

    def init_qy_secret_key
      self.qy_secret_key = SecureRandom.hex(8)
    end
end

生成服务验证URL

qy_wechat_engine.qy_verify_url(qy_app.qy_secret_key)

issue

欢迎提交使用中的bug,或者改进意见:https://github.com/lanrion/qy_wechat/issues/new

捐赠支持

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

qy_wechat's People

Contributors

lanrion avatar colorfulberry 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.