Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
weixin_authorize
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ikcrm_common
weixin_authorize
Commits
29f216fc
Commit
29f216fc
authored
Mar 16, 2014
by
lanrion
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor user.rb with "http_get" and "http_post" method
parent
45a505f9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
lib/weixin_authorize/api/user.rb
+5
-5
No files found.
lib/weixin_authorize/api/user.rb
View file @
29f216fc
...
@@ -7,21 +7,21 @@ module WeixinAuthorize
...
@@ -7,21 +7,21 @@ module WeixinAuthorize
# https://api.weixin.qq.com/cgi-bin/user/info?access_token=ACCESS_TOKEN&openid=OPENID&lang=zh_CN
# https://api.weixin.qq.com/cgi-bin/user/info?access_token=ACCESS_TOKEN&openid=OPENID&lang=zh_CN
# lang: zh_CN, zh_TW, en
# lang: zh_CN, zh_TW, en
def
user
(
openid
,
lang
=
"zh_CN"
)
def
user
(
openid
,
lang
=
"zh_CN"
)
user_info_url
=
"
#{
user_base_url
}
/info
?
#{
access_token_param
}
&openid=
#{
openid
}
&lang=
#{
lang
}
"
user_info_url
=
"
#{
user_base_url
}
/info"
JSON
.
parse
(
RestClient
.
get
(
user_info_url
)
)
http_get
(
user_info_url
,
{
openid:
openid
,
lang:
lang
}
)
end
end
# https://api.weixin.qq.com/cgi-bin/user/get?access_token=ACCESS_TOKEN&next_openid=NEXT_OPENID
# https://api.weixin.qq.com/cgi-bin/user/get?access_token=ACCESS_TOKEN&next_openid=NEXT_OPENID
# 获取关注者列表
# 获取关注者列表
def
followers
(
next_openid
=
nil
)
def
followers
(
next_openid
=
nil
)
users_url
=
"
#{
user_base_url
}
/get?
#{
access_token_param
}
&next_openid
#{
next_openid
}
"
followers_url
=
"
#{
user_base_url
}
/get
"
JSON
.
parse
(
RestClient
.
get
(
users_url
)
)
http_get
(
followers_url
,
{
next_openid:
next_openid
}
)
end
end
private
private
def
user_base_url
def
user_base_url
"
#{
endpoint
}
/user"
"/user"
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