|
|
@@ -214,6 +214,14 @@ class LoginLogic extends BaseLogic
|
|
|
*/
|
|
|
public static function createAuth($response)
|
|
|
{
|
|
|
+ //判定同一worker_id是否只有一个openid
|
|
|
+ $userAuth = MasterWorkerAuth::where(['worker_id' => $response['user_id']])
|
|
|
+ ->findOrEmpty();
|
|
|
+
|
|
|
+ if(!$userAuth->isEmpty() && !empty($userAuth->openid) && $userAuth->openid != $response['openid']){
|
|
|
+ throw new \Exception('该账号已绑定其他微信');
|
|
|
+ }
|
|
|
+
|
|
|
//先检查openid是否有记录
|
|
|
$isAuth = MasterWorkerAuth::where('openid', '=', $response['openid'])->findOrEmpty();
|
|
|
|
|
|
@@ -241,6 +249,8 @@ class LoginLogic extends BaseLogic
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
//如果没有授权,直接生成一条微信授权记录
|
|
|
MasterWorkerAuth::create([
|
|
|
'worker_id' => $response['user_id'],
|