mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-07-01 22:54:56 +08:00
parent
a5fcbc92d8
commit
ea7d4d648d
@ -13,8 +13,8 @@
|
|||||||
<div class="layui-input-block">
|
<div class="layui-input-block">
|
||||||
<button id="submit-btn" class="layui-btn layui-btn-fluid" lay-submit="true" lay-filter="go">登录并绑定已有帐号</button>
|
<button id="submit-btn" class="layui-btn layui-btn-fluid" lay-submit="true" lay-filter="go">登录并绑定已有帐号</button>
|
||||||
<input type="hidden" name="provider" value="{{ provider }}">
|
<input type="hidden" name="provider" value="{{ provider }}">
|
||||||
<input type="hidden" name="code" value="{{ request.get.code }}">
|
<input type="hidden" name="code" value="{{ request.get('code') }}">
|
||||||
<input type="hidden" name="state" value="{{ request.get.state }}">
|
<input type="hidden" name="state" value="{{ request.get('state') }}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
@ -21,8 +21,8 @@
|
|||||||
<div class="layui-input-block">
|
<div class="layui-input-block">
|
||||||
<button id="cv-submit-btn" class="layui-btn layui-btn-fluid layui-btn-disabled" disabled="disabled" lay-submit="true" lay-filter="go">注册并绑定帐号</button>
|
<button id="cv-submit-btn" class="layui-btn layui-btn-fluid layui-btn-disabled" disabled="disabled" lay-submit="true" lay-filter="go">注册并绑定帐号</button>
|
||||||
<input type="hidden" name="provider" value="{{ provider }}">
|
<input type="hidden" name="provider" value="{{ provider }}">
|
||||||
<input type="hidden" name="code" value="{{ request.get.code }}">
|
<input type="hidden" name="code" value="{{ request.get('code') }}">
|
||||||
<input type="hidden" name="state" value="{{ request.get.state }}">
|
<input type="hidden" name="state" value="{{ request.get('state') }}">
|
||||||
<input id="cv-app-id" type="hidden" value="{{ captcha.app_id }}">
|
<input id="cv-app-id" type="hidden" value="{{ captcha.app_id }}">
|
||||||
<input id="cv-ticket" type="hidden" name="ticket">
|
<input id="cv-ticket" type="hidden" name="ticket">
|
||||||
<input id="cv-rand" type="hidden" name="rand">
|
<input id="cv-rand" type="hidden" name="rand">
|
||||||
|
@ -63,28 +63,30 @@
|
|||||||
<div class="my-nav">
|
<div class="my-nav">
|
||||||
<span class="title">开放登录</span>
|
<span class="title">开放登录</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="connect-tips">已经绑定的第三方帐号</div>
|
{% if connects %}
|
||||||
<div class="connect-list">
|
<div class="connect-tips">已经绑定的第三方帐号</div>
|
||||||
<table class="layui-table">
|
<div class="connect-list">
|
||||||
<tr>
|
<table class="layui-table">
|
||||||
<td>序号</td>
|
|
||||||
<td>提供方</td>
|
|
||||||
<td>用户信息</td>
|
|
||||||
<td>创建日期</td>
|
|
||||||
<td width="15%">操作</td>
|
|
||||||
</tr>
|
|
||||||
{% for connect in connects %}
|
|
||||||
{% set url = url({'for':'home.uc.unconnect','id':connect.id}) %}
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ loop.index }}</td>
|
<td>序号</td>
|
||||||
<td>{{ connect_provider(connect) }}</td>
|
<td>提供方</td>
|
||||||
<td>{{ connect_user(connect) }}</td>
|
<td>用户信息</td>
|
||||||
<td>{{ date('Y-m-d H:i',connect.create_time) }}</td>
|
<td>创建日期</td>
|
||||||
<td><a class="layui-btn layui-btn-danger layui-btn-sm kg-delete" href="javascript:" data-url="{{ url }}" data-tips="确定要解除绑定吗?">解除绑定</a></td>
|
<td width="15%">操作</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% for connect in connects %}
|
||||||
</table>
|
{% set url = url({'for':'home.uc.unconnect','id':connect.id}) %}
|
||||||
</div>
|
<tr>
|
||||||
|
<td>{{ loop.index }}</td>
|
||||||
|
<td>{{ connect_provider(connect) }}</td>
|
||||||
|
<td>{{ connect_user(connect) }}</td>
|
||||||
|
<td>{{ date('Y-m-d H:i',connect.create_time) }}</td>
|
||||||
|
<td><a class="layui-btn layui-btn-danger layui-btn-sm kg-delete" href="javascript:" data-url="{{ url }}" data-tips="确定要解除绑定吗?">解除绑定</a></td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
<div class="connect-tips">支持绑定的第三方帐号</div>
|
<div class="connect-tips">支持绑定的第三方帐号</div>
|
||||||
<div class="oauth-list">
|
<div class="oauth-list">
|
||||||
<a class="layui-icon layui-icon-login-qq login-qq" href="{{ url({'for':'home.oauth.qq'}) }}"></a>
|
<a class="layui-icon layui-icon-login-qq login-qq" href="{{ url({'for':'home.oauth.qq'}) }}"></a>
|
||||||
|
@ -33,7 +33,6 @@ class QQ extends OAuth
|
|||||||
'client_secret' => $this->clientSecret,
|
'client_secret' => $this->clientSecret,
|
||||||
'redirect_uri' => $this->redirectUri,
|
'redirect_uri' => $this->redirectUri,
|
||||||
'grant_type' => 'authorization_code',
|
'grant_type' => 'authorization_code',
|
||||||
'state' => 'ok',
|
|
||||||
];
|
];
|
||||||
|
|
||||||
$response = $this->httpPost(self::ACCESS_TOKEN_URL, $params);
|
$response = $this->httpPost(self::ACCESS_TOKEN_URL, $params);
|
||||||
@ -90,7 +89,7 @@ class QQ extends OAuth
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($result['openid'])) {
|
if (!isset($result['openid'])) {
|
||||||
throw new \Exception("Fetch Openid Failed:{$response}");
|
throw new \Exception("Fetch OpenId Failed:{$response}");
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result['openid'];
|
return $result['openid'];
|
||||||
@ -100,8 +99,8 @@ class QQ extends OAuth
|
|||||||
{
|
{
|
||||||
$data = json_decode($response, true);
|
$data = json_decode($response, true);
|
||||||
|
|
||||||
if ($data['ret'] != 0) {
|
if (isset($data['ret']) && $data['ret'] != 0) {
|
||||||
throw new \Exception("Fetch User Info Failed:{$data['msg']}");
|
throw new \Exception("Fetch User Info Failed:{$response}");
|
||||||
}
|
}
|
||||||
|
|
||||||
$userInfo['id'] = $this->openId;
|
$userInfo['id'] = $this->openId;
|
||||||
|
@ -8,7 +8,7 @@ class WeiBo extends OAuth
|
|||||||
{
|
{
|
||||||
|
|
||||||
const AUTHORIZE_URL = 'https://api.weibo.com/oauth2/authorize';
|
const AUTHORIZE_URL = 'https://api.weibo.com/oauth2/authorize';
|
||||||
const ACCESS_TOKEN_URL = 'https://api.weibo.com/oauth2/oauth2/access_token';
|
const ACCESS_TOKEN_URL = 'https://api.weibo.com/oauth2/access_token';
|
||||||
const USER_INFO_URL = 'https://api.weibo.com/2/users/show.json';
|
const USER_INFO_URL = 'https://api.weibo.com/2/users/show.json';
|
||||||
|
|
||||||
public function getAuthorizeUrl()
|
public function getAuthorizeUrl()
|
||||||
@ -60,8 +60,8 @@ class WeiBo extends OAuth
|
|||||||
private function parseAccessToken($response)
|
private function parseAccessToken($response)
|
||||||
{
|
{
|
||||||
$data = json_decode($response, true);
|
$data = json_decode($response, true);
|
||||||
|
|
||||||
if (!isset($data['access_token']) || isset($data['uid'])) {
|
if (!isset($data['access_token']) || !isset($data['uid'])) {
|
||||||
throw new \Exception("Fetch Access Token Failed:{$response}");
|
throw new \Exception("Fetch Access Token Failed:{$response}");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,8 +74,8 @@ class WeiBo extends OAuth
|
|||||||
{
|
{
|
||||||
$data = json_decode($response, true);
|
$data = json_decode($response, true);
|
||||||
|
|
||||||
if ($data['error_code'] != 0) {
|
if (isset($data['error_code']) && $data['error_code'] != 0) {
|
||||||
throw new \Exception("Fetch User Info Failed:{$data['error']}");
|
throw new \Exception("Fetch User Info Failed:{$response}");
|
||||||
}
|
}
|
||||||
|
|
||||||
$userInfo['id'] = $this->openId;
|
$userInfo['id'] = $this->openId;
|
||||||
|
@ -62,7 +62,7 @@ class WeiXin extends OAuth
|
|||||||
$data = json_decode($response, true);
|
$data = json_decode($response, true);
|
||||||
|
|
||||||
if (isset($data['errcode']) && $data['errcode'] != 0) {
|
if (isset($data['errcode']) && $data['errcode'] != 0) {
|
||||||
throw new \Exception("Fetch Access Token Failed:{$data['errmsg']}");
|
throw new \Exception("Fetch Access Token Failed:{$response}");
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->openId = $data['openid'];
|
$this->openId = $data['openid'];
|
||||||
@ -75,7 +75,7 @@ class WeiXin extends OAuth
|
|||||||
$data = json_decode($response, true);
|
$data = json_decode($response, true);
|
||||||
|
|
||||||
if (isset($data['errcode']) && $data['errcode'] != 0) {
|
if (isset($data['errcode']) && $data['errcode'] != 0) {
|
||||||
throw new \Exception("Fetch User Info Failed:{$data['errmsg']}");
|
throw new \Exception("Fetch User Info Failed:{$response}");
|
||||||
}
|
}
|
||||||
|
|
||||||
$userInfo['id'] = $this->openId;
|
$userInfo['id'] = $this->openId;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user