Commit 693d5bcb by mingyuan

dingtalk

parent b948cf46
...@@ -3,8 +3,7 @@ module Dingtalk::Api ...@@ -3,8 +3,7 @@ module Dingtalk::Api
BASE = 'https://api.dingtalk.com/' BASE = 'https://api.dingtalk.com/'
def getuserinfo(union_id) def getuserinfo(union_id)
r = get "v1.0/contact/users/#{union_id}" get "v1.0/contact/users/#{union_id}"
r['result']
end end
end end
......
...@@ -3,7 +3,7 @@ module Dingtalk ...@@ -3,7 +3,7 @@ module Dingtalk
before_action :set_app, only: [:login] before_action :set_app, only: [:login]
def info def info
result = @app.getuserinfo(params[:code]) result = @app.xx(params[:code])
render json: result render json: result
end end
......
module Dingtalk
class DingtalkUserJob < ApplicationJob
def perform(agency)
agency.store_info
end
end
end
...@@ -6,5 +6,10 @@ module Dingtalk ...@@ -6,5 +6,10 @@ module Dingtalk
has_one :new_app, foreign_key: :app_key, primary_key: :app_key has_one :new_app, foreign_key: :app_key, primary_key: :app_key
end end
def xx(code)
result = api.getuserinfo(code)
new_app.api.getuserinfo(result['unionid'])
end
end end
end end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment