-
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
8 changed files
with
200 additions
and
1 deletion.
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
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\SetWeChatMpConfigure as SetWeChatMpConfigureRequest; | ||
|
||
class WeChatMp extends Controller | ||
{ | ||
/** | ||
* Get configure. | ||
* @return \Illuminate\Http\JsonResponse | ||
*/ | ||
public function getConfigure(): JsonResponse | ||
{ | ||
$settings = setting('user', 'vendor:wechat-mp', [ | ||
'appid' => '', | ||
'secret' => '', | ||
]); | ||
|
||
return new JsonResponse($settings, Response::HTTP_OK); | ||
} | ||
|
||
/** | ||
* set configure. | ||
* @param \Zhiyi\Plus\Admin\Requests\SetWeChatMpConfigure $request | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function setConfigure(SetWeChatMpConfigureRequest $request) | ||
{ | ||
setting('user')->set('vendor:wechat-mp', [ | ||
'appid' => $request->input('appid'), | ||
'secret' => $request->input('secret'), | ||
]); | ||
|
||
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
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 SetWeChatMpConfigure 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,4 +1,5 @@ | ||
export { default as Easemob } from './easemob'; | ||
export { default as QQ } from './qq'; | ||
export { default as WeChat } from './wechat'; | ||
export { default as Weibo } from './weibo'; | ||
export { default as Weibo } from './weibo'; | ||
export { default as WeChatMp } from './wechat-mp'; |
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="https://mp.weixin.qq.com/">微信公众平台</a>」进行申请。 | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import { wechatMp } from '../../api/vendor'; | ||
export default { | ||
data: () => ({ | ||
form: { | ||
appid: '', | ||
secret: '', | ||
}, | ||
loading: true, | ||
}), | ||
methods: { | ||
onSubmit(event) { | ||
wechatMp.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() { | ||
wechatMp.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