|
|
@@ -144,16 +144,16 @@ class LoginLogic extends BaseLogic
|
|
|
$isAuth = MasterWorkerAuth::where('openid', '=', $response['openid'])->findOrEmpty();
|
|
|
|
|
|
if (!$isAuth->isEmpty()) {
|
|
|
- if($isAuth->user_id != $response['user_id']) {
|
|
|
+ if($isAuth->worker_id != $response['user_id']) {
|
|
|
throw new \Exception('该微信已被绑定');
|
|
|
}
|
|
|
- if($isAuth->user_id == 0) {
|
|
|
+ if($isAuth->worker_id == 0) {
|
|
|
//更新操作
|
|
|
- $isAuth->user_id = $response['user_id'];
|
|
|
+ $isAuth->worker_id = $response['user_id'];
|
|
|
$isAuth->save();
|
|
|
return true;
|
|
|
}
|
|
|
- if($isAuth->user_id == $response['user_id']) {
|
|
|
+ if($isAuth->worker_id == $response['user_id']) {
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
|
@@ -162,14 +162,14 @@ class LoginLogic extends BaseLogic
|
|
|
//在用unionid找记录,防止生成两个账号,同个unionid的问题
|
|
|
$userAuth = MasterWorkerAuth::where(['unionid' => $response['unionid']])
|
|
|
->findOrEmpty();
|
|
|
- if (!$userAuth->isEmpty() && $userAuth->user_id != $response['user_id']) {
|
|
|
+ if (!$userAuth->isEmpty() && $userAuth->worker_id != $response['user_id']) {
|
|
|
throw new \Exception('该微信已被绑定');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//如果没有授权,直接生成一条微信授权记录
|
|
|
MasterWorkerAuth::create([
|
|
|
- 'user_id' => $response['user_id'],
|
|
|
+ 'worker_id' => $response['user_id'],
|
|
|
'openid' => $response['openid'],
|
|
|
'unionid' => $response['unionid'] ?? '',
|
|
|
'terminal' => $response['terminal'],
|