WechatController.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | likeadmin快速开发前后端分离管理后台(PHP版)
  4. // +----------------------------------------------------------------------
  5. // | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
  6. // | 开源版本可自由商用,可去除界面版权logo
  7. // | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
  8. // | github下载:https://github.com/likeshop-github/likeadmin
  9. // | 访问官网:https://www.likeadmin.cn
  10. // | likeadmin团队 版权所有 拥有最终解释权
  11. // +----------------------------------------------------------------------
  12. // | author: likeadminTeam
  13. // +----------------------------------------------------------------------
  14. namespace app\api\controller;
  15. use app\api\logic\WechatLogic;
  16. use app\api\validate\WechatValidate;
  17. /**
  18. * 微信
  19. * Class WechatController
  20. * @package app\api\controller
  21. */
  22. class WechatController extends BaseApiController
  23. {
  24. public array $notNeedLogin = ['jsConfig'];
  25. /**
  26. * @notes 微信JSSDK授权接口
  27. * @return mixed
  28. * @author 段誉
  29. * @date 2023/3/1 11:39
  30. */
  31. public function jsConfig()
  32. {
  33. $params = (new WechatValidate())->goCheck('jsConfig');
  34. $result = WechatLogic::jsConfig($params);
  35. if ($result === false) {
  36. return $this->fail(WechatLogic::getError(), [], 0, 0);
  37. }
  38. return $this->data($result);
  39. }
  40. }