|
| 1 | +<?php |
| 2 | + |
| 3 | +declare(strict_types=1); |
| 4 | + |
| 5 | +/* |
| 6 | + * +----------------------------------------------------------------------+ |
| 7 | + * | ThinkSNS Plus | |
| 8 | + * +----------------------------------------------------------------------+ |
| 9 | + * | Copyright (c) 2018 Chengdu ZhiYiChuangXiang Technology Co., Ltd. | |
| 10 | + * +----------------------------------------------------------------------+ |
| 11 | + * | This source file is subject to version 2.0 of the Apache license, | |
| 12 | + * | that is bundled with this package in the file LICENSE, and is | |
| 13 | + * | available through the world-wide-web at the following url: | |
| 14 | + * | http://www.apache.org/licenses/LICENSE-2.0.html | |
| 15 | + * +----------------------------------------------------------------------+ |
| 16 | + * | Author: Slim Kit Group <master@zhiyicx.com> | |
| 17 | + * | Homepage: www.thinksns.com | |
| 18 | + * +----------------------------------------------------------------------+ |
| 19 | + */ |
| 20 | + |
| 21 | +namespace Zhiyi\Plus\Admin\Controllers\Setting; |
| 22 | + |
| 23 | +use Illuminate\Http\Response; |
| 24 | +use function Zhiyi\Plus\setting; |
| 25 | +use Illuminate\Http\JsonResponse; |
| 26 | +use Zhiyi\Plus\Admin\Controllers\Controller; |
| 27 | +use Zhiyi\Plus\Admin\Requests\SeWeChatConfigure as SeWeChatConfigureRequest; |
| 28 | + |
| 29 | +class WeChat extends Controller |
| 30 | +{ |
| 31 | + /** |
| 32 | + * Get configure. |
| 33 | + * @return \Illuminate\Http\JsonResponse |
| 34 | + */ |
| 35 | + public function getConfigure(): JsonResponse |
| 36 | + { |
| 37 | + $settings = setting('user', 'vendor:wechat', [ |
| 38 | + 'appSecret' => '', |
| 39 | + 'appKey' => '', |
| 40 | + ]); |
| 41 | + |
| 42 | + return new JsonResponse($settings, Response::HTTP_OK); |
| 43 | + } |
| 44 | + |
| 45 | + /** |
| 46 | + * set configure. |
| 47 | + * @param \Zhiyi\Plus\Admin\Requests\SeWeChatConfigureRequest $request |
| 48 | + * @return \Illuminate\Http\Response |
| 49 | + */ |
| 50 | + public function setConfigure(SeWeChatConfigureRequest $request) |
| 51 | + { |
| 52 | + setting('user')->set('vendor:qq', [ |
| 53 | + 'appSecret' => $request->input('appSecret'), |
| 54 | + 'appKey' => $request->input('appKey'), |
| 55 | + ]); |
| 56 | + |
| 57 | + return new Response('', Response::HTTP_NO_CONTENT); |
| 58 | + } |
| 59 | +} |
0 commit comments