<?php

use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

Route::middleware('auth:api')->get('/user', function (Request $request) {
    return $request->user();
});

// 用户登录
Route::post('/login', 'Api\MembersController@login');// avatarUrl, nickname,openid,gender

// 用户
Route::post('/members/{id}', 'Api\MembersController@members'); //更新用户信息
Route::get('/members/{id}', 'Api\MembersController@show'); // 获取用户信息

// 在线公告
Route::get('news', 'Api\NewsController@index');
Route::get('news/{id}', 'Api\NewsController@show');

// 文件上传
Route::post('/file/upload','Api\UploadController@upload');

// 图片识别接口
Route::any('/garbage', 'Api\GarbageController@index');

Route::any('/garbage/keyword', 'Api\GarbageController@text');

//用户答题接口
Route::get('/answer/', 'Api\UserAnswersController@index');
Route::get('/answers_result/{id}', 'Api\UserAnswersController@show');
Route::post('/post_answer/{id}', 'Api\UserAnswersController@post_answer');
