Commit 693d5bcb by mingyuan

dingtalk

parent b948cf46
......@@ -3,8 +3,7 @@ module Dingtalk::Api
BASE = 'https://api.dingtalk.com/'
def getuserinfo(union_id)
r = get "v1.0/contact/users/#{union_id}"
r['result']
get "v1.0/contact/users/#{union_id}"
end
end
......
......@@ -3,7 +3,7 @@ module Dingtalk
before_action :set_app, only: [:login]
def info
result = @app.getuserinfo(params[:code])
result = @app.xx(params[:code])
render json: result
end
......
module Dingtalk
class DingtalkUserJob < ApplicationJob
def perform(agency)
agency.store_info
end
end
end
......@@ -6,5 +6,10 @@ module Dingtalk
has_one :new_app, foreign_key: :app_key, primary_key: :app_key
end
def xx(code)
result = api.getuserinfo(code)
new_app.api.getuserinfo(result['unionid'])
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