api.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. use Illuminate\Http\Request;
  3. use Illuminate\Support\Facades\Route;
  4. /*
  5. |--------------------------------------------------------------------------
  6. | API Routes
  7. |--------------------------------------------------------------------------
  8. |
  9. | Here is where you can register API routes for your application. These
  10. | routes are loaded by the RouteServiceProvider within a group which
  11. | is assigned the "api" middleware group. Enjoy building your API!
  12. |
  13. */
  14. $api = app('Dingo\Api\Routing\Router');
  15. $api->version('v1', [
  16. 'namespace' => 'App\Http\Controllers\Api',
  17. 'prefix' => 'api',
  18. //'middleware' => ['serializer:array', 'bindings']
  19. ], function($api) {
  20. $api->post('payment/notice', 'PaymentController@notice');
  21. // 限制登录和验证码接口请求频率
  22. $api->group([
  23. 'middleware' => 'api.throttle',
  24. 'limit' => config('api.rate_limits.sign.limit'),
  25. 'expires' => config('api.rate_limits.sign.expires'),
  26. ], function($api) {
  27. $api->any('passport/login', 'PassportController@login');
  28. });
  29. // 需要登录
  30. $api->group([
  31. 'middleware' => [
  32. 'api.auth'
  33. ],
  34. ], function($api) {
  35. $api->get('setting/get', 'SettingController@get');
  36. $api->get('setting/config', 'SettingController@config');
  37. $api->get('user/get', 'UserController@get');
  38. $api->get('user/query', 'UserController@query');
  39. $api->get('user/shares', 'UserController@shares');
  40. $api->get('user/memberRecord', 'UserController@memberRecord');
  41. $api->get('user/overage', 'UserController@overage');
  42. $api->get('user/income', 'UserController@income');
  43. $api->post('user/bind', 'UserController@bind');
  44. $api->post('user/bindPhone', 'UserController@bindPhone');
  45. $api->post('user/buy', 'UserController@buy');
  46. $api->post('user/update', 'UserController@update');
  47. $api->post('withdraw/apply', 'WithdrawController@apply');
  48. $api->get('withdraw/lists', 'WithdrawController@lists');
  49. });
  50. });