Config.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | Niucloud-admin 企业快速开发的saas管理平台
  4. // +----------------------------------------------------------------------
  5. // | 官方网址:https://www.niucloud.com
  6. // +----------------------------------------------------------------------
  7. // | niucloud团队 版权所有 开源版本可自由商用
  8. // +----------------------------------------------------------------------
  9. // | Author: Niucloud Team
  10. // +----------------------------------------------------------------------
  11. namespace app\adminapi\controller\weapp;
  12. use app\service\admin\weapp\WeappConfigService;
  13. use core\base\BaseAdminController;
  14. use think\Response;
  15. class Config extends BaseAdminController
  16. {
  17. /**
  18. * 获取微信小程序配置信息
  19. * @return Response
  20. */
  21. public function get()
  22. {
  23. return success((new WeappConfigService())->getWeappConfig());
  24. }
  25. /**
  26. * 设置微信小程序配置信息
  27. * @return Response
  28. */
  29. public function set()
  30. {
  31. $data = $this->request->params([
  32. ['weapp_name', ''],
  33. ['weapp_original', ''],
  34. ['app_id', ''],
  35. ['app_secret', ''],
  36. ['token', ''],
  37. ['encoding_aes_key', ''],
  38. ['qr_code', ''],
  39. ['encryption_type', ''],
  40. ['upload_private_key', '']
  41. ]);
  42. $this->validate($data, 'app\validate\channel\Weapp.set');
  43. (new WeappConfigService())->setWeappConfig($data);
  44. return success('SET_SUCCESS');
  45. }
  46. }