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

提交新的模块

parent 0ad2c7df
......@@ -2,23 +2,26 @@
namespace App\Console\Commands;
use App\Http\Controllers\Auth\SwooleCommandController;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Log;
class swoole extends Command
{
public $ws;
private $token = 'zxc123456789ZXC';
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'command:name';
protected $signature = 'swoole {action?}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Command description';
protected $description = 'swoole';
/**
* Create a new command instance.
......@@ -37,6 +40,72 @@ class swoole extends Command
*/
public function handle()
{
//
$action = $this->argument('action');
switch ($action) {
case 'close':
break;
default:
$this->start();
break;
}
}
//开启WebSocket
public function start()
{
$this->ws = new \swoole_websocket_server("0.0.0.0", 9502); //创建一个端口
$this->ws->set(array(
'reactor_num' => 2, //reactor线程数
'worker_num' => 4, //worker进程数
'backlog' => 128, //Listen队列长度
'max_request' => 10,//最大连接
'daemonize'=>0,//守护进程
));
$this->ws->on('open', function ($ws, $request) {
//链接成功
$data = [
'code' => 200,
'token' => md5($this->token),
'time' => date("Y-m-d H:i:s", time()),
'msg' => '连接成功'
];
$this->ws->push(1, json_encode($data), 1);
});
//监听WebSocket消息事件
$this->ws->on('message', function ($ws, $frame) {
$data = json_decode($frame->data, true);
$token = (string)$data['token'];
if ($token != md5($this->token)) {
Log::channel('single')->info('token错误'. ',' .'token=>'. $token . ',' . 'id=>' . $frame->fd);
$this->ws->push($frame->fd, 'token错误', 1);
$this->ws->disconnect($frame->fd, 105, '已断开连接,token错误');
} else {
// 监测是否是有效链接
if($this->ws->isEstablished($frame->fd)){
$ws->bind($frame->fd, $data['id']);
$userdata = new SwooleCommandController();
$this->ws->push($frame->fd,$userdata->userslist(),1);
}else{
Log::channel('single')->info('不是有效连接'. ','.'id=>'. $frame->fd);
$this->ws->push($frame->fd, '不是有效连接', 1);
$this->ws->disconnect($frame->fd, 105, '已断开连接,不是有效连接');
}
}
});
$this->ws->on('request', function ($request, $response) {
if ($request->post['token'] == "123") {
echo "123213";
$clients = $this->ws->getClientList();
}
});
//监听WebSocket连接关闭事件
$this->ws->on('close', function ($ws, $fd) {
echo "client:{$fd} is closed\n";
});
$this->ws->start();
}
}
<?php
namespace App\Console\Commands;
use App\Http\Controllers\Auth\SwooleCommandMeTcpController;
use Illuminate\Support\Facades\Log;
use Illuminate\Console\Command;
class swooleMeTcp extends Command
{
public $tcp;
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'swooleMeTcp {action?}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'swooleMeTcp';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$action = $this->argument('action');
switch ($action) {
case 'close':
break;
default:
$this->start();//开启tcp服务
break;
}
}
//开启
public function start()
{
$this->tcp = new \swoole_server("127.0.0.1", 9503);
$this->tcp->addlistener("127.0.0.1", 9504, SWOOLE_SOCK_TCP); // 添加 TCP端口监听
$this->tcp->addlistener("127.0.0.1", 9505, SWOOLE_SOCK_TCP); // 添加 TCP端口监听
$this->tcp->addlistener("127.0.0.1", 9506, SWOOLE_SOCK_TCP); // 添加 TCP端口监听
$this->tcp->set([
'worker_num' => 2,//设置启动的 Worker 进程数
'max_request' =>30,//最大任务数
'max_connection' => 50,
'daemonize'=>0,//守护进程
'backlog' => 128,
'heartbeat_check_interval' => 30,
'heartbeat_idle_time' => 65,
]);
//监听连接进入事件
$this->tcp->on('Connect', function ($serv, $fd) {
$data = [
'stats[得到当前 Server 的活动 TCP 连接数]' => $this->tcp->stats(),
'getClientInfo[获取连接的信息]' =>$this->tcp->getClientInfo($fd,1,true)
];//链接信息写入.log
Log::channel('slack')->info($data);
$serv->send($fd,'连接成功'.','. 'id=>'. $fd);
});
//监听数据接收事件
$this->tcp->on('Receive', function ($serv, $fd, $from_id, $data) {
$swooletcp = new SwooleCommandMeTcpController();
$swooletcp->swooletcplist($data);
});
//监听连接关闭事件
$this->tcp->on('Close', function ($serv, $fd) {
Log::channel('slack')->info('连接已断开'. ',' . 'id=>' . $fd);
});
//启动服务器
$this->tcp->start();
}
}
\ No newline at end of file
......@@ -14,6 +14,7 @@ class Kernel extends ConsoleKernel
*/
protected $commands = [
//
// \App\Console\Commands\swooleMeTcp::class
];
/**
......
<?php
namespace App\Http\Controllers;
namespace App\Http\Controllers\Auth;
use Illuminate\Support\Facades\DB;
use App\Laravue\Models\Users;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
class SwooleCommandController extends Controller
{
//返回用户列表
public function userslist(): string
{
//查询用户数量
$usercount = DB::table('BackgroundUser')->count();//获取用户数量
//查询设备类型
$device_type = DB::table('device_type')->get()->toArray();
//量产
$userdata = DB::table('BackgroundUser as b')
->leftjoin('device as de', 'b.id', '=', 'de.uid')
->where('b.state', '=', '2')
->select('b.id', 'b.username', 'b.nickname', 'de.dtype', 'de.uid')
->groupBy('b.id')
->get()->toArray();
$data = [];
foreach (array_column($device_type, 'tid') as $key => $value) {
foreach (array_column($device_type, 'tname') as $k => $v) {
foreach (array_column($userdata, 'id') as $uk => $uv){
foreach (array_column($userdata, 'username') as $usk => $usv)
if ($key == $k && $uk == $usk){
$countdevice_type = DB::table('device')
->where('uid','=',$uv)
->where('dtype', '=', $value)
->count();
$username['username'] = $usv;
$username['tname'] = $v;
$username['count_dtype'] = $countdevice_type;
array_push($data,$username);
}
}
}
}
class SwooleCommandController {
$countdata = ['usercount' => $usercount, 'userdata' => $data];
return $this->jsonSuccessData($countdata);
}
}
\ No newline at end of file
<?php
namespace App\Http\Controllers\Auth;
use Illuminate\Support\Facades\DB;
use App\Laravue\Models\Users;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Redis;
use App\Http\Controllers\DevicesController;
class SwooleCommandMeTcpController extends Controller
{
//获取tcp链接返回数据 //进去redis
public function swooletcplist($data = '')
{
if ($data != '') {
$datadevice = $this->stringdata($data);
Redis::set('sbjc:' . $datadevice[0], $data);
$this->dbdevice($this->stringdata($data));
Redis::lpush('police',$data);
$this->police();
}
}
//分割字符串
private function stringdata($data = ''): array
{
if ($data != '') {
return explode('/', $data);
}
}
//查询redis所有的值
private function devicedata(): array
{
$keys = Redis::keys("*");//获取所有的键
$data = Redis::mget($keys);//获取所有的键的值
$arrdata = [];
foreach ($data as $key => $vel) {
$expdata = explode('/', $vel);
array_push($arrdata, $expdata);
}
return $arrdata;
}
//查询出返回值
private function dbdevice($data = [])
{
$Devices = new DevicesController();
if ($data != []) {
$devicedata = DB::table('device as d')
->where('d.devicenum', '=', $data[0])
->leftjoin('device_type as t', 't.tid', '=', 'd.dtype')
->leftjoin('gas as g', 'g.id', '=', 'd.status')
->leftjoin('danwei as c', 'c.id', '=', 'd.devicemonad')
->leftjoin('status as s', 's.id', '=', 'd.devicepolice')
->select('d.devicenum', 'd.username', 'd.deviceremark', 'd.devicelinkman', 'd.devicephone', 'd.deviceinfo', 't.tname', 'g.gas', 'c.danwei', 's.status_name')
->first();
Redis::lPush('Devicesdata', serialize($devicedata));//进入队列进行
$dalen = Redis::llen('Devicesdata');//返回队列长度
if ($dalen == 2) {
$Devices->equipment();//推送前台
}
}
}
//处理报警
private function police()
{
$davicedata = $this->stringdata(Redis::lpop('police'));
// 处理发送数据报警
$isdavice = DB::table('reportpolice')
->where('devicenumber', '=', $davicedata[0])
->select('status', 'endtime')
->first();
$type = json_decode(json_encode($isdavice), true);
//设备再次报警
if ($type['endtime'] != '' && $type['status'] == 2 && $davicedata[1] != 1){
$up = DB::table('reportpolice')
->where('devicenumber', '=', $davicedata[0])
->update(['endtime'=>'','status' => 1,'policestatus'=> $davicedata[1],'concentration' => $davicedata[2]]);
}
if($type['status'] == 1 && $type['endtime'] == '' && $davicedata[1] == 1){
$up = DB::table('reportpolice')
->where('devicenumber', '=', $davicedata[0])
->update(['endtime'=>time(),'status' => 2,'policestatus'=> $davicedata[1]]);
}
if ($isdavice) {
//改成报警状态
if ($davicedata[1] != 1 && $type['endtime'] == '') {
$up = DB::table('reportpolice')
->where('devicenumber', '=', $davicedata[0])
->update(['concentration' => $davicedata[2], 'policestatus' => $davicedata[1], 'status' => 1]);
}
} else {
if ($davicedata[1] != 1) {
$add = DB::table('reportpolice')
->insertGetId(['devicenumber' => $davicedata[0], 'starttime' => time(), 'concentration' => $davicedata[2], 'policestatus' => $davicedata[1], 'status' => 1]);
}
}
$updavice = DB::table('device')
->where('devicenum', '=', $davicedata[0])
->update(['devicepolice' => $davicedata[1], 'nd' => $davicedata[2]]);
}
}
\ No newline at end of file
......@@ -56,13 +56,16 @@ class AuthController extends Controller
}
// 用户登入接口
public function userslogin(Request $request , Users $users){
$credentials = $request->only('email', 'password');
$email = $credentials['email'];
$password = $credentials['password'];
$email = $request->input('email');
$password = $request->input('password');
// if (!Auth::attempt($credentials)) {
// return response()->json(new JsonResponse([], 'login_error'), Response::HTTP_UNAUTHORIZED);
// }
$BackgroundUser = $users->where([['username','=',$email],['password','=',sha1($password)],['state','=','2']])->first();
if(is_null($email) || is_null($password)){
return $this->jsonErrorData(105,'用户名或密码不能为空');
}
$BackgroundUser = $users->where([['email','=',$email],['password','=',sha1($password)],['state','=','2']])->first();
if ($BackgroundUser){
$tokenResult = $BackgroundUser->createToken('Personal Access Token');
$token = $tokenResult->token;
......
......@@ -8,9 +8,12 @@ use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Auth;
use Illuminate\Http\Request;
class Controller extends BaseController
{
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
/**
* 返回一个json
* @param $code 状态码
......@@ -18,20 +21,23 @@ class Controller extends BaseController
* @param $data 返回数据集合
* @return false | string
*/
private function jsonResponse($code, $message, $data){
private function jsonResponse($code, $message, $data)
{
$content = [
'code' => $code,
'msg' => $message,
'msg' => $message,
'data' => $data
];
return json_encode($content);
}
/**
* 成功的时候返回结果
* @param $data 返回数据集合
* @return false | string
*/
public function jsonSuccessData( $data = [] ){
public function jsonSuccessData($data = [])
{
return $this->jsonResponse(200, 'success', $data);
}
......@@ -42,12 +48,15 @@ class Controller extends BaseController
* @param $data 返回数据集合
* @return false | string
*/
public function jsonErrorData( $code, $message, $data = [] ){
public function jsonErrorData($code, $message, $data = [])
{
return $this->jsonResponse($code, $message, $data);
}
//返回
public function code(){
return[
public function code()
{
return [
/*
* http请求代码错误
* code 封装
......@@ -59,12 +68,16 @@ class Controller extends BaseController
],
];
}
/*
* 验证当前登入用户
* */
public function isadmin (){
public function isadmin()
{
$user = Auth::user();//获取当前用户信息
$isadmin = DB::table('users')->where([['name', '=', $user['name']], ['email', '=', $user['email']]])->first();
return $isadmin;
}
}
......@@ -10,11 +10,11 @@ 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\DB;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Redis;
use Validator;
class DevicesController extends Controller
{
//设备列表
......@@ -32,6 +32,22 @@ class DevicesController extends Controller
}
return $this->jsonSuccessData($this->whertype($type==''? '1':$type,$pagenNum,$limit));
}
//用户设备列表
/*
* 设备类型
* type 不传默认是第一个
* @type 设备类型id
* */
public function userdevicelist(Request $request){
$type = $request->input('type');//设备类型id
$pagenNum=$request->input('page')-1;//页数
$limit = $request->input('limit');
if($pagenNum === '' || $limit == ''){
return $this->jsonErrorData(105,'页数或limit不能为空');
}
return $this->jsonSuccessData($this->userdevice($type==''? '1':$type,$pagenNum,$limit));
}
/*
* 删除设备
* type 1==逻辑删除
......@@ -109,6 +125,8 @@ class DevicesController extends Controller
$type = new Device();
return $this->jsonSuccessData($type->adddevice($request->all()));
}
//编辑设备
public function updatedevice(Request $request){
$deid = $request->input('deid');
......@@ -151,9 +169,30 @@ class DevicesController extends Controller
$devicelist = $databadevice
->where('dtype','=',$type)
->where('delete','=','2')//设备不是删除状态
->where('devicestatus','=','1')//
->join('device_type as dy',"device.dtype",'=','dy.tid')
->join('gas as g',"device.status",'=','g.id')
->join('status as p',"device.devicepolice",'=','p.status')
->select('dy.tname','g.gas','device.*','p.status_name')
->orderBy('device.id', 'desc')
->offset($pagenNum)
->limit($limit)
->get()->toArray();
return $devicelist;
}
//返回用户设备列表
private function userdevice($type,$pagenNum,$limit) : array {
$databadevice = DB::table('device');
$devicelist = $databadevice
->where('dtype','=',$type)
->where('uid','=',Auth::id())
->where('delete','=','2')//设备不是删除状态
->where('devicestatus','=','1')//
->join('device_type as dy',"device.dtype",'=','dy.tid')
->join('gas as g',"device.status",'=','g.id')
->select('dy.tname','g.gas','device.*')
->join('status as p',"device.devicepolice",'=','p.status')
->select('dy.tname','g.gas','device.*','p.status_name')
->orderBy('device.id', 'desc')
->offset($pagenNum)
->limit($limit)
......@@ -164,7 +203,24 @@ class DevicesController extends Controller
public function batchdevice(){
}
//推送获取数据监测数据
public function equipment(){
$dalen = Redis::llen('Devicesdata');//返回队列长度
if ($dalen > 0){
return $this->jsonSuccessData(unserialize(Redis::lpop('Devicesdata')));
}else{
return $this->jsonErrorData(105,'暂无数据');
}
}
//返回设备当前报警
public function police(){
return DB::table('reportpolice as r')
->where('r.status','=','1')
->join('status as s','r.policestatus','=','s.id')
->select('r.*','s.status_name')
->get()->toArray();
}
/**
* @param bool $isNew
* @return array
......@@ -175,8 +231,8 @@ class DevicesController extends Controller
return [
'devicenum'=>'required|between:2,25|unique:device,devicenum',//设备编号
'username'=>'required|unique:device,username|max:40',//设备名称
'devicephone'=> 'required|regex:/^1[3465789]\d{9}$/|max:11',//联系人手机号
'devicelinkman'=>'required|max:15',
'devicephone'=> 'sometimes|required|regex:/^1[3465789]\d{9}$/|max:11',//联系人手机号
'devicelinkman'=>'sometimes|required|max:15',
'dtype'=>'required',
'status'=>'required',
'devicemonad'=>'required',
......
<?php
namespace App\Http\Controllers;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Auth;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Storage;
class UploadimgController extends Controller
{
// 上传图片接口
public function uploadingimg(Request $request)
{
if ($request->isMethod('POST')) { //判断文件是否是 POST的方式上传
$tmp = $request->file('file');
if (is_null($tmp)){
return $this->jsonErrorData(105,'上传图片不能为空');
}
$path = '/article';
if ($tmp->isValid()) { //判断文件上传是否有效
$FileType = $tmp->getClientOriginalExtension(); //获取文件后缀
$FilePath = $tmp->getRealPath(); //获取文件临时存放位置
$FileName = date('Y-m-d') . uniqid() . '.' . $FileType; //定义文件名
Storage::disk('article')->put($FileName, file_get_contents($FilePath)); //存储文件
$data = [
'code' => 200,
'imginfo' =>$tmp,
'path' => $path . '/' . $FileName //文件路径
];
return $this->adduserimg($data);
}
} else {
return $this->jsonErrorData('105', '上传请求方式错误');
}
}
private function adduserimg($data)
{
if ($data['code'] == 200){
if (!is_null($this->isadmin())){
$data['isadmin'] = 1;
}else{
$data['isadmin'] = 2;
}
$data['addtime'] = time();
$data['uid'] = Auth::id();
foreach ($data as $k => $v) {
if ($k == 'code') {
unset($data[$k]);
}
}
$add = DB::table('userimage')
->insert($data);
return $this->jsonSuccessData($add);
}else{
return $this->jsonErrorData(105,'上传图片错误');
}
}
//返回用户添加的图片
public function userlist(){
return DB::table('userimage')->where([['uid', '=', Auth::id()], ['isadmin', '=', is_null($this->isadmin()) ? '2' : '1', ],['delete', '=', '1']])->get();
}
//删除用户图片
public function userimgdetele(Request $request){
$userimage = DB::table('userimage');
$type = $request->input('type');//删除图片状态
$imgid = $request->input('imgid');//图片id
if(is_null($type) || is_null($imgid)){
return $this->jsonErrorData(105,'参数不能为空');
}
if($type == 1){//逻辑删除
return $this->jsonSuccessData($userimage->where('id','=',$imgid)->update(['delete'=>'2']));
}else if ($type == 2){//物理删除
return $this->jsonSuccessData($userimage->where('id','=',$imgid)->delete());
}
}
// 返回逻辑删除图片 和 改变图片状态
public function updateimg(Request $request){
$userimage = DB::table('userimage');
if($_POST){//改变图片状态
$imgid = $request->input('imgid');
if(is_null($imgid)){
return $this->jsonErrorData(105,'图片ID不能为空');
}
return $this->jsonSuccessData($userimage->where('id','=',$imgid)->update(['delete'=>1]));
}else{
return $this->jsonSuccessData($userimage->where('delete','=','2')->get());
}
}
}
\ No newline at end of file
......@@ -260,11 +260,11 @@ class UserController extends Controller
{
$pagenNum = $request->input('page') - 1;//页数
$limit = $request->input('limit');
if(is_null($pagenNum)){
return $this->jsonErrorData(105,'page不能为空');
if (is_null($pagenNum)) {
return $this->jsonErrorData(105, 'page不能为空');
}
if(is_null($limit)){
return $this->jsonErrorData(105,'limt不能为空');
if (is_null($limit)) {
return $this->jsonErrorData(105, 'limt不能为空');
}
$users = DB::table('BackgroundUser as b')
->where('b.state', '=', '2')
......@@ -293,7 +293,7 @@ class UserController extends Controller
return response()->json(['errors' => $validator->errors()], 403);
} else {
$type = new Users();
$arr = $type->getTypeAllToArray($userdata);
$arr = $type->getTypeAlldeleteuserToArray($userdata);
return $this->jsonSuccessData($arr);
}
}
......@@ -423,14 +423,15 @@ class UserController extends Controller
}
//查看所有逻辑删除用户 和禁用用户
public function deupuser(Request $request){
public function deupuser(Request $request)
{
$pagenNum = $request->input('page') - 1;//页数
$limit = $request->input('limit');
if(is_null($pagenNum)){
return $this->jsonErrorData(105,'page不能为空');
if (is_null($pagenNum)) {
return $this->jsonErrorData(105, 'page不能为空');
}
if(is_null($limit)){
return $this->jsonErrorData(105,'limt不能为空');
if (is_null($limit)) {
return $this->jsonErrorData(105, 'limt不能为空');
}
$users = DB::table('BackgroundUser as b')
->where('b.state', '!=', '2')
......@@ -438,7 +439,7 @@ class UserController extends Controller
->leftjoin('areachina as c', 'b.cityid', '=', 'c.areaid')
->leftjoin('areachina as a', 'b.areaid', '=', 'a.areaid')
->orderBy('b.id', 'desc')
->select('b.username', 'b.state','b.nickname', 'b.email', 'b.state', 'a.area_name as area', 'c.area_name as city', 'p.area_name as province')
->select('b.username', 'b.state', 'b.nickname', 'b.email', 'b.state', 'a.area_name as area', 'c.area_name as city', 'p.area_name as province')
->offset($pagenNum)
->limit($limit)
->get()->toArray();
......@@ -449,10 +450,12 @@ class UserController extends Controller
}
}
/*
* 返回当前登入的联系人列表
* */
public function contactslist(){
return DB::table('contactsuser')->where([['contactsid','=',Auth::id()],['isadmin','=',is_null($this->isadmin()) ? '2' : '1']])->get();
/*
* 返回当前登入的联系人列表
* */
public function contactslist()
{
return $this->jsonSuccessData(DB::table('contactsuser')->where([['contactsid', '=', Auth::id()], ['isadmin', '=', is_null($this->isadmin()) ? '2' : '1'],['isstatus', '=', '1']])->get());
}
}
\ No newline at end of file
......@@ -6,7 +6,7 @@ use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Laravel\Passport\HasApiTokens;
use Spatie\Permission\Traits\HasRoles;
use Illuminate\Support\Facades\Auth;
class Device extends Authenticatable
{
use Notifiable, HasRoles, HasApiTokens;
......@@ -23,6 +23,7 @@ class Device extends Authenticatable
}
$datadevice['deviceaddtime'] = time();
$datadevice['deviceuuid'] = $this->guid();
$datadevice['uid'] = Auth::id();
return $this->insertGetId($datadevice);
}
......
......@@ -39,6 +39,12 @@
"nunomaduro/collision": "^4.1",
"phpunit/phpunit": "^8.5"
},
"repositories": {
"packagist": {
"type": "composer",
"url": "https://packagist.phpcomposer.com"
}
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -135,7 +135,7 @@ return [
*/
'providers' => [
SwooleTW\Http\LaravelServiceProvider::class,
/*
* Laravel Framework Service Providers...
*/
......@@ -165,7 +165,7 @@ return [
/*
* Package Service Providers...
*/
// SwooleTW\Http\LaravelServiceProvider::class,
/*
* Application Service Providers...
*/
......@@ -174,7 +174,6 @@ return [
// App\Providers\BroadcastServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class,
SwooleTW\Http\LaravelServiceProvider::class,
],
/*
......
......@@ -56,7 +56,7 @@ return [
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'strict' => false,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
......@@ -123,7 +123,7 @@ return [
'options' => [
'cluster' => env('REDIS_CLUSTER', 'redis'),
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
'prefix' => env('REDIS_PREFIX'),
],
'default' => [
......
......@@ -55,6 +55,13 @@ return [
'visibility' => 'public',
],
'article' => [
'driver' => 'local',
'root' => public_path('/article'), // public_path 就是public的路径
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
],
's3' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
......
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateDeviceTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('device', function (Blueprint $table) {
$table->id();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('device');
}
}
No preview for this file type
......@@ -99,7 +99,7 @@
</template>
</el-table-column> -->
</el-table>
<!-- 分页 -->
<pagination v-show="total>0" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="getList" />
<el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible">
......
......@@ -4,7 +4,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>泽宏-安全大数据平台</title>
<title>{{ __('login.title') }}</title>
<link rel="apple-touch-icon" sizes="57x57" href="/favicon/apple-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="/favicon/apple-icon-60x60.png">
......
......@@ -16,7 +16,7 @@ use \App\Laravue\JsonResponse;
*/
Route::post('auth/login', 'AuthController@login');
Route::post('auth/userslogin', 'AuthController@userslogin');
Route::post('auth/userslogin', 'AuthController@userslogin');//用户登入接口
Route::group(['middleware' => 'auth:api'], function () {
Route::get('auth/user', 'AuthController@user');
Route::post('auth/logout', 'AuthController@logout');
......@@ -38,14 +38,27 @@ Route::group(['middleware' => 'auth:api'], function () {
Route::get('user/deupuser','UserController@deupuser');//返回当前登入的联系人列表
});
//上传图片路由
Route::group(['middleware'=>'auth:api'],function (){
Route::post('SwooleCommand/SwooleCommand','SwooleCommandController@index');//添加图片
Route::post('upload_img/uploadingimg','UploadimgController@uploadingimg')->middleware('permission:' . \App\Laravue\Acl::PERMISSION_PERMISSION_MANAGE);//添加图片
Route::get('userimglist/userimglist','UploadimgController@userlist');//图片列表
Route::get('userimgdetele/userimgdetele','UploadimgController@userimgdetele');//删除图片
Route::match(['get','post'],'updateimg/updateimg','UploadimgController@updateimg');//更新图片信息,返回逻辑图片列表
});
//设备路由
Route::group(['middleware'=>'auth:api'],function (){
Route::get('devices/devicelist', 'DevicesController@devicelist');//设备列表
Route::get('devices/userdevicelist', 'DevicesController@userdevicelist');//用户设备列表
Route::get('devices/devicetype','DevicesController@devicetype');//设备类型
Route::post('devices/deletedecice','DevicesController@deletedecice')->middleware('permission:' . \App\Laravue\Acl::PERMISSION_PERMISSION_MANAGE);//删除设备
Route::post('devices/adddevice','DevicesController@adddevice')->middleware('permission:' . \App\Laravue\Acl::PERMISSION_PERMISSION_MANAGE);//新增设备
Route::match(['get','post'],'devices/physicsdelete','DevicesController@physicsdelete')->middleware('permission:' . \App\Laravue\Acl::PERMISSION_PERMISSION_MANAGE);//返回设备列表和更改设备
Route::match(['get','post'],'devices/updatedevice','DevicesController@updatedevice')->middleware('permission:' . \App\Laravue\Acl::PERMISSION_PERMISSION_MANAGE);//更新设备
Route::get('devices/equipment','DevicesController@equipment');//获取设备监测列表
Route::get('devices/police','DevicesController@police');//获取设备当前报警列表
});
......
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