WechatController.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <?php
  2. namespace App\Http\Controllers;
  3. use App\Http\Logic\WechatLogic;
  4. class WechatController extends BaseController
  5. {
  6. /**
  7. * 校验微信服务器
  8. */
  9. public function checkServer($code)
  10. {
  11. $data = WechatLogic::checkServerlogic($code);
  12. return $data;
  13. }
  14. /**
  15. * 设置公众号菜单
  16. * @return \Illuminate\Http\JsonResponse
  17. */
  18. public function setMenu()
  19. {
  20. $data = WechatLogic::setMenuLogic();
  21. return $this->success($data);
  22. }
  23. /**
  24. * 公众号授权回调
  25. */
  26. public function accountCallback()
  27. {
  28. $url = WechatLogic::accountCallbackLogic();
  29. return redirect($url);
  30. }
  31. /**
  32. * @SWG\Post(
  33. * path="/wechat/account/config",
  34. * tags={"公众号"},
  35. * summary="获取公众号配置接口",
  36. * description="获取公众号配置接口",
  37. * produces={"application/json"},
  38. * @SWG\Parameter(
  39. * name="url",
  40. * in="query",
  41. * description="当前页面地址",
  42. * type="string"
  43. * ),
  44. * @SWG\Parameter(
  45. * name="wechat_app_code",
  46. * in="query",
  47. * description="应用编号",
  48. * type="string"
  49. * ),
  50. * @SWG\Response(
  51. * response="200",
  52. * description="success",
  53. * @SWG\Schema(
  54. * @SWG\Property(
  55. * property="appId",
  56. * type="string",
  57. * description="appId"
  58. * ),
  59. * @SWG\Property(
  60. * property="timestamp",
  61. * type="string",
  62. * description="timestamp"
  63. * ),
  64. * @SWG\Property(
  65. * property="nonceStr",
  66. * type="string",
  67. * description="nonceStr"
  68. * ),
  69. * @SWG\Property(
  70. * property="signature",
  71. * type="string",
  72. * description="signature"
  73. * ),
  74. * )
  75. * ),
  76. * @SWG\Response(
  77. * response="403",
  78. * description="fail",
  79. * @SWG\Schema(ref="#/definitions/ErrorBean")
  80. * )
  81. * )
  82. */
  83. public function accountConfig()
  84. {
  85. $data = WechatLogic::accountConfigLogic();
  86. return $this->success($data);
  87. }
  88. }