| 123456789101112131415161718192021222324252627282930313233343536373839404142 |
- <?php
- declare(strict_types=1);
- namespace app\miniapi\service;
- final class SystemServiceSetup
- {
- public static function build(array $capabilities): array
- {
- $messages = [];
- if (!($capabilities['wechat_login'] ?? false)) {
- $messages['wechat_login'] = [
- 'action' => 'configure',
- 'summary' => 'WeChat login is not configured.',
- 'steps' => [
- 'Set the mini program AppID in water-mini/src/manifest.json.',
- 'Set MINI_WECHAT_APPID and MINI_WECHAT_SECRET in server/.env; keep the secret on the server.',
- 'Configure the HTTPS API domain in the WeChat mini program console and water-mini/.env.local.',
- 'Restart the Webman service after saving configuration.',
- 'Verify capabilities.wechat_login from GET /api/mini/v1/config.',
- 'Use wx.login and bind the new mini user to a business identity in the admin panel.',
- ],
- ];
- }
- if (!($capabilities['test_phone_login'] ?? false)) {
- $messages['test_phone_login'] = ['action' => 'optional', 'summary' => 'Local test phone login is disabled.', 'steps' => ['Use APP_ENV=local and MINI_TEST_PHONE_LOGIN=true only for local testing.', 'Restart Webman after changing the setting.']];
- }
- if (($capabilities['sms_login'] ?? false) === false && config('mini_api.sms_login', false) === true) {
- $messages['sms_login'] = [
- 'action' => 'configure',
- 'summary' => 'SMS login is enabled but the provider account is incomplete.',
- 'steps' => [
- 'Set MINI_SMS_USER and MINI_SMS_PASSWORD in server/.env.',
- 'Confirm the provider account has remaining balance.',
- 'Bind the phone to a mini user in the admin panel before sending codes to it.',
- ],
- ];
- }
- return $messages;
- }
- }
|