|
|
|
@ -566,12 +566,8 @@ class Server |
|
|
|
|
if ($res && !empty($res['authorizer_info']) && !empty($res['authorization_info'])) { |
|
|
|
|
$authorizer_info = $res['authorizer_info']; |
|
|
|
|
$authorization_info = $res['authorization_info']; |
|
|
|
|
$insert_data['appid'] = $authorization_info['authorizer_appid']; |
|
|
|
|
$model = new WxserverAccount(); |
|
|
|
|
$account_info = $model->where(['appid' => $insert_data['appid']])->find(); |
|
|
|
|
if (!empty($account_info)) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
$appid = $authorization_info['authorizer_appid']; |
|
|
|
|
$insert_data['access_token'] = $result['authorization_info']['authorizer_access_token']; |
|
|
|
|
$insert_data['refresh_token'] = $authorization_info['authorizer_refresh_token']; |
|
|
|
|
$insert_data['nick_name'] = $authorizer_info['nick_name']; |
|
|
|
@ -581,13 +577,19 @@ class Server |
|
|
|
|
$insert_data['principal_name'] = $authorizer_info['principal_name']; |
|
|
|
|
$insert_data['signature'] = $authorizer_info['signature']; |
|
|
|
|
$insert_data['store_id'] = $this->getStoreId($authorization_info['authorizer_appid']); |
|
|
|
|
$insert_data['create_time'] = time(); |
|
|
|
|
$insert_data['update_time'] = time(); |
|
|
|
|
$model->insertGetId($insert_data); |
|
|
|
|
$exit_id = $model->where(['appid' => $appid])->value('id'); |
|
|
|
|
if ($exit_id) { |
|
|
|
|
$model->update($insert_data, ['id' => $exit_id]); |
|
|
|
|
} else { |
|
|
|
|
$insert_data['appid'] = $appid; |
|
|
|
|
$insert_data['create_time'] = time(); |
|
|
|
|
$model->insertGetId($insert_data); |
|
|
|
|
} |
|
|
|
|
//设置域名信息 |
|
|
|
|
$this->setDomain($insert_data['appid'], $domain); |
|
|
|
|
$this->setDomain($appid, $domain); |
|
|
|
|
//设置隐私 |
|
|
|
|
$this->getPrivacySetting($insert_data['appid']); |
|
|
|
|
$this->getPrivacySetting($appid); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|