api.php 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381
  1. <?php
  2. /*
  3. * This file is part of the Jiannei/lumen-api-starter.
  4. *
  5. * (c) Jiannei <longjian.huang@foxmail.com>
  6. *
  7. * This source file is subject to the MIT license that is bundled
  8. * with this source code in the file LICENSE.
  9. */
  10. use Illuminate\Support\Facades\Route;
  11. use Jiannei\Response\Laravel\Support\Facades\Response;
  12. /*
  13. |--------------------------------------------------------------------------
  14. | Application Routes
  15. |--------------------------------------------------------------------------
  16. |
  17. | Here is where you can register all of the routes for an application.
  18. | It is a breeze. Simply tell Lumen the URIs it should respond to
  19. | and give it the Closure to call when that URI is requested.
  20. |
  21. */
  22. /**
  23. * 基础业务模块
  24. */
  25. Route::get('/home', 'HomeController@index');
  26. //区域
  27. Route::group(['prefix' => 'area', 'namespace' => 'Area'], function () {
  28. //项目
  29. Route::get('/', 'AreasController@index');
  30. Route::get('/info/{id}', 'AreasController@show');
  31. Route::group(['prefix' => 'project'], function () {
  32. Route::get('/', 'ProjectsController@index');
  33. Route::post('/', 'ProjectsController@store');
  34. Route::get('/info/{id}', 'ProjectsController@show');
  35. Route::put('/{id}', 'ProjectsController@update');
  36. Route::delete('/{id}', 'ProjectsController@destroy');
  37. Route::get('/select-options', 'ProjectsController@SelectOptions');
  38. Route::get('/areas', 'ProjectsController@project');
  39. Route::get('/areas-tree', 'ProjectsController@projectTree');
  40. });
  41. });
  42. Route::group(['namespace' => 'Base', 'prefix' => 'base'], function () {
  43. //登录
  44. Route::post('/auth/login', 'AuthController@login');
  45. Route::post('/auth/login-mobile', 'AuthController@mobileLogin');
  46. Route::post('/auth/mobile-verification-code', 'AuthController@verificationCode');
  47. Route::post('/auth/weapp/login', 'AuthController@weappLogin');
  48. // Route::post('/auth/register', 'AuthController@store');
  49. //上传文件
  50. Route::post('/common/upload', 'ResourceController@upload');
  51. //枚举
  52. Route::get('/common/enums', 'CommonController@enums');
  53. Route::post('/settings', 'SettingsController@settings');
  54. Route::get('/setting', 'SettingsController@setting');
  55. Route::group([
  56. 'middleware' => ['auth:api', 'auth.role:user']
  57. ], function () {
  58. Route::get('/auth/me', 'AuthController@me');
  59. Route::put('/auth/me', 'AuthController@update');
  60. Route::put('/auth/password', 'AuthController@changePassword');
  61. Route::get('/auth/logout', 'AuthController@logout');
  62. //微信小程序
  63. Route::post('/auth/weapp/user-info-sync', 'AuthController@weappUserInfoSync');
  64. Route::post('/auth/weapp/bind-mobile', 'AuthController@weappBindMobile');
  65. });
  66. });
  67. //Route::get('/page/home', 'PageController@home');
  68. //Route::get('/page/navigations', 'PageController@navigations');
  69. //Route::get('/page/articles', 'PageController@articles');
  70. //Route::get('/page/article/{id}', 'PageController@article');
  71. //Route::get('/page/navigation-article/{id}', 'PageController@navigationArticle');
  72. //Route::post('/page/settings', 'PageController@settings');
  73. Route::group(['namespace' => 'CMS', 'prefix' => 'cms'], function () {
  74. //上传文件
  75. Route::post('/common/upload', 'ResourceController@upload');
  76. //banner
  77. Route::get('/banner', 'BannersController@index');
  78. //导航
  79. Route::get('/category', 'CategoriesController@index');
  80. //文章
  81. Route::get('/articles', 'ArticlesController@index');
  82. Route::get('/article', 'ArticlesController@article');
  83. Route::get('/article-lists', 'ArticlesController@lists');
  84. Route::get('/article/{id}', 'ArticlesController@show');
  85. //配置
  86. Route::get('/settings', 'SettingController@index');
  87. Route::get('/setting', 'SettingController@show');
  88. // Route::group([
  89. // 'middleware' => 'auth:api'
  90. // ], function () {
  91. // Route::get('/auth/me', 'AuthController@me');
  92. // Route::put('/auth/me', 'AuthController@update');
  93. // Route::get('/auth/logout', 'AuthController@logout');
  94. // });
  95. });
  96. //用户管理
  97. Route::group(['namespace' => 'User', 'prefix' => 'user'], function () {
  98. Route::get('/', 'UserController@index');
  99. // Route::post('/', 'UserController@store');
  100. // Route::get('/{id}', 'UserController@show');
  101. // Route::put('/{id}', 'UserController@update');
  102. // Route::delete('/{id}', 'UserController@destroy');
  103. // Route::post('/delete', 'UserController@delete');
  104. // Route::post('/import', 'UserController@import');
  105. // Route::post('/export', 'UserController@export');
  106. });
  107. ///**
  108. // * 视频接口
  109. // */
  110. Route::group(['namespace' => 'Course', 'prefix' => 'course'], function () {
  111. //分类
  112. Route::get('/categories', 'CategoryController@index');
  113. //视频列表
  114. Route::get('/', 'CourseController@index');
  115. Route::get('/random', 'CourseController@random');
  116. Route::get('/select-options', 'CourseController@selectOptions');
  117. //视频详情
  118. Route::get('/info/{id}', 'CourseController@show');
  119. Route::group([
  120. // 'middleware' => 'auth:api'
  121. ], function () {
  122. // Route::group([
  123. //// 'middleware' => 'auth.role:teacher'
  124. // ], function () {
  125. // //老师路由
  126. // Route::post('/', 'CourseController@store');
  127. // Route::put('/{id}', 'CourseController@update');
  128. // Route::delete('/{id}', 'CourseController@destroy');
  129. //
  130. // //章节
  131. // Route::post('/chapter', 'ChapterController@store');
  132. // Route::put('/chapter/{id}', 'ChapterController@update');
  133. // Route::delete('/chapter/{id}', 'ChapterController@destroy');
  134. //
  135. // //视频
  136. // Route::post('/video', 'VideoController@store');
  137. // Route::put('video/{id}', 'VideoController@update');
  138. // Route::delete('video/{id}', 'VideoController@destroy');
  139. //
  140. // //附件
  141. // Route::post('/attach', 'AttachController@store');
  142. // Route::put('/attach/{id}', 'AttachController@update');
  143. // Route::delete('/attach/{id}', 'AttachController@destroy');
  144. //
  145. // //班级
  146. // Route::post('/organization', 'OrganizationsController@store');
  147. // Route::put('/organization/{id}', 'OrganizationsController@update');
  148. // Route::delete('/organization/{id}', 'OrganizationsController@destroy');
  149. // Route::post('/organization/courses', 'OrganizationsController@syncCourses');
  150. //
  151. //
  152. // Route::post('/organization/student/update', 'OrganizationsController@updateStudent');
  153. // Route::post('/organization/students/delete', 'OrganizationsController@destroyStudents');
  154. // Route::get('/organization/statistical', 'OrganizationsController@statistical');
  155. // });
  156. //班级
  157. Route::get('/organization', 'OrganizationsController@index');
  158. Route::get('/organization/info/{slug}', 'OrganizationsController@show');
  159. Route::get('/organization/teacher', 'OrganizationsController@teacher');
  160. Route::get('/organization/students', 'OrganizationsController@students');
  161. Route::post('/organization/student', 'OrganizationsController@storeStudent');
  162. //课程详情【学生】
  163. Route::get('/detail/{slug}', 'CourseController@detail');
  164. //订阅
  165. Route::post('/subscribe', 'CourseController@subscribe');
  166. //章节列表
  167. Route::get('/chapter', 'ChapterController@index');
  168. //视频
  169. Route::get('/video', 'VideoController@index');
  170. Route::get('/video/select-options', 'VideoController@selectOptions');
  171. // Route::get('/video/info/{slug}', 'VideoController@show');
  172. Route::get('/video/info/{id}', 'VideoController@viewShow');
  173. Route::post('/video/look-record', 'VideoController@lookRecord');
  174. // 学生
  175. Route::get('/video/detail/{slug}', 'VideoController@detail');
  176. //附件
  177. Route::get('/attach', 'AttachController@index');
  178. Route::get('/attach/download/{slug}', 'AttachController@download');
  179. //观看记录
  180. Route::get('/course-look', 'CourseController@lookCourses');
  181. //评价
  182. Route::post('/comment', 'CommentController@store');
  183. Route::get('/comments', 'CommentController@index');
  184. //收藏
  185. Route::post('/collection', 'CourseController@collection');
  186. });
  187. });
  188. //
  189. ///**
  190. // * 试卷
  191. // */
  192. //Route::group(['namespace' => 'Exam', 'prefix' => 'exam', 'middleware' => 'auth:api'], function () {
  193. // Route::get('/', 'PapersController@index');
  194. // Route::get('/info/{slug}', 'PapersController@show');
  195. // Route::get('/topic-select-options', 'TopicsController@selectOptions');
  196. // //提交考试结果
  197. // Route::post('/examination', 'PapersController@examination');
  198. //// Route::get('/', 'TopicsController@index');
  199. // Route::group([
  200. // 'middleware' => 'auth.role:teacher'
  201. // ], function () {
  202. // Route::post('/', 'PapersController@store');
  203. // Route::put('/{id}', 'PapersController@update');
  204. // Route::delete('/{id}', 'PapersController@destroy');
  205. // //批阅
  206. // Route::post('/examines', 'PapersController@examines');
  207. //
  208. // //试题
  209. // Route::get('/topic', 'TopicsController@index');
  210. // Route::get('/topic/{id}', 'TopicsController@show');
  211. // Route::post('/topic', 'TopicsController@store');
  212. // Route::put('/topic/{id}', 'TopicsController@update');
  213. // Route::delete('/topic/{id}', 'TopicsController@destroy');
  214. //
  215. // //学生考试记录
  216. // Route::delete('/result/{id}', 'PaperResultsController@destroy');
  217. // });
  218. //
  219. // Route::get('/result', 'PaperResultsController@index');
  220. // Route::get('/result/{id}', 'PaperResultsController@show');
  221. //});
  222. //
  223. ////笔记
  224. //Route::group(['namespace' => 'Note', 'prefix' => 'note'], function () {
  225. // Route::get('/', 'NotesController@index');
  226. // Route::get('info/{slug}', 'NotesController@show');
  227. //
  228. // Route::get('comment', 'CommentsController@index');
  229. // Route::group([
  230. // 'middleware' => 'auth:api'
  231. // ], function () {
  232. // //笔记、问答
  233. // Route::post('/', 'NotesController@store');
  234. // Route::put('/{id}', 'NotesController@update');
  235. // Route::delete('/{id}', 'NotesController@destroy');
  236. //
  237. // //点赞
  238. // Route::post('good', 'NotesController@good');
  239. //
  240. // Route::post('comment', 'CommentsController@store');
  241. // Route::delete('comment/{id}', 'CommentsController@destroy');
  242. // Route::post('comment/good', 'CommentsController@good');
  243. // Route::post('comment/answer', 'CommentsController@answer');
  244. // });
  245. //});
  246. //
  247. //
  248. //Route::group(['prefix' => 'inform', 'namespace' => 'Inform'], function () {
  249. // //分类
  250. //// Route::get('category', 'CategoryController@index');
  251. //// Route::post('category', 'CategoryController@store');
  252. //// Route::get('category/{id}', 'CategoryController@show');
  253. //// Route::put('category/{id}', 'CategoryController@update');
  254. //// Route::delete('category/{id}', 'CategoryController@destroy');
  255. //// Route::post('category/delete', 'CategoryController@delete');
  256. //// Route::get('category-tree', 'CategoryController@tree');
  257. //// Route::get('category-user-tree', 'CategoryController@lists');
  258. //
  259. // //信息
  260. // Route::group([
  261. // 'middleware' => 'auth.role:teacher'
  262. // ], function () {
  263. // Route::post('/', 'InformationController@store');
  264. // Route::delete('/{id}', 'InformationController@destroy');
  265. // });
  266. // Route::get('/', 'InformationController@index');
  267. // Route::get('/info/{slug}', 'InformationController@show');
  268. // Route::post('/good', 'InformationController@good');
  269. //
  270. // // Route::put('information/{id}', 'InformationController@update');
  271. //// Route::post('information/delete', 'InformationController@delete');
  272. //// Route::get('information-user-messages', 'InformationController@userMessages');
  273. //// Route::post('information-read-messages', 'InformationController@readMessages');
  274. //});
  275. /**
  276. * 网址导航
  277. */
  278. //Route::group(['prefix' => 'navigation', 'namespace' => 'Navigation'], function () {
  279. // Route::get('/', 'HomeController@index');
  280. // Route::post('/search', 'HomeController@search');
  281. // Route::post('/click', 'HomeController@click');
  282. //
  283. // Route::group([
  284. // 'middleware' => ['auth:api', 'auth.role:user']
  285. // ], function () {
  286. // Route::post('/top', 'HomeController@top');
  287. // Route::delete('/top', 'HomeController@deleteTop');
  288. //
  289. // Route::post('/collection', 'HomeController@collection');
  290. // Route::post('/sort', 'HomeController@sortCategory');
  291. // Route::post('/sort-more', 'HomeController@sortMore');
  292. // Route::post('/sort-management', 'HomeController@sortManagement');
  293. //
  294. // Route::get('/category', 'CategoriesController@index');
  295. // Route::post('/category', 'CategoriesController@store');
  296. // Route::put('/category/{id}', 'CategoriesController@update');
  297. // Route::delete('/category/{id}', 'CategoriesController@destroy');
  298. // Route::get('/category/select-options', 'CategoriesController@selectOptions');
  299. //
  300. // Route::get('/website', 'WebsitesController@index');
  301. // Route::post('/website', 'WebsitesController@store');
  302. // Route::put('/website/{id}', 'WebsitesController@update');
  303. // Route::delete('/website/{id}', 'WebsitesController@destroy');
  304. // Route::get('/website/select-options', 'WebsitesController@selectOptions');
  305. // });
  306. //
  307. // Route::get('/organization', 'OrganizationsController@index');
  308. // Route::get('/organization/select-options', 'OrganizationsController@selectOptions');
  309. //
  310. //});
  311. /**
  312. * 去那里
  313. */
  314. Route::group(['prefix' => 'qunali', 'namespace' => 'Qunali', 'middleware' => ['auth:api']], function () {
  315. Route::get('/', 'HomeController@index');
  316. Route::get('/info', 'HomeController@show');
  317. Route::get('/good', 'HomeController@good');
  318. Route::get('/bad', 'HomeController@bad');
  319. Route::post('/report', 'HomeController@report');
  320. Route::post('/version', 'HomeController@version');
  321. Route::post('/point', 'HomeController@storePoint');
  322. Route::post('/check', 'HomeController@check');
  323. Route::get('/history', 'HomeController@history');
  324. Route::get('/back-history', 'HomeController@backHistory');
  325. Route::get('/record', 'HomeController@record');
  326. Route::get('/geocoder', 'HomeController@geocoder');
  327. });
  328. Route::get('/', function () {
  329. return Response::success(app()->version());
  330. });
  331. //开发环境接口
  332. Route::group(['prefix' => 'develop'], function () {
  333. //响应状态
  334. // Route::get('/http-status', 'DevelopController@httpStatus');
  335. Route::get('/t', 'ExampleController@test');
  336. Route::get('/init', 'ExampleController@init');
  337. });