Commit 43687989 authored by 冯超鹏's avatar 冯超鹏

uinapp 模块接口

parent 286c2e78
Pipeline #116 failed with stages
...@@ -62,7 +62,7 @@ class AuthController extends Controller ...@@ -62,7 +62,7 @@ class AuthController extends Controller
return response()->json(new JsonResponse([], '请用用户窗口登入'), Response::HTTP_UNAUTHORIZED); return response()->json(new JsonResponse([], '请用用户窗口登入'), Response::HTTP_UNAUTHORIZED);
} }
if (!Auth::attempt($credentials)) { if (!Auth::attempt($credentials)) {
return response()->json(new JsonResponse([], 'login_error'), Response::HTTP_UNAUTHORIZED); return response()->json(new JsonResponse([],'login_error'), Response::HTTP_UNAUTHORIZED);
} }
$user = $request->user(); $user = $request->user();
$tokenResult = $user->createToken('Personal Access Token'); $tokenResult = $user->createToken('Personal Access Token');
......
<?php
namespace App\Http\Controllers;
use App\Http\Resources\PermissionResource;
use App\Http\Requests\UsersRequest;
use App\Http\Resources\UserResource;
use App\Laravue\JsonResponse;
use App\Laravue\Models\Device;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\ResourceCollection;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Redis;
use Validator;
class HomeGZHYController extends controller
{
//设备详情
public function deviceDataInfo($id){
$data = DB::table('device as d')
->join('device_type as t','d.dtype','=','t.tid')
->join('gas as g','d.status','=','g.id')
->join('danwei as w','d.devicemonad','=','w.id')
->join('status as s','d.devicepolice','=','s.id')
->join('users as u','d.uid','=','u.id')
->where('d.id','=',$id)
->select('d.*','t.tname','g.gas','w.danwei','s.status_name','u.username','u.isadmin')
->first();
return $this->jsonSuccessData($data);
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateSessionsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('sessions', function (Blueprint $table) {
$table->string('id')->unique();
$table->unsignedBigInteger('user_id')->nullable();
$table->string('ip_address', 45)->nullable();
$table->text('user_agent')->nullable();
$table->text('payload');
$table->integer('last_activity');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('sessions');
}
}
...@@ -119,6 +119,11 @@ Route::group(['middleware'=>'auth:api'],function (){ ...@@ -119,6 +119,11 @@ Route::group(['middleware'=>'auth:api'],function (){
Route::post('installer/seekInstaller','InstallerController@seekInstaller')->middleware('permission:' . \App\Laravue\Acl::PERMISSION_PERMISSION_MANAGE);//用户搜索 Route::post('installer/seekInstaller','InstallerController@seekInstaller')->middleware('permission:' . \App\Laravue\Acl::PERMISSION_PERMISSION_MANAGE);//用户搜索
Route::get('installer/normalinstaller/{id}','InstallerController@normalinstaller');//回复状态 Route::get('installer/normalinstaller/{id}','InstallerController@normalinstaller');//回复状态
}); });
//uinapp 接口
Route::group(['middleware'=>'auth:api'],function (){
Route::get('HomeGZHYController/deviceDataInfo/{id}','HomeGZHYController@deviceDataInfo');//设备详情
});
// Fake APIs // Fake APIs
Route::get('/table/list', function () { Route::get('/table/list', function () {
$rowsNumber = mt_rand(20, 30); $rowsNumber = mt_rand(20, 30);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment