api.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. /*
  3. |--------------------------------------------------------------------------
  4. | Application Routes
  5. |--------------------------------------------------------------------------
  6. |
  7. | Here is where you can register all of the routes for an application.
  8. | It is a breeze. Simply tell Lumen the URIs it should respond to
  9. | and give it the Closure to call when that URI is requested.
  10. |
  11. */
  12. $api = app('Dingo\Api\Routing\Router');
  13. $api->version('v1', [
  14. 'namespace' => 'App\Http\Controllers\V1',
  15. ], function ($api) {
  16. //登陆
  17. $api->post('login', 'AuthController@login');
  18. //获取商户信息
  19. $api->post('getShopInfo', 'ShopController@getTokenShop');
  20. $api->group(['middleware' => 'chxq.shop_check'], function ($api) {
  21. $api->get('statistics', 'IndexController@index');
  22. $api->get('statistics/sales', 'IndexController@sales');
  23. });
  24. $api->group(['middleware' => 'auth:api'], function ($api) {
  25. //注册
  26. $api->post('reg', 'AuthController@register');
  27. //登出
  28. $api->post('logout', 'AuthController@logout');
  29. //刷新身份令牌
  30. $api->post('refresh', 'AuthController@refresh');
  31. });
  32. $api->group(['middleware' => 'jwt.chxq_auth'], function ($api) {
  33. //新增编辑
  34. $api->post('addShop', 'ShopController@addShop');
  35. //编辑
  36. $api->put('editShop', 'ShopController@editShop');
  37. //商户列表
  38. $api->get('shopList', 'ShopController@list');
  39. //用户列表
  40. //商户详情
  41. $api->get('shopView', 'ShopController@view');
  42. //修改状态
  43. $api->put('isOpen', 'ShopController@isOpen');
  44. $api->get('user', 'UserController@index');
  45. //公共配置
  46. $api->post('configIndex', 'ConfigController@index');
  47. });
  48. });