Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
L
laravelzh
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
冯超鹏
laravelzh
Commits
43687989
Commit
43687989
authored
Aug 19, 2020
by
冯超鹏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
uinapp 模块接口
parent
286c2e78
Pipeline
#116
failed with stages
Changes
4
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
77 additions
and
1 deletion
+77
-1
AuthController.php
app/Http/Controllers/AuthController.php
+1
-1
HomeGZHYController.php
app/Http/Controllers/HomeGZHYController.php
+36
-0
2020_07_02_143013_create_sessions_table.php
...se/migrations/2020_07_02_143013_create_sessions_table.php
+35
-0
api.php
routes/api.php
+5
-0
No files found.
app/Http/Controllers/AuthController.php
View file @
43687989
...
@@ -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'
);
...
...
app/Http/Controllers/HomeGZHYController.php
0 → 100644
View file @
43687989
<?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
);
}
}
database/migrations/2020_07_02_143013_create_sessions_table.php
0 → 100644
View file @
43687989
<?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'
);
}
}
routes/api.php
View file @
43687989
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment