rails_wechat 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +165 -0
- data/README.md +28 -0
- data/Rakefile +32 -0
- data/app/assets/config/rails_wechat_manifest.js +0 -0
- data/app/controllers/wechat/admin/base_controller.rb +4 -0
- data/app/controllers/wechat/admin/wechat_configs_controller.rb +86 -0
- data/app/controllers/wechat/panel/base_controller.rb +3 -0
- data/app/controllers/wechat/panel/wechat_configs_controller.rb +62 -0
- data/app/controllers/wechat/wechats_controller.rb +27 -0
- data/app/models/rails_wechat/organ.rb +11 -0
- data/app/models/wechat_config.rb +44 -0
- data/app/models/wechat_session.rb +16 -0
- data/app/views/wechat/admin/wechat_configs/_filter.html.erb +8 -0
- data/app/views/wechat/admin/wechat_configs/_form.html.erb +21 -0
- data/app/views/wechat/admin/wechat_configs/_show_table.html.erb +80 -0
- data/app/views/wechat/admin/wechat_configs/_wechat_config.json.jbuilder +21 -0
- data/app/views/wechat/admin/wechat_configs/edit.html.erb +9 -0
- data/app/views/wechat/admin/wechat_configs/edit.js.erb +3 -0
- data/app/views/wechat/admin/wechat_configs/index.html.erb +84 -0
- data/app/views/wechat/admin/wechat_configs/index.json.jbuilder +1 -0
- data/app/views/wechat/admin/wechat_configs/new.html.erb +9 -0
- data/app/views/wechat/admin/wechat_configs/new.js.erb +3 -0
- data/app/views/wechat/admin/wechat_configs/show.html.erb +7 -0
- data/app/views/wechat/admin/wechat_configs/show.js.erb +3 -0
- data/app/views/wechat/admin/wechat_configs/show.json.jbuilder +1 -0
- data/app/views/wechat/panel/wechat_configs/_filter.html.erb +8 -0
- data/app/views/wechat/panel/wechat_configs/_form.html.erb +21 -0
- data/app/views/wechat/panel/wechat_configs/_show_table.html.erb +80 -0
- data/app/views/wechat/panel/wechat_configs/_wechat_config.json.jbuilder +21 -0
- data/app/views/wechat/panel/wechat_configs/edit.html.erb +9 -0
- data/app/views/wechat/panel/wechat_configs/edit.js.erb +3 -0
- data/app/views/wechat/panel/wechat_configs/index.html.erb +84 -0
- data/app/views/wechat/panel/wechat_configs/index.json.jbuilder +1 -0
- data/app/views/wechat/panel/wechat_configs/new.html.erb +9 -0
- data/app/views/wechat/panel/wechat_configs/new.js.erb +3 -0
- data/app/views/wechat/panel/wechat_configs/show.html.erb +7 -0
- data/app/views/wechat/panel/wechat_configs/show.js.erb +3 -0
- data/app/views/wechat/panel/wechat_configs/show.json.jbuilder +1 -0
- data/config/routes.rb +20 -0
- data/lib/rails_wechat.rb +5 -0
- data/lib/rails_wechat/engine.rb +4 -0
- data/lib/rails_wechat/version.rb +3 -0
- data/lib/tasks/rails_wechat_tasks.rake +4 -0
- metadata +114 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d5c80ff6abce8a5e359458416ccb8b73fde5707723cecd7be7258b60d2f92518
|
4
|
+
data.tar.gz: 51b750b8e4e45239dfcb332b8c3e0c1625bca9b2c0ee8896b7984b19a9ef0f8e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7317efb81b3923e539860efdb259184064e56dcc0ff1b945171ef864eccee9e6c21e58f85a00e13b6c195f747841b469da81d66ef04f9a97ce479dbac59db479
|
7
|
+
data.tar.gz: 5433d51109c693a9016e5c482faae2c5f65eb9c9185c11d3c92b3446f2ca219ee781c889ce49910022b15172023cef0127efe1aae4de81760996e9ea569a75e3
|
data/LICENSE
ADDED
@@ -0,0 +1,165 @@
|
|
1
|
+
GNU LESSER GENERAL PUBLIC LICENSE
|
2
|
+
Version 3, 29 June 2007
|
3
|
+
|
4
|
+
Copyright (C) 2019 Mingyuan Qin.
|
5
|
+
Everyone is permitted to copy and distribute verbatim copies
|
6
|
+
of this license document, but changing it is not allowed.
|
7
|
+
|
8
|
+
|
9
|
+
This version of the GNU Lesser General Public License incorporates
|
10
|
+
the terms and conditions of version 3 of the GNU General Public
|
11
|
+
License, supplemented by the additional permissions listed below.
|
12
|
+
|
13
|
+
0. Additional Definitions.
|
14
|
+
|
15
|
+
As used herein, "this License" refers to version 3 of the GNU Lesser
|
16
|
+
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
17
|
+
General Public License.
|
18
|
+
|
19
|
+
"The Library" refers to a covered work governed by this License,
|
20
|
+
other than an Application or a Combined Work as defined below.
|
21
|
+
|
22
|
+
An "Application" is any work that makes use of an interface provided
|
23
|
+
by the Library, but which is not otherwise based on the Library.
|
24
|
+
Defining a subclass of a class defined by the Library is deemed a mode
|
25
|
+
of using an interface provided by the Library.
|
26
|
+
|
27
|
+
A "Combined Work" is a work produced by combining or linking an
|
28
|
+
Application with the Library. The particular version of the Library
|
29
|
+
with which the Combined Work was made is also called the "Linked
|
30
|
+
Version".
|
31
|
+
|
32
|
+
The "Minimal Corresponding Source" for a Combined Work means the
|
33
|
+
Corresponding Source for the Combined Work, excluding any source code
|
34
|
+
for portions of the Combined Work that, considered in isolation, are
|
35
|
+
based on the Application, and not on the Linked Version.
|
36
|
+
|
37
|
+
The "Corresponding Application Code" for a Combined Work means the
|
38
|
+
object code and/or source code for the Application, including any data
|
39
|
+
and utility programs needed for reproducing the Combined Work from the
|
40
|
+
Application, but excluding the System Libraries of the Combined Work.
|
41
|
+
|
42
|
+
1. Exception to Section 3 of the GNU GPL.
|
43
|
+
|
44
|
+
You may convey a covered work under sections 3 and 4 of this License
|
45
|
+
without being bound by section 3 of the GNU GPL.
|
46
|
+
|
47
|
+
2. Conveying Modified Versions.
|
48
|
+
|
49
|
+
If you modify a copy of the Library, and, in your modifications, a
|
50
|
+
facility refers to a function or data to be supplied by an Application
|
51
|
+
that uses the facility (other than as an argument passed when the
|
52
|
+
facility is invoked), then you may convey a copy of the modified
|
53
|
+
version:
|
54
|
+
|
55
|
+
a) under this License, provided that you make a good faith effort to
|
56
|
+
ensure that, in the event an Application does not supply the
|
57
|
+
function or data, the facility still operates, and performs
|
58
|
+
whatever part of its purpose remains meaningful, or
|
59
|
+
|
60
|
+
b) under the GNU GPL, with none of the additional permissions of
|
61
|
+
this License applicable to that copy.
|
62
|
+
|
63
|
+
3. Object Code Incorporating Material from Library Header Files.
|
64
|
+
|
65
|
+
The object code form of an Application may incorporate material from
|
66
|
+
a header file that is part of the Library. You may convey such object
|
67
|
+
code under terms of your choice, provided that, if the incorporated
|
68
|
+
material is not limited to numerical parameters, data structure
|
69
|
+
layouts and accessors, or small macros, inline functions and templates
|
70
|
+
(ten or fewer lines in length), you do both of the following:
|
71
|
+
|
72
|
+
a) Give prominent notice with each copy of the object code that the
|
73
|
+
Library is used in it and that the Library and its use are
|
74
|
+
covered by this License.
|
75
|
+
|
76
|
+
b) Accompany the object code with a copy of the GNU GPL and this license
|
77
|
+
document.
|
78
|
+
|
79
|
+
4. Combined Works.
|
80
|
+
|
81
|
+
You may convey a Combined Work under terms of your choice that,
|
82
|
+
taken together, effectively do not restrict modification of the
|
83
|
+
portions of the Library contained in the Combined Work and reverse
|
84
|
+
engineering for debugging such modifications, if you also do each of
|
85
|
+
the following:
|
86
|
+
|
87
|
+
a) Give prominent notice with each copy of the Combined Work that
|
88
|
+
the Library is used in it and that the Library and its use are
|
89
|
+
covered by this License.
|
90
|
+
|
91
|
+
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
92
|
+
document.
|
93
|
+
|
94
|
+
c) For a Combined Work that displays copyright notices during
|
95
|
+
execution, include the copyright notice for the Library among
|
96
|
+
these notices, as well as a reference directing the user to the
|
97
|
+
copies of the GNU GPL and this license document.
|
98
|
+
|
99
|
+
d) Do one of the following:
|
100
|
+
|
101
|
+
0) Convey the Minimal Corresponding Source under the terms of this
|
102
|
+
License, and the Corresponding Application Code in a form
|
103
|
+
suitable for, and under terms that permit, the user to
|
104
|
+
recombine or relink the Application with a modified version of
|
105
|
+
the Linked Version to produce a modified Combined Work, in the
|
106
|
+
manner specified by section 6 of the GNU GPL for conveying
|
107
|
+
Corresponding Source.
|
108
|
+
|
109
|
+
1) Use a suitable shared library mechanism for linking with the
|
110
|
+
Library. A suitable mechanism is one that (a) uses at run time
|
111
|
+
a copy of the Library already present on the user's computer
|
112
|
+
system, and (b) will operate properly with a modified version
|
113
|
+
of the Library that is interface-compatible with the Linked
|
114
|
+
Version.
|
115
|
+
|
116
|
+
e) Provide Installation Information, but only if you would otherwise
|
117
|
+
be required to provide such information under section 6 of the
|
118
|
+
GNU GPL, and only to the extent that such information is
|
119
|
+
necessary to install and execute a modified version of the
|
120
|
+
Combined Work produced by recombining or relinking the
|
121
|
+
Application with a modified version of the Linked Version. (If
|
122
|
+
you use option 4d0, the Installation Information must accompany
|
123
|
+
the Minimal Corresponding Source and Corresponding Application
|
124
|
+
Code. If you use option 4d1, you must provide the Installation
|
125
|
+
Information in the manner specified by section 6 of the GNU GPL
|
126
|
+
for conveying Corresponding Source.)
|
127
|
+
|
128
|
+
5. Combined Libraries.
|
129
|
+
|
130
|
+
You may place library facilities that are a work based on the
|
131
|
+
Library side by side in a single library together with other library
|
132
|
+
facilities that are not Applications and are not covered by this
|
133
|
+
License, and convey such a combined library under terms of your
|
134
|
+
choice, if you do both of the following:
|
135
|
+
|
136
|
+
a) Accompany the combined library with a copy of the same work based
|
137
|
+
on the Library, uncombined with any other library facilities,
|
138
|
+
conveyed under the terms of this License.
|
139
|
+
|
140
|
+
b) Give prominent notice with the combined library that part of it
|
141
|
+
is a work based on the Library, and explaining where to find the
|
142
|
+
accompanying uncombined form of the same work.
|
143
|
+
|
144
|
+
6. Revised Versions of the GNU Lesser General Public License.
|
145
|
+
|
146
|
+
The Free Software Foundation may publish revised and/or new versions
|
147
|
+
of the GNU Lesser General Public License from time to time. Such new
|
148
|
+
versions will be similar in spirit to the present version, but may
|
149
|
+
differ in detail to address new problems or concerns.
|
150
|
+
|
151
|
+
Each version is given a distinguishing version number. If the
|
152
|
+
Library as you received it specifies that a certain numbered version
|
153
|
+
of the GNU Lesser General Public License "or any later version"
|
154
|
+
applies to it, you have the option of following the terms and
|
155
|
+
conditions either of that published version or of any later version
|
156
|
+
published by the Free Software Foundation. If the Library as you
|
157
|
+
received it does not specify a version number of the GNU Lesser
|
158
|
+
General Public License, you may choose any version of the GNU Lesser
|
159
|
+
General Public License ever published by the Free Software Foundation.
|
160
|
+
|
161
|
+
If the Library as you received it specifies that a proxy can decide
|
162
|
+
whether future versions of the GNU Lesser General Public License shall
|
163
|
+
apply, that proxy's public statement of acceptance of any version is
|
164
|
+
permanent authorization for you to choose that version for the
|
165
|
+
Library.
|
data/README.md
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# RailsWechat
|
2
|
+
Short description and motivation.
|
3
|
+
|
4
|
+
## Usage
|
5
|
+
How to use my plugin.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'rails_wechat'
|
12
|
+
```
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
```bash
|
16
|
+
$ bundle
|
17
|
+
```
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
```bash
|
21
|
+
$ gem install rails_wechat
|
22
|
+
```
|
23
|
+
|
24
|
+
## Contributing
|
25
|
+
Contribution directions go here.
|
26
|
+
|
27
|
+
## License
|
28
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'RailsWechat'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.md')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
|
18
|
+
load 'rails/tasks/engine.rake'
|
19
|
+
|
20
|
+
load 'rails/tasks/statistics.rake'
|
21
|
+
|
22
|
+
require 'bundler/gem_tasks'
|
23
|
+
|
24
|
+
require 'rake/testtask'
|
25
|
+
|
26
|
+
Rake::TestTask.new(:test) do |t|
|
27
|
+
t.libs << 'test'
|
28
|
+
t.pattern = 'test/**/*_test.rb'
|
29
|
+
t.verbose = false
|
30
|
+
end
|
31
|
+
|
32
|
+
task default: :test
|
File without changes
|
@@ -0,0 +1,86 @@
|
|
1
|
+
class Wechat::Admin::WechatConfigsController < Wechat::Admin::BaseController
|
2
|
+
before_action :set_wechat_config, only: [:show, :edit, :update, :destroy]
|
3
|
+
|
4
|
+
def index
|
5
|
+
@wechat_configs = WechatConfig.page(params[:page])
|
6
|
+
end
|
7
|
+
|
8
|
+
def new
|
9
|
+
@wechat_config = WechatConfig.new
|
10
|
+
end
|
11
|
+
|
12
|
+
def create
|
13
|
+
@wechat_config = WechatConfig.new(wechat_config_params)
|
14
|
+
|
15
|
+
respond_to do |format|
|
16
|
+
if @wechat_config.save
|
17
|
+
format.html.phone
|
18
|
+
format.html { redirect_to admin_wechat_configs_url }
|
19
|
+
format.js { redirect_back fallback_location: admin_wechat_configs_url }
|
20
|
+
format.json { render :show }
|
21
|
+
else
|
22
|
+
format.html.phone { render :new }
|
23
|
+
format.html { render :new }
|
24
|
+
format.js { redirect_back fallback_location: admin_wechat_configs_url }
|
25
|
+
format.json { render :show }
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def show
|
31
|
+
end
|
32
|
+
|
33
|
+
def edit
|
34
|
+
end
|
35
|
+
|
36
|
+
def update
|
37
|
+
@wechat_config.assign_attributes(wechat_config_params)
|
38
|
+
|
39
|
+
respond_to do |format|
|
40
|
+
if @wechat_config.save
|
41
|
+
format.html.phone
|
42
|
+
format.html { redirect_to admin_wechat_configs_url }
|
43
|
+
format.js { redirect_back fallback_location: admin_wechat_configs_url }
|
44
|
+
format.json { render :show }
|
45
|
+
else
|
46
|
+
format.html.phone { render :edit }
|
47
|
+
format.html { render :edit }
|
48
|
+
format.js { redirect_back fallback_location: admin_wechat_configs_url }
|
49
|
+
format.json { render :show }
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def destroy
|
55
|
+
@wechat_config.destroy
|
56
|
+
redirect_to admin_wechat_configs_url
|
57
|
+
end
|
58
|
+
|
59
|
+
private
|
60
|
+
def set_wechat_config
|
61
|
+
@wechat_config = WechatConfig.find(params[:id])
|
62
|
+
end
|
63
|
+
|
64
|
+
def wechat_config_params
|
65
|
+
params.fetch(:wechat_config, {}).permit(
|
66
|
+
:environment,
|
67
|
+
:account,
|
68
|
+
:enabled,
|
69
|
+
:appid,
|
70
|
+
:secret,
|
71
|
+
:corpid,
|
72
|
+
:corpsecret,
|
73
|
+
:agentid,
|
74
|
+
:encrypt_mode,
|
75
|
+
:encoding_aes_key,
|
76
|
+
:token,
|
77
|
+
:access_token,
|
78
|
+
:jsapi_ticket,
|
79
|
+
:skip_verify_ssl,
|
80
|
+
:timeout,
|
81
|
+
:trusted_domain_fullname,
|
82
|
+
:created_at
|
83
|
+
)
|
84
|
+
end
|
85
|
+
|
86
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
class Wechat::Panel::WechatConfigsController < Wechat::Panel::BaseController
|
2
|
+
before_action :set_wechat_config, only: [:show, :edit, :update, :destroy]
|
3
|
+
|
4
|
+
def show
|
5
|
+
@wechat_config = current_organ.wechat_config
|
6
|
+
end
|
7
|
+
|
8
|
+
def edit
|
9
|
+
@wechat_config = current_organ.wechat_config
|
10
|
+
end
|
11
|
+
|
12
|
+
def update
|
13
|
+
@wechat_config.assign_attributes(wechat_config_params)
|
14
|
+
|
15
|
+
respond_to do |format|
|
16
|
+
if @wechat_config.save
|
17
|
+
format.html.phone
|
18
|
+
format.html { redirect_to admin_wechat_configs_url }
|
19
|
+
format.js { redirect_back fallback_location: admin_wechat_configs_url }
|
20
|
+
format.json { render :show }
|
21
|
+
else
|
22
|
+
format.html.phone { render :edit }
|
23
|
+
format.html { render :edit }
|
24
|
+
format.js { redirect_back fallback_location: admin_wechat_configs_url }
|
25
|
+
format.json { render :show }
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def destroy
|
31
|
+
@wechat_config.destroy
|
32
|
+
redirect_to admin_wechat_configs_url
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
def set_wechat_config
|
37
|
+
@wechat_config = WechatConfig.find(params[:id])
|
38
|
+
end
|
39
|
+
|
40
|
+
def wechat_config_params
|
41
|
+
params.fetch(:wechat_config, {}).permit(
|
42
|
+
:environment,
|
43
|
+
:account,
|
44
|
+
:enabled,
|
45
|
+
:appid,
|
46
|
+
:secret,
|
47
|
+
:corpid,
|
48
|
+
:corpsecret,
|
49
|
+
:agentid,
|
50
|
+
:encrypt_mode,
|
51
|
+
:encoding_aes_key,
|
52
|
+
:token,
|
53
|
+
:access_token,
|
54
|
+
:jsapi_ticket,
|
55
|
+
:skip_verify_ssl,
|
56
|
+
:timeout,
|
57
|
+
:trusted_domain_fullname,
|
58
|
+
:created_at
|
59
|
+
)
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
class Wechat::WechatsController < ApplicationController
|
2
|
+
wechat_responder account_from_request: Proc.new{ |request| request.params[:id] }
|
3
|
+
|
4
|
+
on :text do |request, content|
|
5
|
+
request.reply.text "echo: #{content}" # Just echo
|
6
|
+
end
|
7
|
+
|
8
|
+
on :event, with: 'subscribe' do |request, content|
|
9
|
+
result_msg = [{
|
10
|
+
title: '欢迎关注',
|
11
|
+
description: '查看数据'
|
12
|
+
}]
|
13
|
+
|
14
|
+
if request[:EventKey] == 'qrscene_1'
|
15
|
+
request.reply.text '签到成功'
|
16
|
+
else
|
17
|
+
request.reply.news(result_msg)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
on :event, with: 'scan' do |request|
|
22
|
+
if request[:EventKey] == '1'
|
23
|
+
request.reply.text '签到成功'
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# Used by wechat gems, do not rename WechatConfig to other name,
|
2
|
+
# Feel free to inherit from other class like ActiveModel::Model
|
3
|
+
class WechatConfig < ActiveRecord::Base
|
4
|
+
validates :environment, presence: true
|
5
|
+
validates :account, presence: true, uniqueness: { scope: [:environment] }
|
6
|
+
validates :token, presence: true
|
7
|
+
validates :encoding_aes_key, presence: { if: :encrypt_mode? }
|
8
|
+
|
9
|
+
validate :app_config_is_valid
|
10
|
+
|
11
|
+
ATTRIBUTES_TO_REMOVE = %w(environment account created_at updated_at enabled)
|
12
|
+
|
13
|
+
def self.get_all_configs(environment)
|
14
|
+
WechatConfig.where(environment: environment, enabled: true).inject({}) do |hash, config|
|
15
|
+
hash[config.account] = config.build_config_hash
|
16
|
+
hash
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def build_config_hash
|
21
|
+
self.as_json(except: ATTRIBUTES_TO_REMOVE)
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def app_config_is_valid
|
27
|
+
if self[:appid].present?
|
28
|
+
# public account
|
29
|
+
if self[:secret].blank?
|
30
|
+
errors.add(:secret, 'cannot be nil when appid is set')
|
31
|
+
end
|
32
|
+
elsif self[:corpid].present?
|
33
|
+
# corp account
|
34
|
+
if self[:corpsecret].blank?
|
35
|
+
errors.add(:corpsecret, 'cannot be nil when corpid is set')
|
36
|
+
end
|
37
|
+
if self[:agentid].blank?
|
38
|
+
errors.add(:agentid, 'cannot be nil when corpid is set')
|
39
|
+
end
|
40
|
+
else
|
41
|
+
errors[:base] << 'Either appid or corpid must be set'
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# Used by wechat gems, do not rename WechatSession to other name,
|
2
|
+
# Feel free to inherit from other class like ActiveModel::Model
|
3
|
+
class WechatSession < ActiveRecord::Base
|
4
|
+
validates :openid, presence: true, uniqueness: true
|
5
|
+
|
6
|
+
# called by wechat gems when user request session
|
7
|
+
def self.find_or_initialize_session(request_message)
|
8
|
+
find_or_initialize_by(openid: request_message[:from_user_name])
|
9
|
+
end
|
10
|
+
|
11
|
+
# called by wechat gems after response Techent server at controller#create
|
12
|
+
def save_session(_response_message)
|
13
|
+
touch unless new_record? # Always refresh updated_at even no change
|
14
|
+
save!
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<%= form_with model: [:admin, @wechat_config] do |f| %>
|
2
|
+
<%= render 'shared/error_messages', target: @wechat_config %>
|
3
|
+
<%= f.text_field :environment, required: true %>
|
4
|
+
<%= f.text_field :account %>
|
5
|
+
<%= f.check_box :enabled %>
|
6
|
+
<%= f.text_field :appid %>
|
7
|
+
<%= f.text_field :secret %>
|
8
|
+
<%= f.text_field :token %>
|
9
|
+
<h4 class="ui dividing center aligned header">Corp</h4>
|
10
|
+
<%= f.text_field :corpid %>
|
11
|
+
<%= f.text_field :corpsecret %>
|
12
|
+
<%= f.text_field :agentid %>
|
13
|
+
<%= f.check_box :encrypt_mode %>
|
14
|
+
<%= f.text_field :encoding_aes_key %>
|
15
|
+
<%= f.text_field :access_token %>
|
16
|
+
<%= f.text_field :jsapi_ticket %>
|
17
|
+
<%= f.check_box :skip_verify_ssl %>
|
18
|
+
<%= f.number_field :timeout %>
|
19
|
+
<%= f.text_field :trusted_domain_fullname %>
|
20
|
+
<%= f.submit %>
|
21
|
+
<% end %>
|
@@ -0,0 +1,80 @@
|
|
1
|
+
<table class="ui very basic large table">
|
2
|
+
<thead>
|
3
|
+
<tr>
|
4
|
+
<th class="six wide">
|
5
|
+
<%= link_to t('.edit'), edit_admin_wechat_config_path(@wechat_config), class: 'ui mini blue right floated button', remote: true %>
|
6
|
+
</th>
|
7
|
+
<th class="ten wide"></th>
|
8
|
+
</tr>
|
9
|
+
</thead>
|
10
|
+
<tbody>
|
11
|
+
<tr>
|
12
|
+
<td class="right aligned"><%= WechatConfig.human_attribute_name(:environment) %></td>
|
13
|
+
<td><%= @wechat_config.environment %></td>
|
14
|
+
</tr>
|
15
|
+
<tr>
|
16
|
+
<td class="right aligned"><%= WechatConfig.human_attribute_name(:account) %></td>
|
17
|
+
<td><%= @wechat_config.account %></td>
|
18
|
+
</tr>
|
19
|
+
<tr>
|
20
|
+
<td class="right aligned"><%= WechatConfig.human_attribute_name(:enabled) %></td>
|
21
|
+
<td><%= @wechat_config.enabled %></td>
|
22
|
+
</tr>
|
23
|
+
<tr>
|
24
|
+
<td class="right aligned"><%= WechatConfig.human_attribute_name(:appid) %></td>
|
25
|
+
<td><%= @wechat_config.appid %></td>
|
26
|
+
</tr>
|
27
|
+
<tr>
|
28
|
+
<td class="right aligned"><%= WechatConfig.human_attribute_name(:secret) %></td>
|
29
|
+
<td><%= @wechat_config.secret %></td>
|
30
|
+
</tr>
|
31
|
+
<tr>
|
32
|
+
<td class="right aligned"><%= WechatConfig.human_attribute_name(:corpid) %></td>
|
33
|
+
<td><%= @wechat_config.corpid %></td>
|
34
|
+
</tr>
|
35
|
+
<tr>
|
36
|
+
<td class="right aligned"><%= WechatConfig.human_attribute_name(:corpsecret) %></td>
|
37
|
+
<td><%= @wechat_config.corpsecret %></td>
|
38
|
+
</tr>
|
39
|
+
<tr>
|
40
|
+
<td class="right aligned"><%= WechatConfig.human_attribute_name(:agentid) %></td>
|
41
|
+
<td><%= @wechat_config.agentid %></td>
|
42
|
+
</tr>
|
43
|
+
<tr>
|
44
|
+
<td class="right aligned"><%= WechatConfig.human_attribute_name(:encrypt_mode) %></td>
|
45
|
+
<td><%= @wechat_config.encrypt_mode %></td>
|
46
|
+
</tr>
|
47
|
+
<tr>
|
48
|
+
<td class="right aligned"><%= WechatConfig.human_attribute_name(:encoding_aes_key) %></td>
|
49
|
+
<td><%= @wechat_config.encoding_aes_key %></td>
|
50
|
+
</tr>
|
51
|
+
<tr>
|
52
|
+
<td class="right aligned"><%= WechatConfig.human_attribute_name(:token) %></td>
|
53
|
+
<td><%= @wechat_config.token %></td>
|
54
|
+
</tr>
|
55
|
+
<tr>
|
56
|
+
<td class="right aligned"><%= WechatConfig.human_attribute_name(:access_token) %></td>
|
57
|
+
<td><%= @wechat_config.access_token %></td>
|
58
|
+
</tr>
|
59
|
+
<tr>
|
60
|
+
<td class="right aligned"><%= WechatConfig.human_attribute_name(:jsapi_ticket) %></td>
|
61
|
+
<td><%= @wechat_config.jsapi_ticket %></td>
|
62
|
+
</tr>
|
63
|
+
<tr>
|
64
|
+
<td class="right aligned"><%= WechatConfig.human_attribute_name(:skip_verify_ssl) %></td>
|
65
|
+
<td><%= @wechat_config.skip_verify_ssl %></td>
|
66
|
+
</tr>
|
67
|
+
<tr>
|
68
|
+
<td class="right aligned"><%= WechatConfig.human_attribute_name(:timeout) %></td>
|
69
|
+
<td><%= @wechat_config.timeout %></td>
|
70
|
+
</tr>
|
71
|
+
<tr>
|
72
|
+
<td class="right aligned"><%= WechatConfig.human_attribute_name(:trusted_domain_fullname) %></td>
|
73
|
+
<td><%= @wechat_config.trusted_domain_fullname %></td>
|
74
|
+
</tr>
|
75
|
+
<tr>
|
76
|
+
<td class="right aligned"><%= WechatConfig.human_attribute_name(:created_at) %></td>
|
77
|
+
<td><%= @wechat_config.created_at %></td>
|
78
|
+
</tr>
|
79
|
+
</tbody>
|
80
|
+
</table>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
json.extract! wechat_config,
|
2
|
+
:id,
|
3
|
+
:environment,
|
4
|
+
:account,
|
5
|
+
:enabled,
|
6
|
+
:appid,
|
7
|
+
:secret,
|
8
|
+
:corpid,
|
9
|
+
:corpsecret,
|
10
|
+
:agentid,
|
11
|
+
:encrypt_mode,
|
12
|
+
:encoding_aes_key,
|
13
|
+
:token,
|
14
|
+
:access_token,
|
15
|
+
:jsapi_ticket,
|
16
|
+
:skip_verify_ssl,
|
17
|
+
:timeout,
|
18
|
+
:trusted_domain_fullname,
|
19
|
+
:created_at,
|
20
|
+
:created_at,
|
21
|
+
:updated_at
|
@@ -0,0 +1,84 @@
|
|
1
|
+
<%= render 'filter' %>
|
2
|
+
|
3
|
+
<table class="ui bottom attached selectable table">
|
4
|
+
<thead>
|
5
|
+
<tr>
|
6
|
+
<th><%= WechatConfig.human_attribute_name(:id) %></th>
|
7
|
+
<th><%= WechatConfig.human_attribute_name(:environment) %></th>
|
8
|
+
<th><%= WechatConfig.human_attribute_name(:account) %></th>
|
9
|
+
<th><%= WechatConfig.human_attribute_name(:enabled) %></th>
|
10
|
+
<th>
|
11
|
+
<p><%= WechatConfig.human_attribute_name(:appid) %></p>
|
12
|
+
<p><%= WechatConfig.human_attribute_name(:secret) %></p>
|
13
|
+
<p><%= WechatConfig.human_attribute_name(:token) %></p>
|
14
|
+
</th>
|
15
|
+
<th>
|
16
|
+
<p><%= WechatConfig.human_attribute_name(:corpid) %></p>
|
17
|
+
<p><%= WechatConfig.human_attribute_name(:corpsecret) %></p>
|
18
|
+
<p><%= WechatConfig.human_attribute_name(:agentid) %></p>
|
19
|
+
</th>
|
20
|
+
<th>
|
21
|
+
<p><%= WechatConfig.human_attribute_name(:encrypt_mode) %></p>
|
22
|
+
<p><%= WechatConfig.human_attribute_name(:encoding_aes_key) %></p>
|
23
|
+
</th>
|
24
|
+
<th>
|
25
|
+
<p>><%= WechatConfig.human_attribute_name(:access_token) %></p>
|
26
|
+
<p><%= WechatConfig.human_attribute_name(:jsapi_ticket) %></p>
|
27
|
+
</th>
|
28
|
+
<th><%= WechatConfig.human_attribute_name(:skip_verify_ssl) %></th>
|
29
|
+
<th><%= WechatConfig.human_attribute_name(:timeout) %></th>
|
30
|
+
<th><%= WechatConfig.human_attribute_name(:trusted_domain_fullname) %></th>
|
31
|
+
<th><%= WechatConfig.human_attribute_name(:created_at) %></th>
|
32
|
+
<th>
|
33
|
+
<%= link_to new_admin_wechat_config_path, remote: true, class: 'ui mini green button' do %>
|
34
|
+
<i class="fas fa-plus"></i><% t('.new') %>
|
35
|
+
<% end %>
|
36
|
+
</th>
|
37
|
+
</tr>
|
38
|
+
</thead>
|
39
|
+
<tbody>
|
40
|
+
<% @wechat_configs.each do |wechat_config| %>
|
41
|
+
<tr>
|
42
|
+
<td><%= wechat_config.id %></td>
|
43
|
+
<td><%= wechat_config.environment %></td>
|
44
|
+
<td><%= wechat_config.account %></td>
|
45
|
+
<td><%= wechat_config.enabled %></td>
|
46
|
+
<td>
|
47
|
+
<p><%= wechat_config.appid %></p>
|
48
|
+
<p><%= wechat_config.secret %></p>
|
49
|
+
<p><%= wechat_config.token %></p>
|
50
|
+
</td>
|
51
|
+
<td>
|
52
|
+
<p><%= wechat_config.corpid %></p>
|
53
|
+
<p><%= wechat_config.corpsecret %></p>
|
54
|
+
<p><%= wechat_config.agentid %></p>
|
55
|
+
</td>
|
56
|
+
<td>
|
57
|
+
<p><%= wechat_config.encrypt_mode %></p>
|
58
|
+
<p><%= wechat_config.encoding_aes_key %></p>
|
59
|
+
</td>
|
60
|
+
<td>
|
61
|
+
<p><%= wechat_config.access_token %></p>
|
62
|
+
<p><%= wechat_config.jsapi_ticket %></p>
|
63
|
+
</td>
|
64
|
+
<td><%= wechat_config.skip_verify_ssl %></td>
|
65
|
+
<td><%= wechat_config.timeout %></td>
|
66
|
+
<td><%= wechat_config.trusted_domain_fullname %></td>
|
67
|
+
<td><time><%= wechat_config.created_at.to_s(:rfc822) %></time></td>
|
68
|
+
<td>
|
69
|
+
<%= link_to admin_wechat_config_path(wechat_config), data: { tooltip: t('.show') }, remote: true, class: 'ui mini circular icon button' do %>
|
70
|
+
<i class="fas fa-eye"></i>
|
71
|
+
<% end %>
|
72
|
+
<%= link_to edit_admin_wechat_config_path(wechat_config), data: { tooltip: t('.edit') }, remote: true, class: 'ui mini circular icon button' do %>
|
73
|
+
<i class="fas fa-pencil-alt"></i>
|
74
|
+
<% end %>
|
75
|
+
<%= link_to admin_wechat_config_path(wechat_config), method: :delete, data: { tooltip: t('.destroy'), confirm: t('.confirm') }, class: 'ui mini circular icon button' do %>
|
76
|
+
<i class="fas fa-trash-alt"></i>
|
77
|
+
<% end %>
|
78
|
+
</td>
|
79
|
+
</tr>
|
80
|
+
<% end %>
|
81
|
+
</tbody>
|
82
|
+
</table>
|
83
|
+
|
84
|
+
<%= paginate @wechat_configs %>
|
@@ -0,0 +1 @@
|
|
1
|
+
json.array! @wechat_configs, partial: 'wechat_config', as: :wechat_config
|
@@ -0,0 +1 @@
|
|
1
|
+
json.partial! 'wechat_config', wechat_config: @wechat_config
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<%= form_with model: [:admin, @wechat_config] do |f| %>
|
2
|
+
<%= render 'shared/error_messages', target: @wechat_config %>
|
3
|
+
<%= f.text_field :environment, required: true %>
|
4
|
+
<%= f.text_field :account %>
|
5
|
+
<%= f.check_box :enabled %>
|
6
|
+
<%= f.text_field :appid %>
|
7
|
+
<%= f.text_field :secret %>
|
8
|
+
<%= f.text_field :token %>
|
9
|
+
<h4 class="ui dividing center aligned header">Corp</h4>
|
10
|
+
<%= f.text_field :corpid %>
|
11
|
+
<%= f.text_field :corpsecret %>
|
12
|
+
<%= f.text_field :agentid %>
|
13
|
+
<%= f.check_box :encrypt_mode %>
|
14
|
+
<%= f.text_field :encoding_aes_key %>
|
15
|
+
<%= f.text_field :access_token %>
|
16
|
+
<%= f.text_field :jsapi_ticket %>
|
17
|
+
<%= f.check_box :skip_verify_ssl %>
|
18
|
+
<%= f.number_field :timeout %>
|
19
|
+
<%= f.text_field :trusted_domain_fullname %>
|
20
|
+
<%= f.submit %>
|
21
|
+
<% end %>
|
@@ -0,0 +1,80 @@
|
|
1
|
+
<table class="ui very basic large table">
|
2
|
+
<thead>
|
3
|
+
<tr>
|
4
|
+
<th class="six wide">
|
5
|
+
<%= link_to t('.edit'), edit_admin_wechat_config_path(@wechat_config), class: 'ui mini blue right floated button', remote: true %>
|
6
|
+
</th>
|
7
|
+
<th class="ten wide"></th>
|
8
|
+
</tr>
|
9
|
+
</thead>
|
10
|
+
<tbody>
|
11
|
+
<tr>
|
12
|
+
<td class="right aligned"><%= WechatConfig.human_attribute_name(:environment) %></td>
|
13
|
+
<td><%= @wechat_config.environment %></td>
|
14
|
+
</tr>
|
15
|
+
<tr>
|
16
|
+
<td class="right aligned"><%= WechatConfig.human_attribute_name(:account) %></td>
|
17
|
+
<td><%= @wechat_config.account %></td>
|
18
|
+
</tr>
|
19
|
+
<tr>
|
20
|
+
<td class="right aligned"><%= WechatConfig.human_attribute_name(:enabled) %></td>
|
21
|
+
<td><%= @wechat_config.enabled %></td>
|
22
|
+
</tr>
|
23
|
+
<tr>
|
24
|
+
<td class="right aligned"><%= WechatConfig.human_attribute_name(:appid) %></td>
|
25
|
+
<td><%= @wechat_config.appid %></td>
|
26
|
+
</tr>
|
27
|
+
<tr>
|
28
|
+
<td class="right aligned"><%= WechatConfig.human_attribute_name(:secret) %></td>
|
29
|
+
<td><%= @wechat_config.secret %></td>
|
30
|
+
</tr>
|
31
|
+
<tr>
|
32
|
+
<td class="right aligned"><%= WechatConfig.human_attribute_name(:corpid) %></td>
|
33
|
+
<td><%= @wechat_config.corpid %></td>
|
34
|
+
</tr>
|
35
|
+
<tr>
|
36
|
+
<td class="right aligned"><%= WechatConfig.human_attribute_name(:corpsecret) %></td>
|
37
|
+
<td><%= @wechat_config.corpsecret %></td>
|
38
|
+
</tr>
|
39
|
+
<tr>
|
40
|
+
<td class="right aligned"><%= WechatConfig.human_attribute_name(:agentid) %></td>
|
41
|
+
<td><%= @wechat_config.agentid %></td>
|
42
|
+
</tr>
|
43
|
+
<tr>
|
44
|
+
<td class="right aligned"><%= WechatConfig.human_attribute_name(:encrypt_mode) %></td>
|
45
|
+
<td><%= @wechat_config.encrypt_mode %></td>
|
46
|
+
</tr>
|
47
|
+
<tr>
|
48
|
+
<td class="right aligned"><%= WechatConfig.human_attribute_name(:encoding_aes_key) %></td>
|
49
|
+
<td><%= @wechat_config.encoding_aes_key %></td>
|
50
|
+
</tr>
|
51
|
+
<tr>
|
52
|
+
<td class="right aligned"><%= WechatConfig.human_attribute_name(:token) %></td>
|
53
|
+
<td><%= @wechat_config.token %></td>
|
54
|
+
</tr>
|
55
|
+
<tr>
|
56
|
+
<td class="right aligned"><%= WechatConfig.human_attribute_name(:access_token) %></td>
|
57
|
+
<td><%= @wechat_config.access_token %></td>
|
58
|
+
</tr>
|
59
|
+
<tr>
|
60
|
+
<td class="right aligned"><%= WechatConfig.human_attribute_name(:jsapi_ticket) %></td>
|
61
|
+
<td><%= @wechat_config.jsapi_ticket %></td>
|
62
|
+
</tr>
|
63
|
+
<tr>
|
64
|
+
<td class="right aligned"><%= WechatConfig.human_attribute_name(:skip_verify_ssl) %></td>
|
65
|
+
<td><%= @wechat_config.skip_verify_ssl %></td>
|
66
|
+
</tr>
|
67
|
+
<tr>
|
68
|
+
<td class="right aligned"><%= WechatConfig.human_attribute_name(:timeout) %></td>
|
69
|
+
<td><%= @wechat_config.timeout %></td>
|
70
|
+
</tr>
|
71
|
+
<tr>
|
72
|
+
<td class="right aligned"><%= WechatConfig.human_attribute_name(:trusted_domain_fullname) %></td>
|
73
|
+
<td><%= @wechat_config.trusted_domain_fullname %></td>
|
74
|
+
</tr>
|
75
|
+
<tr>
|
76
|
+
<td class="right aligned"><%= WechatConfig.human_attribute_name(:created_at) %></td>
|
77
|
+
<td><%= @wechat_config.created_at %></td>
|
78
|
+
</tr>
|
79
|
+
</tbody>
|
80
|
+
</table>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
json.extract! wechat_config,
|
2
|
+
:id,
|
3
|
+
:environment,
|
4
|
+
:account,
|
5
|
+
:enabled,
|
6
|
+
:appid,
|
7
|
+
:secret,
|
8
|
+
:corpid,
|
9
|
+
:corpsecret,
|
10
|
+
:agentid,
|
11
|
+
:encrypt_mode,
|
12
|
+
:encoding_aes_key,
|
13
|
+
:token,
|
14
|
+
:access_token,
|
15
|
+
:jsapi_ticket,
|
16
|
+
:skip_verify_ssl,
|
17
|
+
:timeout,
|
18
|
+
:trusted_domain_fullname,
|
19
|
+
:created_at,
|
20
|
+
:created_at,
|
21
|
+
:updated_at
|
@@ -0,0 +1,84 @@
|
|
1
|
+
<%= render 'filter' %>
|
2
|
+
|
3
|
+
<table class="ui bottom attached selectable table">
|
4
|
+
<thead>
|
5
|
+
<tr>
|
6
|
+
<th><%= WechatConfig.human_attribute_name(:id) %></th>
|
7
|
+
<th><%= WechatConfig.human_attribute_name(:environment) %></th>
|
8
|
+
<th><%= WechatConfig.human_attribute_name(:account) %></th>
|
9
|
+
<th><%= WechatConfig.human_attribute_name(:enabled) %></th>
|
10
|
+
<th>
|
11
|
+
<p><%= WechatConfig.human_attribute_name(:appid) %></p>
|
12
|
+
<p><%= WechatConfig.human_attribute_name(:secret) %></p>
|
13
|
+
<p><%= WechatConfig.human_attribute_name(:token) %></p>
|
14
|
+
</th>
|
15
|
+
<th>
|
16
|
+
<p><%= WechatConfig.human_attribute_name(:corpid) %></p>
|
17
|
+
<p><%= WechatConfig.human_attribute_name(:corpsecret) %></p>
|
18
|
+
<p><%= WechatConfig.human_attribute_name(:agentid) %></p>
|
19
|
+
</th>
|
20
|
+
<th>
|
21
|
+
<p><%= WechatConfig.human_attribute_name(:encrypt_mode) %></p>
|
22
|
+
<p><%= WechatConfig.human_attribute_name(:encoding_aes_key) %></p>
|
23
|
+
</th>
|
24
|
+
<th>
|
25
|
+
<p>><%= WechatConfig.human_attribute_name(:access_token) %></p>
|
26
|
+
<p><%= WechatConfig.human_attribute_name(:jsapi_ticket) %></p>
|
27
|
+
</th>
|
28
|
+
<th><%= WechatConfig.human_attribute_name(:skip_verify_ssl) %></th>
|
29
|
+
<th><%= WechatConfig.human_attribute_name(:timeout) %></th>
|
30
|
+
<th><%= WechatConfig.human_attribute_name(:trusted_domain_fullname) %></th>
|
31
|
+
<th><%= WechatConfig.human_attribute_name(:created_at) %></th>
|
32
|
+
<th>
|
33
|
+
<%= link_to new_admin_wechat_config_path, remote: true, class: 'ui mini green button' do %>
|
34
|
+
<i class="fas fa-plus"></i><% t('.new') %>
|
35
|
+
<% end %>
|
36
|
+
</th>
|
37
|
+
</tr>
|
38
|
+
</thead>
|
39
|
+
<tbody>
|
40
|
+
<% @wechat_configs.each do |wechat_config| %>
|
41
|
+
<tr>
|
42
|
+
<td><%= wechat_config.id %></td>
|
43
|
+
<td><%= wechat_config.environment %></td>
|
44
|
+
<td><%= wechat_config.account %></td>
|
45
|
+
<td><%= wechat_config.enabled %></td>
|
46
|
+
<td>
|
47
|
+
<p><%= wechat_config.appid %></p>
|
48
|
+
<p><%= wechat_config.secret %></p>
|
49
|
+
<p><%= wechat_config.token %></p>
|
50
|
+
</td>
|
51
|
+
<td>
|
52
|
+
<p><%= wechat_config.corpid %></p>
|
53
|
+
<p><%= wechat_config.corpsecret %></p>
|
54
|
+
<p><%= wechat_config.agentid %></p>
|
55
|
+
</td>
|
56
|
+
<td>
|
57
|
+
<p><%= wechat_config.encrypt_mode %></p>
|
58
|
+
<p><%= wechat_config.encoding_aes_key %></p>
|
59
|
+
</td>
|
60
|
+
<td>
|
61
|
+
<p><%= wechat_config.access_token %></p>
|
62
|
+
<p><%= wechat_config.jsapi_ticket %></p>
|
63
|
+
</td>
|
64
|
+
<td><%= wechat_config.skip_verify_ssl %></td>
|
65
|
+
<td><%= wechat_config.timeout %></td>
|
66
|
+
<td><%= wechat_config.trusted_domain_fullname %></td>
|
67
|
+
<td><time><%= wechat_config.created_at.to_s(:rfc822) %></time></td>
|
68
|
+
<td>
|
69
|
+
<%= link_to admin_wechat_config_path(wechat_config), data: { tooltip: t('.show') }, remote: true, class: 'ui mini circular icon button' do %>
|
70
|
+
<i class="fas fa-eye"></i>
|
71
|
+
<% end %>
|
72
|
+
<%= link_to edit_admin_wechat_config_path(wechat_config), data: { tooltip: t('.edit') }, remote: true, class: 'ui mini circular icon button' do %>
|
73
|
+
<i class="fas fa-pencil-alt"></i>
|
74
|
+
<% end %>
|
75
|
+
<%= link_to admin_wechat_config_path(wechat_config), method: :delete, data: { tooltip: t('.destroy'), confirm: t('.confirm') }, class: 'ui mini circular icon button' do %>
|
76
|
+
<i class="fas fa-trash-alt"></i>
|
77
|
+
<% end %>
|
78
|
+
</td>
|
79
|
+
</tr>
|
80
|
+
<% end %>
|
81
|
+
</tbody>
|
82
|
+
</table>
|
83
|
+
|
84
|
+
<%= paginate @wechat_configs %>
|
@@ -0,0 +1 @@
|
|
1
|
+
json.array! @wechat_configs, partial: 'wechat_config', as: :wechat_config
|
@@ -0,0 +1 @@
|
|
1
|
+
json.partial! 'wechat_config', wechat_config: @wechat_config
|
data/config/routes.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Rails.application.routes.draw do
|
2
|
+
|
3
|
+
scope module: :wechat do
|
4
|
+
resources :wechats, only: [:show, :update] do
|
5
|
+
post '' => :create, on: :member
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
scope :my, module: 'wechat/my', as: :my do
|
10
|
+
end
|
11
|
+
|
12
|
+
scope :panel, module: 'wechat/panel', as: 'panel' do
|
13
|
+
resource :wechat_config, excetp: [:new, :create]
|
14
|
+
end
|
15
|
+
|
16
|
+
scope :admin, module: 'wechat/admin', as: :admin do
|
17
|
+
resources :wechat_configs
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
data/lib/rails_wechat.rb
ADDED
metadata
ADDED
@@ -0,0 +1,114 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rails_wechat
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- qinmingyuan
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-05-01 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 6.0.0.rc1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 6.0.0.rc1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: sqlite3
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: Description of RailsWechat.
|
42
|
+
email:
|
43
|
+
- mingyuan0715@foxmail.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- LICENSE
|
49
|
+
- README.md
|
50
|
+
- Rakefile
|
51
|
+
- app/assets/config/rails_wechat_manifest.js
|
52
|
+
- app/controllers/wechat/admin/base_controller.rb
|
53
|
+
- app/controllers/wechat/admin/wechat_configs_controller.rb
|
54
|
+
- app/controllers/wechat/panel/base_controller.rb
|
55
|
+
- app/controllers/wechat/panel/wechat_configs_controller.rb
|
56
|
+
- app/controllers/wechat/wechats_controller.rb
|
57
|
+
- app/models/rails_wechat/organ.rb
|
58
|
+
- app/models/wechat_config.rb
|
59
|
+
- app/models/wechat_session.rb
|
60
|
+
- app/views/wechat/admin/wechat_configs/_filter.html.erb
|
61
|
+
- app/views/wechat/admin/wechat_configs/_form.html.erb
|
62
|
+
- app/views/wechat/admin/wechat_configs/_show_table.html.erb
|
63
|
+
- app/views/wechat/admin/wechat_configs/_wechat_config.json.jbuilder
|
64
|
+
- app/views/wechat/admin/wechat_configs/edit.html.erb
|
65
|
+
- app/views/wechat/admin/wechat_configs/edit.js.erb
|
66
|
+
- app/views/wechat/admin/wechat_configs/index.html.erb
|
67
|
+
- app/views/wechat/admin/wechat_configs/index.json.jbuilder
|
68
|
+
- app/views/wechat/admin/wechat_configs/new.html.erb
|
69
|
+
- app/views/wechat/admin/wechat_configs/new.js.erb
|
70
|
+
- app/views/wechat/admin/wechat_configs/show.html.erb
|
71
|
+
- app/views/wechat/admin/wechat_configs/show.js.erb
|
72
|
+
- app/views/wechat/admin/wechat_configs/show.json.jbuilder
|
73
|
+
- app/views/wechat/panel/wechat_configs/_filter.html.erb
|
74
|
+
- app/views/wechat/panel/wechat_configs/_form.html.erb
|
75
|
+
- app/views/wechat/panel/wechat_configs/_show_table.html.erb
|
76
|
+
- app/views/wechat/panel/wechat_configs/_wechat_config.json.jbuilder
|
77
|
+
- app/views/wechat/panel/wechat_configs/edit.html.erb
|
78
|
+
- app/views/wechat/panel/wechat_configs/edit.js.erb
|
79
|
+
- app/views/wechat/panel/wechat_configs/index.html.erb
|
80
|
+
- app/views/wechat/panel/wechat_configs/index.json.jbuilder
|
81
|
+
- app/views/wechat/panel/wechat_configs/new.html.erb
|
82
|
+
- app/views/wechat/panel/wechat_configs/new.js.erb
|
83
|
+
- app/views/wechat/panel/wechat_configs/show.html.erb
|
84
|
+
- app/views/wechat/panel/wechat_configs/show.js.erb
|
85
|
+
- app/views/wechat/panel/wechat_configs/show.json.jbuilder
|
86
|
+
- config/routes.rb
|
87
|
+
- lib/rails_wechat.rb
|
88
|
+
- lib/rails_wechat/engine.rb
|
89
|
+
- lib/rails_wechat/version.rb
|
90
|
+
- lib/tasks/rails_wechat_tasks.rake
|
91
|
+
homepage: https://github.com/work-design/rails_wechat
|
92
|
+
licenses:
|
93
|
+
- LGPL-3.0
|
94
|
+
metadata: {}
|
95
|
+
post_install_message:
|
96
|
+
rdoc_options: []
|
97
|
+
require_paths:
|
98
|
+
- lib
|
99
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - ">="
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '0'
|
109
|
+
requirements: []
|
110
|
+
rubygems_version: 3.0.3
|
111
|
+
signing_key:
|
112
|
+
specification_version: 4
|
113
|
+
summary: Summary of RailsWechat.
|
114
|
+
test_files: []
|