-
Notifications
You must be signed in to change notification settings - Fork 473
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
205 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* +----------------------------------------------------------------------+ | ||
* | ThinkSNS Plus | | ||
* +----------------------------------------------------------------------+ | ||
* | Copyright (c) 2018 Chengdu ZhiYiChuangXiang Technology Co., Ltd. | | ||
* +----------------------------------------------------------------------+ | ||
* | This source file is subject to version 2.0 of the Apache license, | | ||
* | that is bundled with this package in the file LICENSE, and is | | ||
* | available through the world-wide-web at the following url: | | ||
* | http://www.apache.org/licenses/LICENSE-2.0.html | | ||
* +----------------------------------------------------------------------+ | ||
* | Author: Slim Kit Group <[email protected]> | | ||
* | Homepage: www.thinksns.com | | ||
* +----------------------------------------------------------------------+ | ||
*/ | ||
|
||
namespace Zhiyi\Plus\Admin\Controllers\Setting; | ||
|
||
use Illuminate\Http\Response; | ||
use function Zhiyi\Plus\setting; | ||
use Illuminate\Http\JsonResponse; | ||
use Zhiyi\Plus\Admin\Controllers\Controller; | ||
use Zhiyi\Plus\Admin\Requests\SetWeiboConfigure as SetWeiboConfigureRequest; | ||
|
||
class Weibo extends Controller | ||
{ | ||
/** | ||
* Get configure. | ||
* @return \Illuminate\Http\JsonResponse | ||
*/ | ||
public function getConfigure(): JsonResponse | ||
{ | ||
$settings = setting('user', 'vendor:weibo', [ | ||
'secret' => '', | ||
'appId' => '', | ||
]); | ||
|
||
return new JsonResponse($settings, Response::HTTP_OK); | ||
} | ||
|
||
/** | ||
* set configure. | ||
* @param \Zhiyi\Plus\Admin\Requests\SetWeiboConfigureRequest $request | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function setConfigure(SetWeiboConfigureRequest $request) | ||
{ | ||
setting('user')->set('vendor:weibo', [ | ||
'secret' => $request->input('secret'), | ||
'appId' => $request->input('appId'), | ||
]); | ||
|
||
return new Response('', Response::HTTP_NO_CONTENT); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* +----------------------------------------------------------------------+ | ||
* | ThinkSNS Plus | | ||
* +----------------------------------------------------------------------+ | ||
* | Copyright (c) 2018 Chengdu ZhiYiChuangXiang Technology Co., Ltd. | | ||
* +----------------------------------------------------------------------+ | ||
* | This source file is subject to version 2.0 of the Apache license, | | ||
* | that is bundled with this package in the file LICENSE, and is | | ||
* | available through the world-wide-web at the following url: | | ||
* | http://www.apache.org/licenses/LICENSE-2.0.html | | ||
* +----------------------------------------------------------------------+ | ||
* | Author: Slim Kit Group <[email protected]> | | ||
* | Homepage: www.thinksns.com | | ||
* +----------------------------------------------------------------------+ | ||
*/ | ||
|
||
namespace Zhiyi\Plus\Admin\Requests; | ||
|
||
use Illuminate\Foundation\Http\FormRequest; | ||
|
||
class SetWeiboConfigure extends FormRequest | ||
{ | ||
/** | ||
* Determine if the user is authorized to make this request. | ||
* | ||
* @return bool | ||
* @author Seven Du <[email protected]> | ||
*/ | ||
public function authorize(): bool | ||
{ | ||
return true; | ||
} | ||
|
||
/** | ||
* Get the validation rules that apply to the request. | ||
* | ||
* @return array | ||
* @author Seven Du <[email protected]> | ||
*/ | ||
public function rules(): array | ||
{ | ||
return [ | ||
'appId' => 'required|string', | ||
'secret' => 'required|string', | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export { default as Easemob } from './easemob'; | ||
export { default as QQ } from './qq'; | ||
export { default as WeChat } from './wechat'; | ||
export { default as WeChat } from './wechat'; | ||
export { default as Weibo } from './weibo'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
<template> | ||
<div class="container-fluid"> | ||
<div class="row"> | ||
<div class="col-md-7"> | ||
<div class="panel panel-default"> | ||
<div class="panel-heading">微博登录</div> | ||
<div class="panel-body"> | ||
<sb-ui-loading v-if="loading" /> | ||
<form class="form-horizontal" v-else> | ||
|
||
<!-- App id --> | ||
<div class="form-group"> | ||
<label class="col-sm-3 control-label">App ID</label> | ||
<div class="col-sm-9"> | ||
<input type="text" class="form-control" v-model="form.appId"> | ||
</div> | ||
</div> | ||
|
||
<!-- Secret --> | ||
<div class="form-group"> | ||
<label class="col-sm-3 control-label">Secret</label> | ||
<div class="col-sm-9"> | ||
<input type="text" class="form-control" v-model="form.secret"> | ||
</div> | ||
</div> | ||
|
||
<!-- 提交按钮 --> | ||
<div class="form-group"> | ||
<div class="col-sm-9 col-sm-offset-3"> | ||
<ui-button type="button" class="btn btn-primary" @click="onSubmit" /> | ||
</div> | ||
</div> | ||
|
||
</form> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="col-md-5"> | ||
<div class="panel panel-default"> | ||
<div class="panel-heading">帮助</div> | ||
<div class="panel-body"> | ||
新浪微博登录登录需要配置的数据,请前往「<a target="_blank" href="http://open.weibo.com/">微博·开放平台</a>」进行申请。 | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import { weibo } from '../../api/vendor'; | ||
export default { | ||
data: () => ({ | ||
form: { | ||
appId: '', | ||
secret: '', | ||
}, | ||
loading: true, | ||
}), | ||
methods: { | ||
onSubmit(event) { | ||
weibo.update(this.form).then(() => { | ||
this.$store.dispatch("alert-open", { type: "success", message: '提交成功' }); | ||
}).catch(({ response: { data: message = "提交失败,请刷新页面重试!" } }) => { | ||
this.$store.dispatch("alert-open", { type: "danger", message }); | ||
}).finally(event.stopProcessing); | ||
} | ||
}, | ||
created() { | ||
weibo.get().then(({ data }) => { | ||
this.loading = false; | ||
this.form = data; | ||
}).catch(({ response: { data: message = "获取失败,请刷新页面重试!" } }) => { | ||
this.$store.dispatch("alert-open", { type: "danger", message }); | ||
}); | ||
} | ||
} | ||
</script> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters