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
f0b70fd4
Commit
f0b70fd4
authored
Aug 22, 2021
by
mingyuan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support info api
parent
30039ba0
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
1 deletion
+36
-1
user.rb
app/apis/dingtalk/api/user.rb
+2
-1
apps_controller.rb
app/controllers/dingtalk/apps_controller.rb
+19
-0
index.js
app/views/dingtalk/home/index.js
+10
-0
routes.rb
config/routes.rb
+5
-0
No files found.
app/apis/dingtalk/api/user.rb
View file @
f0b70fd4
...
...
@@ -3,7 +3,8 @@ module Dingtalk::Api
BASE
=
'https://oapi.dingtalk.com/'
def
getuserinfo
(
code
)
post
'topapi/v2/user/getuserinfo'
,
code:
code
r
=
post
'topapi/v2/user/getuserinfo'
,
code:
code
r
[
'result'
]
end
end
...
...
app/controllers/dingtalk/apps_controller.rb
0 → 100644
View file @
f0b70fd4
module
Dingtalk
class
AppsController
<
BaseController
before_action
:set_app
,
only:
[
:login
]
def
info
result
=
@app
.
getuserinfo
(
params
[
:code
])
render
json:
result
end
def
create
end
private
def
set_app
@app
=
App
.
find_by
corp_id:
params
[
:corp_id
]
end
end
end
app/views/dingtalk/home/index.js
View file @
f0b70fd4
...
...
@@ -8,6 +8,16 @@ dd.ready(() => {
div
.
innerText
=
info
.
code
console
.
log
(
info
)
alert
(
info
.
code
)
fetch
(
ele
.
href
,
{
method
:
method
,
headers
:
{
Accept
:
'text/vnd.turbo-stream.html'
}
}).
then
(
response
=>
{
return
response
.
text
()
}).
then
(
body
=>
{
Turbo
.
renderStreamMessage
(
body
)
})
},
onFail
(
res
)
{
alert
(
'dd error: '
+
JSON
.
stringify
(
res
))
...
...
config/routes.rb
View file @
f0b70fd4
...
...
@@ -8,6 +8,11 @@ Rails.application.routes.draw do
controller
:home
do
get
:index
end
resources
:apps
do
collection
do
get
:info
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