routes.php 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <?php
  2. use App\Admin\Controllers\FourActivityController;
  3. use App\Admin\Controllers\OpenWeixinController;
  4. use App\Admin\Controllers\RemoteSsoController;
  5. use EasyWeChat\Factory;
  6. use EasyWeChat\OpenPlatform\Server\Guard;
  7. use Encore\Admin\Facades\Admin;
  8. use Illuminate\Routing\Router;
  9. use Illuminate\Support\Facades\Route;
  10. Admin::routes();
  11. Route::group([
  12. 'prefix' => config('admin.route.prefix'),
  13. 'namespace' => config('admin.route.namespace'),
  14. 'middleware' => config('admin.route.middleware'),
  15. 'as' => config('admin.route.prefix') . '.',
  16. ], function (Router $router) {
  17. $router->get('/', 'HomeController@index')->name('home');
  18. //上传图片
  19. $router->resource('upload', 'UploadController');
  20. //Banner管理
  21. $router->resource('banner', 'BannerController');
  22. //专家来了-一级栏目管理
  23. $router->resource('specialist_column', 'SpecialistColumnController');
  24. //专家来了-二级栏目管理
  25. $router->resource('specialist_column_second', 'SpecialistColumnSecondController');
  26. //只显示对应的二级栏目
  27. $router->get('/second_column', 'SpecialistColumnSecondController@secondCloumn')->name('second_column');
  28. //专家来了-内容管理
  29. $router->resource('specialist_content', 'SpecialistContentController');
  30. //专家来了-标签管理
  31. $router->resource('specialist_tag', 'SpecialistColumnTagController');
  32. //只显示对应的标签列表
  33. $router->get('/tags', 'SpecialistColumnTagController@tags')->name('tags');
  34. //心理大厅-训练-分类
  35. $router->resource('train_category', 'TrainCategoryController');
  36. //获取下级分类
  37. $router->get('/lowerLevel', 'TrainCategoryController@lowerLevel');
  38. //心理大厅-训练-内容-课程
  39. $router->resource('mentality_drill_subject', 'MentalityDrillsSubjectController');
  40. //心理大厅-训练-内容
  41. $router->resource('mentality-drills', 'TrainDrillController');
  42. //心理大厅-训练-内容-音视频
  43. $router->resource('mentality-drill-extends', 'MentalityDrillExtendController');
  44. //心情等级
  45. $router->resource('diary-mood-levels', 'DiaryMoodLevelController');
  46. //心情标签
  47. $router->resource('diary-mood-tags', 'DiaryMoodTagController');
  48. //睡眠等级
  49. $router->resource('diary-sleep-levels', 'DiarySleepLevelController');
  50. //量表分类
  51. $router->resource('scale-categories', 'ScaleCategoryController');
  52. //量表
  53. $router->get('/scale_second_category', 'ScaleController@getSecondCategory');
  54. $router->resource('scales', 'ScaleController');
  55. //系统配制
  56. $router->resource('sys-configs', 'SysConfigController');
  57. //APP版本
  58. $router->resource('sys-versions', 'SysVersionController');
  59. //活动
  60. $router->resource('activities', 'FourActivityController');
  61. //活动区域
  62. $router->resource('activity-ranges', 'ActivityRangeController');
  63. //聊天
  64. $router->resource('chat', 'ChatController');
  65. //远程授权登录
  66. $router->get('remoteSso', "RemoteSsoController@login");
  67. $router->get('admin_config', "AdminConfigController@index");
  68. // $router->post('send_im_message', 'SendImMessageController@sendImMessage')->name('send_im_message');
  69. // $router->get('get_im_message_list', 'SendImMessageController@getImMessageList')->name('get_im_message_list');
  70. // $router->get('get_im_message_detail', 'SendImMessageController@getImMessageDetail')->name('get_im_message_detail');
  71. });
  72. // Route::group([
  73. // 'prefix' => config('admin.route.prefix'),
  74. // 'namespace' => config('admin.route.namespace'),
  75. // 'middleware' => ['psyUserSso'],
  76. // 'as' => config('admin.route.prefix') . '.',
  77. // ], function (Router $router) {
  78. // $router->resource('activities', 'FourActivityController');
  79. // });
  80. Route::get('/admin/ssoIndex', [FourActivityController::class, 'ssoIndex'])->middleware('psyUserSso');
  81. Route::resource('/admin/activity', FourActivityController::class)->middleware(['psyUserSso','web']);
  82. //测试
  83. Route::get('admin/openweixin/index', OpenWeixinController::class.'@index');
  84. Route::post('admin/openweixin/index', OpenWeixinController::class.'@index');
  85. Route::get('admin/openweixin/auth', OpenWeixinController::class.'@auth');
  86. Route::post('admin/openweixin/auth', OpenWeixinController::class.'@auth');
  87. Route::get('admin/openweixin/callback', OpenWeixinController::class.'@callback');
  88. Route::post('admin/openweixin/callback', OpenWeixinController::class.'@callback');
  89. Route::post('admin/openweixin/getThirdToken', OpenWeixinController::class.'@getThirdToken');
  90. Route::get('admin/openweixin/getThirdToken', OpenWeixinController::class.'@getThirdToken');
  91. Route::post('admin/openweixin/index/{appId}', function ($appId) {
  92. // ...
  93. $config = [
  94. 'app_id' => 'wxe81efa7fd6a5fd53',
  95. 'secret' => '7d22f52938e4c9fbb5f2d07e8f5b83b6',
  96. 'token' => '6lfq90croi6nsyia63vbhaqnq4lzm66d',
  97. 'aes_key' => 'uOIvZHtyDKKd7xT4KKgpikGOtgW7ZskeOzVIFgIs2SM'
  98. ];
  99. $openPlatform = Factory::openPlatform($config);
  100. // 第三方平台接入处理
  101. $officialAccount = $openPlatform->officialAccount($appId);
  102. $server = $officialAccount->server; // ❗️❗️ 这里的 server 为授权方的 server,而不是开放平台的 server,请注意!!!
  103. // $server->push(function () {
  104. // return 'Welcome!';
  105. // });
  106. return $server->serve();
  107. });