Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
rails_dingtalk
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
other
rails_dingtalk
Commits
724ff421
Commit
724ff421
authored
Sep 06, 2021
by
mingyuan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
app key
parent
651036db
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
10 additions
and
11 deletions
+10
-11
apps_controller.rb
app/controllers/dingtalk/apps_controller.rb
+6
-6
app.rb
app/models/dingtalk/model/app.rb
+1
-1
new_app.rb
app/models/dingtalk/model/app/new_app.rb
+1
-1
login.html.erb
app/views/dingtalk/apps/login.html.erb
+0
-0
login.json.jbuilder
app/views/dingtalk/apps/login.json.jbuilder
+1
-0
index.js
app/views/dingtalk/home/index.js
+1
-1
routes.rb
config/routes.rb
+0
-2
No files found.
app/controllers/dingtalk/apps_controller.rb
View file @
724ff421
module
Dingtalk
module
Dingtalk
class
AppsController
<
BaseController
class
AppsController
<
BaseController
before_action
:set_app
,
only:
[
:login
]
before_action
:set_
new_
app
,
only:
[
:login
]
before_action
:set_
app_by_cor
p
,
only:
[
:info
]
before_action
:set_
normal_ap
p
,
only:
[
:info
]
def
info
def
info
result
=
@app
.
xx
(
params
[
:code
])
result
=
@app
.
xx
(
params
[
:code
])
...
@@ -17,12 +17,12 @@ module Dingtalk
...
@@ -17,12 +17,12 @@ module Dingtalk
end
end
private
private
def
set_app
def
set_
new_
app
@app
=
App
.
find
params
[
:id
]
@app
=
NewlApp
.
find_by
(
app_key:
params
[
:app_key
])
end
end
def
set_
app_by_cor
p
def
set_
normal_ap
p
@app
=
NormalApp
.
find_by
corp_id:
params
[
:corp_id
]
@app
=
NormalApp
.
find_by
(
app_key:
params
[
:app_key
])
end
end
end
end
...
...
app/models/dingtalk/model/app.rb
View file @
724ff421
...
@@ -15,7 +15,7 @@ module Dingtalk
...
@@ -15,7 +15,7 @@ module Dingtalk
attribute
:oauth2_state
,
:string
attribute
:oauth2_state
,
:string
attribute
:jsapi_ticket_expires_at
,
:datetime
attribute
:jsapi_ticket_expires_at
,
:datetime
has_many
:dingtalk_users
,
foreign_key: :appid
,
primary_key: :
corp_id
has_many
:dingtalk_users
,
foreign_key: :appid
,
primary_key: :
app_key
end
end
def
api
def
api
...
...
app/models/dingtalk/model/app/new_app.rb
View file @
724ff421
...
@@ -9,7 +9,7 @@ module Dingtalk
...
@@ -9,7 +9,7 @@ module Dingtalk
def
oauth2_url
(
scope
=
'openid corpid'
,
state:
SecureRandom
.
hex
(
16
),
**
host_options
)
def
oauth2_url
(
scope
=
'openid corpid'
,
state:
SecureRandom
.
hex
(
16
),
**
host_options
)
h
=
{
h
=
{
client_id:
app_key
,
client_id:
app_key
,
redirect_uri:
Rails
.
application
.
routes
.
url_for
(
controller:
'dingtalk/apps'
,
action:
'login'
,
id:
id
,
**
host_options
),
redirect_uri:
Rails
.
application
.
routes
.
url_for
(
controller:
'dingtalk/apps'
,
action:
'login'
,
app_key:
app_key
,
**
host_options
),
response_type:
'code'
,
response_type:
'code'
,
scope:
scope
,
scope:
scope
,
state:
state
,
state:
state
,
...
...
app/views/dingtalk/apps/login.html.erb
0 → 100644
View file @
724ff421
app/views/dingtalk/apps/login.json.jbuilder
0 → 100644
View file @
724ff421
json.dingtalk_user @dingtalk_user.as_json
app/views/dingtalk/home/index.js
View file @
724ff421
...
@@ -17,7 +17,7 @@ dd.ready(() => {
...
@@ -17,7 +17,7 @@ dd.ready(() => {
'Content-Type'
:
'application/json'
'Content-Type'
:
'application/json'
},
},
body
:
JSON
.
stringify
({
body
:
JSON
.
stringify
({
corp_id
:
'ding9f5ed2cec249700e35c2f4657eb6378f
'
,
app_id
:
'xxxx
'
,
code
:
info
.
code
code
:
info
.
code
})
})
}).
then
(
response
=>
{
}).
then
(
response
=>
{
...
...
config/routes.rb
View file @
724ff421
...
@@ -11,8 +11,6 @@ Rails.application.routes.draw do
...
@@ -11,8 +11,6 @@ Rails.application.routes.draw do
resources
:apps
do
resources
:apps
do
collection
do
collection
do
post
:info
post
:info
end
member
do
get
:login
get
:login
end
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment