wang hou sheng 8 months ago
parent 8b5556aaee
commit aebff15ebf
  1. 20
      app/common/library/wxserver/Server.php

@ -566,12 +566,8 @@ class Server
if ($res && !empty($res['authorizer_info']) && !empty($res['authorization_info'])) { if ($res && !empty($res['authorizer_info']) && !empty($res['authorization_info'])) {
$authorizer_info = $res['authorizer_info']; $authorizer_info = $res['authorizer_info'];
$authorization_info = $res['authorization_info']; $authorization_info = $res['authorization_info'];
$insert_data['appid'] = $authorization_info['authorizer_appid'];
$model = new WxserverAccount(); $model = new WxserverAccount();
$account_info = $model->where(['appid' => $insert_data['appid']])->find(); $appid = $authorization_info['authorizer_appid'];
if (!empty($account_info)) {
return;
}
$insert_data['access_token'] = $result['authorization_info']['authorizer_access_token']; $insert_data['access_token'] = $result['authorization_info']['authorizer_access_token'];
$insert_data['refresh_token'] = $authorization_info['authorizer_refresh_token']; $insert_data['refresh_token'] = $authorization_info['authorizer_refresh_token'];
$insert_data['nick_name'] = $authorizer_info['nick_name']; $insert_data['nick_name'] = $authorizer_info['nick_name'];
@ -581,13 +577,19 @@ class Server
$insert_data['principal_name'] = $authorizer_info['principal_name']; $insert_data['principal_name'] = $authorizer_info['principal_name'];
$insert_data['signature'] = $authorizer_info['signature']; $insert_data['signature'] = $authorizer_info['signature'];
$insert_data['store_id'] = $this->getStoreId($authorization_info['authorizer_appid']); $insert_data['store_id'] = $this->getStoreId($authorization_info['authorizer_appid']);
$insert_data['create_time'] = time();
$insert_data['update_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);
} }
} }
} }

Loading…
Cancel
Save