Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
loveisland
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
刘小敏
loveisland
Commits
8e747984
Commit
8e747984
authored
May 15, 2026
by
刘小敏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
getsessionid 自动登录增加禁用校验
parent
2c635aae
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
MiniProgram.php
addons/shopro/service/third/wechat/MiniProgram.php
+9
-3
No files found.
addons/shopro/service/third/wechat/MiniProgram.php
View file @
8e747984
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
namespace
addons\shopro\service\third\wechat
;
namespace
addons\shopro\service\third\wechat
;
use
addons\shopro\facade\Wechat
;
use
addons\shopro\facade\Wechat
;
use
app\admin\model\User
;
use
fast\Random
;
use
fast\Random
;
use
app\common\library\Auth
;
use
app\common\library\Auth
;
use
app\admin\model\shopro\ThirdOauth
;
use
app\admin\model\shopro\ThirdOauth
;
...
@@ -110,13 +111,18 @@ class MiniProgram
...
@@ -110,13 +111,18 @@ class MiniProgram
if
(
empty
(
$decryptData
[
'session_key'
]))
{
if
(
empty
(
$decryptData
[
'session_key'
]))
{
error_stop
(
'未获取到登陆态, 请重试'
,
-
1
);
error_stop
(
'未获取到登陆态, 请重试'
,
-
1
);
}
}
$auto_login
=
$this
->
payload
[
'auto_login'
]
??
false
;
// 自动登录流程
// 自动登录流程
$auto_login
=
$this
->
payload
[
'auto_login'
]
??
false
;
if
(
$auto_login
)
{
if
(
$auto_login
)
{
$oauthInfo
=
ThirdOauth
::
getByOpenid
(
$decryptData
[
'openid'
]);
$oauthInfo
=
ThirdOauth
::
getByOpenid
(
$decryptData
[
'openid'
]);
if
(
$oauthInfo
&&
$oauthInfo
->
user_id
)
{
if
(
$oauthInfo
&&
$oauthInfo
->
user_id
)
{
$user
=
User
::
find
(
$oauthInfo
->
user_id
);
if
(
$user
[
'status'
]
==
'disable'
)
{
return
[
'session_id'
=>
''
,
'auto_login'
=>
false
,
'disabled'
=>
true
,
'message'
=>
'您的账号已被禁用,请联系管理员'
];
}
$auth
=
Auth
::
instance
();
$auth
=
Auth
::
instance
();
$ret
=
$auth
->
direct
(
$oauthInfo
->
user_id
);
$ret
=
$auth
->
direct
(
$oauthInfo
->
user_id
);
if
(
$ret
)
{
if
(
$ret
)
{
...
@@ -124,7 +130,7 @@ class MiniProgram
...
@@ -124,7 +130,7 @@ class MiniProgram
}
}
}
}
}
}
$session_id
=
Random
::
uuid
();
$session_id
=
Random
::
uuid
();
redis_cache
(
$session_id
,
$decryptData
,
60
*
60
*
24
*
7
);
// session_key缓存保留一周
redis_cache
(
$session_id
,
$decryptData
,
60
*
60
*
24
*
7
);
// session_key缓存保留一周
return
[
'session_id'
=>
$session_id
,
'auto_login'
=>
$auto_login
];
return
[
'session_id'
=>
$session_id
,
'auto_login'
=>
$auto_login
];
...
...
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