Commit 1e178158ac73cfc91c42877905b49b9e5c26ebdf

Authored by lanrion
1 parent 9e4355b0
Exists in master

fixed get_login_url bug

README.md
... ... @@ -237,8 +237,6 @@ suite_api.get_corp_token(auth_corpid, permanent_code)
237 237 # 生成授权URL
238 238 suite_api.auth_url(code, uri, state="suite")
239 239  
240   -# 获取登录企业号官网的url
241   -suite_api.get_login_url(ticket, provider_token, target, agentid=nil)
242 240 ```
243 241  
244 242 ## 企业号登录授权
... ... @@ -259,6 +257,9 @@ group_client.auth_login.get_login_info(auth_code, provider_access_token)
259 257  
260 258 # 通过传递provider_secret,获取企业号管理员登录信息
261 259 group_client.auth_login.get_login_info_by_secret(auth_code, provider_secret)
  260 +
  261 +# 获取登录企业号官网的url
  262 +group_client.auth_login.get_login_url(ticket, provider_token, target, agentid=nil)
262 263 ```
263 264  
264 265 ## 异步任务接口
... ...
lib/qy_wechat_api/api/auth_login.rb
... ... @@ -46,6 +46,18 @@ module QyWechatApi
46 46 get_login_info(auth_code, token)
47 47 end
48 48  
  49 + # 获取登录企业号官网的url
  50 + # target可以是:agent_setting、send_msg、contact、3rd_admin
  51 + def get_login_url(ticket, provider_token, target, agentid=nil)
  52 + url = base_url("get_login_url", {provider_access_token: provider_token})
  53 + params = {
  54 + login_ticket: ticket,
  55 + target: target
  56 + }
  57 + params.merge!(agentid: agentid) if agentid.present?
  58 + QyWechatApi.http_post_without_token(url, params)
  59 + end
  60 +
49 61 private
50 62  
51 63 def base_url(api, params={})
... ...
lib/qy_wechat_api/api/service/suite.rb
... ... @@ -66,18 +66,6 @@ module QyWechatApi
66 66 "#{QyWechatApi::SUITE_ENDPOINT}/loginpage?#{params}"
67 67 end
68 68  
69   - # 获取登录企业号官网的url
70   - # target可以是:agent_setting、send_msg、contact、3rd_admin
71   - def get_login_url(ticket, provider_token, target, agentid=nil)
72   - params = {
73   - login_ticket: ticket,
74   - target: target,
75   - provider_access_token: provider_token
76   - }
77   - params.merge!(agentid: agentid) if agentid.present?
78   - http_post("get_login_url", params)
79   - end
80   -
81 69 private
82 70  
83 71 def base_url
... ...