Commit 17f3d1af by mingyuan

defautl sass appid

parent 8e7c74b2
......@@ -7,7 +7,7 @@ GIT
GIT
remote: https://github.com/work-design/rails_com.git
revision: 0fa82f6df70ac2222a9a5fdeb8f0d209ba01eeb7
revision: 953ef46899c750d41ea6e09aba71c9376363e1ce
specs:
rails_com (1.2.9)
acme-client
......
......@@ -13,12 +13,13 @@ module Dingtalk::Api
end
end
def get_employee_code(mobile, tenant_id)
def get_employee_code(mobile)
payload = {
areaCode: '86',
namespace: 'local'
namespace: 'local',
tenantId: app.tenant_id,
mobile: mobile
}
payload.merge! mobile: mobile, tenantId: tenant_id
r = post '/mozi/employee/get_by_mobile', payload, base: BASE
......
......@@ -12,6 +12,7 @@ module Dingtalk
:name,
:corp_id,
:agent_id,
:tenant_id,
:app_key,
:app_secret
]
......
......@@ -6,9 +6,9 @@ module Dingtalk
attribute :employee_code, :string
end
def sync_employee_code(mobile, tenant_id, app_key)
app = SaasApp.find_by(app_key: app_key)
info = app.api.get_employee_code(mobile, tenant_id)
def sync_employee_code(mobile, app_key = nil)
app = SaasApp.find_by(app_key: app_key) || SaasApp.first
info = app.api.get_employee_code(mobile)
self.employee_code = info['employeeCode']
self
end
......
......@@ -14,6 +14,7 @@ module Dingtalk
attribute :jsapi_ticket, :string
attribute :oauth2_state, :string
attribute :jsapi_ticket_expires_at, :datetime
attribute :tenant_id, :string, comment: '专有钉钉,租户ID'
has_many :dingtalk_users, foreign_key: :appid, primary_key: :app_key
end
......
......@@ -7,3 +7,4 @@
<p><%= model.app_key %></p>
<p><%= model.app_secret %></p>
</td>
<td><%= model.tenant_id %></td>
......@@ -7,4 +7,5 @@
<p><%= Dingtalk::App.human_attribute_name(:app_key) %></p>
<p><%= Dingtalk::App.human_attribute_name(:app_secret) %></p>
</th>
<th><%= Dingtalk::App.human_attribute_name(:tenant_id) %></th>
<th></th>
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