47 lines
1.2 KiB
PHP
47 lines
1.2 KiB
PHP
|
|
<?php
|
|||
|
|
|
|||
|
|
namespace App\Http\Controllers\Api;
|
|||
|
|
|
|||
|
|
use App\BaseApp\BaseController;
|
|||
|
|
use App\Service\WxAppConfigService;
|
|||
|
|
use Illuminate\Http\JsonResponse;
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 小程序应用配置
|
|||
|
|
*/
|
|||
|
|
class WxAppController extends BaseController
|
|||
|
|
{
|
|||
|
|
public function __construct()
|
|||
|
|
{
|
|||
|
|
parent::__construct();
|
|||
|
|
$this->service = WxAppConfigService::getInstance();
|
|||
|
|
$this->insertField = ['code', 'name', 'app_id'];
|
|||
|
|
$this->updateField = ['id'];
|
|||
|
|
$this->notRequest = [
|
|||
|
|
'app_secret', 'mch_id', 'mch_key', 'mch_serial_no', 'mch_private_key',
|
|||
|
|
'platform_public_key', 'notify_url', 'template_code', 'remark', 'name', 'app_id',
|
|||
|
|
];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 启用/停用
|
|||
|
|
* @Method POST
|
|||
|
|
*/
|
|||
|
|
public function status(): JsonResponse
|
|||
|
|
{
|
|||
|
|
return jok(
|
|||
|
|
$this->service->status(request()->post('id'), request()->post('status')),
|
|||
|
|
'操作成功'
|
|||
|
|
);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 按 .env 引导创建/更新一条应用壳子(不含 AppSecret)
|
|||
|
|
* @Method POST
|
|||
|
|
*/
|
|||
|
|
public function initFromEnv(): JsonResponse
|
|||
|
|
{
|
|||
|
|
return jok($this->service->initFromEnv(), '初始化成功');
|
|||
|
|
}
|
|||
|
|
}
|