api.php 1.9 KB

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