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
7b649ffd
Commit
7b649ffd
authored
Dec 25, 2015
by
lanrion
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
synchronize get_access_token
parent
042497e8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
3 deletions
+8
-3
lib/weixin_authorize/client.rb
+8
-3
No files found.
lib/weixin_authorize/client.rb
View file @
7b649ffd
# encoding: utf-8
# encoding: utf-8
require
"monitor"
require
"redis"
require
"redis"
require
'digest/md5'
require
'digest/md5'
module
WeixinAuthorize
module
WeixinAuthorize
class
Client
class
Client
include
MonitorMixin
include
Api
::
User
include
Api
::
User
include
Api
::
Menu
include
Api
::
Menu
include
Api
::
Custom
include
Api
::
Custom
...
@@ -20,18 +24,19 @@ module WeixinAuthorize
...
@@ -20,18 +24,19 @@ module WeixinAuthorize
# options: redis_key, custom_access_token
# options: redis_key, custom_access_token
def
initialize
(
app_id
,
app_secret
,
options
=
{})
def
initialize
(
app_id
,
app_secret
,
options
=
{})
@app_id
=
app_id
@app_id
=
app_id
@app_secret
=
app_secret
@app_secret
=
app_secret
@jsticket_expired_at
=
@expired_at
=
Time
.
now
.
to_i
@jsticket_expired_at
=
@expired_at
=
Time
.
now
.
to_i
@redis_key
=
security_redis_key
(
options
[
:redis_key
]
||
"weixin_
#{
app_id
}
"
)
@redis_key
=
security_redis_key
(
options
[
:redis_key
]
||
"weixin_
#{
app_id
}
"
)
@jsticket_redis_key
=
security_redis_key
(
"js_sdk_
#{
app_id
}
"
)
@jsticket_redis_key
=
security_redis_key
(
"js_sdk_
#{
app_id
}
"
)
@custom_access_token
=
options
[
:custom_access_token
]
@custom_access_token
=
options
[
:custom_access_token
]
super
()
# Monitor#initialize
end
end
# return token
# return token
def
get_access_token
def
get_access_token
return
custom_access_token
if
!
custom_access_token
.
nil?
return
custom_access_token
if
!
custom_access_token
.
nil?
token_store
.
access_token
synchronize
{
token_store
.
access_token
}
end
end
# 检查appid和app_secret是否有效。
# 检查appid和app_secret是否有效。
...
...
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