Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
goods
Project
Project
Details
Activity
Releases
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
bp
goods
Commits
a5c5b054
Commit
a5c5b054
authored
Sep 24, 2021
by
jianghaiming
Browse files
Options
Browse Files
Download
Plain Diff
update:修改
parents
ac116b72
76c680a6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
7 deletions
+13
-7
UserService.php
application/services/user/UserService.php
+13
-7
No files found.
application/services/user/UserService.php
View file @
a5c5b054
...
...
@@ -3,6 +3,7 @@
namespace
App\Services\user
;
use
Api\PhpUtils\Mon\MonUtil
;
use
App\Models\user\mysql\UserWechatBind
;
use
Api\PhpUtils\Http\Request
;
use
App\Services\user\Weixin\WxBizDataCrypt
;;
...
...
@@ -36,11 +37,10 @@ class UserService
public
static
function
wechatLogin
(
$params
)
{
self
::
$code
=
!
empty
(
$params
[
'code'
])
?
$params
[
'code'
]
:
''
;
//小程序授权code
$openid
=
!
empty
(
$params
[
'openid'
])
?
$params
[
'openid'
]
:
''
;
//小程序授权code
$wechatFrom
=
!
empty
(
$params
[
'wechat_from'
])
?
$params
[
'wechat_from'
]
:
1
;
//登陆来源
$appid
=
!
empty
(
$params
[
'appid'
])
?
$params
[
'appid'
]
:
1
;
//登陆来源
$inviteUserId
=
!
empty
(
$params
[
'invite_user_id'
])
?
intval
(
$params
[
'invite_user_id'
])
:
0
;
//邀请用户id
$activityType
=
!
empty
(
$params
[
'activity_type'
])
?
intval
(
$params
[
'activity_type'
])
:
0
;
//活动类型
if
(
empty
(
self
::
$code
)
&&
empty
(
$openid
)
)
{
if
(
empty
(
self
::
$code
))
{
FileLog
::
error
(
"wechatLogin:获取参数为空"
,
json_encode
(
$params
,
JSON_UNESCAPED_UNICODE
),
''
,
'jianghaiming@yidian-inc.com'
);
throw
new
UserException
([
'cus'
=>
0
]);
}
...
...
@@ -51,7 +51,7 @@ class UserService
}
//设置小程序配置
self
::
setWechatConfig
(
$
wechatFrom
);
self
::
setWechatConfig
(
$
appid
);
//获取小程序用户信息
$response
=
self
::
getJscode2session
();
//检查系统是已注册
...
...
@@ -66,7 +66,9 @@ class UserService
'session_key'
=>
!
empty
(
$response
[
'session_key'
])
?
$response
[
'session_key'
]
:
''
,
//默认7200有效期
'invite_user_id'
=>
$inviteUserId
,
'activity_type'
=>
$activityType
,
'create_time'
=>
date
(
"Y-m-d H:i:s"
)
'create_time'
=>
date
(
"Y-m-d H:i:s"
),
'appid'
=>
$appid
,
'wechat_app_id'
=>
self
::
$appid
,
];
$sessionKey
=
!
empty
(
$response
[
'session_key'
])
?
$response
[
'session_key'
]
:
''
;
...
...
@@ -108,7 +110,7 @@ class UserService
public
static
function
setWechatConfig
(
$wechatFrom
)
{
//需要授权微信
if
(
$wechatFrom
==
2
)
{
if
(
$wechatFrom
==
'merchant-pub-deliverer'
)
{
self
::
$appid
=
\Yaf\Registry
::
get
(
'config'
)
->
deliverer
->
wechat
->
appid
;
self
::
$secret
=
\Yaf\Registry
::
get
(
'config'
)
->
deliverer
->
wechat
->
secret
;
}
else
{
...
...
@@ -363,7 +365,11 @@ class UserService
if
(
!
empty
(
$params
[
'phone'
]))
{
$data
[
'phone'
]
=
$params
[
'phone'
];
}
if
(
!
empty
(
$params
[
'wechat_app_id'
]))
{
$data
[
'wechat_app_id'
]
=
$params
[
'wechat_app_id'
];
}
$userList
=
UserWechatBind
::
getRecords
(
$data
);
return
$userList
;
}
...
...
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