SystemServiceSetup.php 1.4 KB

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. declare(strict_types=1);
  3. namespace app\miniapi\service;
  4. final class SystemServiceSetup
  5. {
  6. public static function build(array $capabilities): array
  7. {
  8. $messages = [];
  9. if (!($capabilities['wechat_login'] ?? false)) {
  10. $messages['wechat_login'] = [
  11. 'action' => 'configure',
  12. 'summary' => 'WeChat login is not configured.',
  13. 'steps' => [
  14. 'Set the mini program AppID in water-mini/src/manifest.json.',
  15. 'Set MINI_WECHAT_APPID and MINI_WECHAT_SECRET in server/.env; keep the secret on the server.',
  16. 'Configure the HTTPS API domain in the WeChat mini program console and water-mini/.env.local.',
  17. 'Restart the Webman service after saving configuration.',
  18. 'Verify capabilities.wechat_login from GET /api/mini/v1/config.',
  19. 'Use wx.login and bind the new mini user to a business identity in the admin panel.',
  20. ],
  21. ];
  22. }
  23. if (!($capabilities['test_phone_login'] ?? false)) {
  24. $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.']];
  25. }
  26. return $messages;
  27. }
  28. }