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
d7d569be
Commit
d7d569be
authored
Mar 09, 2015
by
lanrion
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
创建二维码 添加 scene_str 参数
parent
bfb7dcef
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
6 deletions
+12
-6
lib/weixin_authorize/api/qrcode.rb
+10
-4
spec/api/qrcode_spec.rb
+2
-2
No files found.
lib/weixin_authorize/api/qrcode.rb
View file @
d7d569be
...
...
@@ -13,10 +13,13 @@ module WeixinAuthorize
end
# 永久二维码
def
create_qr_limit_scene
(
scene_id
)
# options: scene_id, scene_str
def
create_qr_limit_scene
(
options
)
scene_id
=
options
[
:scene_id
]
scene_str
=
options
[
:scene_str
]
post_url
=
"
#{
qrcode_base_url
}
/create"
qrcode_infos
=
{
action_name:
"QR_LIMIT_SCENE"
}
qrcode_infos
=
qrcode_infos
.
merge
(
action_info
(
scene_id
))
qrcode_infos
=
qrcode_infos
.
merge
(
action_info
(
scene_id
,
scene_str
))
http_post
(
post_url
,
qrcode_infos
)
end
...
...
@@ -31,8 +34,11 @@ module WeixinAuthorize
"/qrcode"
end
def
action_info
(
scene_id
)
{
action_info:
{
scene:
{
scene_id:
scene_id
}}}
def
action_info
(
scene_id
,
scene_str
=
nil
)
scene_info
=
{}
scene_info
[
:scene_id
]
=
scene_id
scene_info
[
:scene_str
]
=
scene_str
if
!
scene_str
.
nil?
{
action_info:
{
scene:
scene_info
}}
end
end
...
...
spec/api/qrcode_spec.rb
View file @
d7d569be
...
...
@@ -8,13 +8,13 @@ describe WeixinAuthorize::Api::Qrcode do
end
it
"#create_qr_limit_scene"
do
response
=
$client
.
create_qr_limit_scene
(
"1234
"
)
response
=
$client
.
create_qr_limit_scene
(
scene_id:
1234
,
scene_str:
"wechat
"
)
expect
(
response
.
code
).
to
eq
(
WeixinAuthorize
::
OK_CODE
)
expect
(
response
.
result
.
keys
).
to
eq
([
"ticket"
,
"url"
])
end
it
"#return_qr_url"
do
response
=
$client
.
create_qr_limit_scene
(
"1234
"
)
response
=
$client
.
create_qr_limit_scene
(
scene_id:
1234
,
scene_str:
"wechat
"
)
qr_url
=
$client
.
qr_code_url
(
response
.
result
[
"ticket"
])
expect
(
response
.
code
).
to
eq
(
WeixinAuthorize
::
OK_CODE
)
expect
(
qr_url
).
to
match
(
/(\S+\.(com|net|org|edu|gov)(\/\S+)?)/
)
...
...
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