api.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. $api->group(['middleware' => 'auth:api'], function ($api) {
  24. //注册
  25. $api->post('reg', 'AuthController@register');
  26. //登出
  27. $api->post('logout', 'AuthController@logout');
  28. //刷新身份令牌
  29. $api->post('refresh', 'AuthController@refresh');
  30. });
  31. $api->group(['middleware' => 'jwt.chxq_auth'], function ($api) {
  32. //新增编辑
  33. $api->post('addShop', 'ShopController@addShop');
  34. //编辑
  35. $api->put('editShop', 'ShopController@editShop');
  36. //商户列表
  37. $api->get('shopList', 'ShopController@list');
  38. //用户列表
  39. //商户详情
  40. $api->get('shopView', 'ShopController@view');
  41. //修改状态
  42. $api->put('isOpen', 'ShopController@isOpen');
  43. $api->get('user', 'UserController@index');
  44. //公共配置
  45. $api->post('configIndex', 'ConfigController@index');
  46. });
  47. });