Commit 56331e95 authored by 冯超鹏's avatar 冯超鹏

Merge branch 'release/101'

# Conflicts:
#	app/Console/Commands/alarm.php
#	app/Console/Commands/chemicalswb.php
#	app/Console/Commands/firewb.php
#	app/Console/Commands/swoole.php
#	app/Console/Commands/swooleMeTcp.php
#	app/Http/Controllers/HomepageController.php
#	resources/js/views/dashboard/index.vue
#	resources/js/views/user/index.vue
parents b3f364f2 29e35bf0
Pipeline #188 canceled with stages
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
.rnd 100644 → 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
......@@ -58,6 +58,7 @@ class alarm extends Command
$url = config('public.swoolwebsocketurl');
$por = config('public.swoolwebsocketurlpor');
$this->ws = new \swoole_websocket_server('0.0.0.0', 9601,SWOOLE_PROCESS, SWOOLE_SOCK_TCP | SWOOLE_SSL); //创建一个端口
//$this->ws = new \swoole_websocket_server('0.0.0.0', 9601,SWOOLE_PROCESS); //创建一个端口
$this->ws->set(array(
'reactor_num' => 2, //reactor线程数
'worker_num' => 4, //worker进程数
......
......@@ -57,7 +57,7 @@ class chemicalswb extends Command
{
$url = config('public.swoolwebsocketurl');
$por = config('public.swoolwebsocketurlpor');
$this->ws = new \swoole_websocket_server('0.0.0.0', 9507,SWOOLE_PROCESS,SWOOLE_SOCK_TCP | SWOOLE_SSL); //创建一个端口
$this->ws = new \swoole_websocket_server('0.0.0.0', 9507,SWOOLE_PROCESS, SWOOLE_SOCK_TCP | SWOOLE_SSL); //创建一个端口
$this->ws->set(array(
'reactor_num' => 2, //reactor线程数
'worker_num' => 4, //worker进程数
......
......@@ -57,7 +57,7 @@ class firewb extends Command
{
$url = config('public.swoolwebsocketurl');
$por = config('public.swoolwebsocketurlpor');
$this->ws = new \swoole_websocket_server('0.0.0.0', 9508,SWOOLE_PROCESS,SWOOLE_SOCK_TCP | SWOOLE_SSL); //创建一个端口
$this->ws = new \swoole_websocket_server('0.0.0.0', 9508,SWOOLE_PROCESS, SWOOLE_SOCK_TCP | SWOOLE_SSL); //创建一个端口
$this->ws->set(array(
'reactor_num' => 2, //reactor线程数
'worker_num' => 4, //worker进程数
......
......@@ -57,7 +57,7 @@ class swoole extends Command
{
$url = config('public.swoolwebsocketurl');
$por = config('public.swoolwebsocketurlpor');
$this->ws = new \swoole_websocket_server('0.0.0.0', 9502,SWOOLE_PROCESS,SWOOLE_SOCK_TCP | SWOOLE_SSL); //创建一个端口
$this->ws = new \swoole_websocket_server('0.0.0.0', 9502|SWOOLE_PROCESS, SWOOLE_SOCK_TCP | SWOOLE_SSL); //创建一个端口
$this->ws->set(array(
'reactor_num' => 2, //reactor线程数
'worker_num' => 4, //worker进程数
......@@ -89,7 +89,6 @@ class swoole extends Command
echo "client:{$fd} is closed\n";
swoole_timer_clear($this->time);
});
$this->ws->start();
}
}
......@@ -5,6 +5,7 @@ namespace App\Console\Commands;
use App\Http\Controllers\Auth\SwooleCommandMeTcpController;
use Illuminate\Support\Facades\Log;
use Illuminate\Console\Command;
use App\Http\Controllers\Auth\ZehongTcpController;
class swooleMeTcp extends Command
{
public $tcp;
......@@ -55,14 +56,10 @@ class swooleMeTcp extends Command
public function start()
{
$url = config('public.swooletcpurl');
// $this->tcp = new \swoole_server('0.0.0.0', 9503, SWOOLE_PROCESS,SWOOLE_SOCK_TCP | SWOOLE_SSL);
//// $this->tcp->addlistener('0.0.0.0', 9504, SWOOLE_SOCK_TCP | SWOOLE_SSL); // 添加 TCP端口监听
//// $this->tcp->addlistener('0.0.0.0', 9505, SWOOLE_SOCK_TCP | SWOOLE_SSL); // 添加 TCP端口监听
//// $this->tcp->addlistener('0.0.0.0', 9506, SWOOLE_SOCK_TCP | SWOOLE_SSL); // 添加 TCP端口监听
$this->tcp = new \swoole_server('0.0.0.0', 9503, SWOOLE_PROCESS,SWOOLE_SOCK_TCP);
$this->tcp->addlistener('0.0.0.0', 9504, SWOOLE_SOCK_TCP); // 添加 TCP端口监听
$this->tcp->addlistener('0.0.0.0', 9505, SWOOLE_SOCK_TCP); // 添加 TCP端口监听
$this->tcp->addlistener('0.0.0.0', 9506, SWOOLE_SOCK_TCP); // 添加 TCP端口监听
$this->tcp = new \swoole_server('0.0.0.0', 9504,SWOOLE_PROCESS);
$this->tcp->addlistener('0.0.0.0', 9504,SWOOLE_SOCK_TCP); // 添加 TCP端口监听
$this->tcp->addlistener('0.0.0.0', 9505,SWOOLE_SOCK_TCP); // 添加 TCP端口监听
// $this->tcp->addlistener('0.0.0.0', 9506,SWOOLE_SOCK_TCP); // 添加 TCP端口监听
$this->tcp->set([
'worker_num' => 2,//设置启动的 Worker 进程数
'max_request' =>30,//最大任务数
......@@ -71,8 +68,6 @@ class swooleMeTcp extends Command
'backlog' => 128,
'heartbeat_check_interval' => 30,
'heartbeat_idle_time' => 65,
// 'ssl_cert_file' => base_path() . config('app.ssl_cert_file'),
// 'ssl_key_file' => base_path() . config('app.ssl_key_file'),
]);
//监听连接进入事件
$this->tcp->on('Connect', function ($serv, $fd) {
......@@ -88,10 +83,14 @@ class swooleMeTcp extends Command
$this->tcp->on('Receive', function ($serv, $fd, $from_id, $data) {
Log::channel('slack')->info($data);
//验证数据格式
if($this->formatData($data)){
$swooletcp = new SwooleCommandMeTcpController();
$swooletcp->swooletcplist($data);
}
// $serv->send($fd,$data);
// if($this->formatData($data)){
// $swooletcp = new SwooleCommandMeTcpController();
// $swooletcp->swooletcplist($data);
// }
$swooletcp = new ZehongTcpController();
// $swooletcp->swooletcplist($data);
$serv->send($fd,$swooletcp->swooletcplist($data));
});
//监听连接关闭事件
......
File mode changed from 100644 to 100755
<?php
namespace App\Console\Commands;
use App\Http\Controllers\Auth\ZehongTcpController;
use Illuminate\Support\Facades\Log;
use Illuminate\Console\Command;
class zehongTcp extends Command
{
public $tcp;
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'zehongTcp {action?}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'zehongTcp';
/**
* 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()
{
$url = config('public.swooletcpurl');
$this->tcp = new \swoole_server('0.0.0.0', 9503, SWOOLE_PROCESS);
$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[获取连swooletcplist接的信息]' => $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 ZehongTcpController();
// $swooletcp->swooletcplist($data);
$serv->send($fd,$swooletcp->swooletcplist($data));
});
//监听连接关闭事件
$this->tcp->on('Close', function ($serv, $fd) {
Log::channel('slack')->info('连接已断开' . ',' . 'id=>' . $fd);
});
//启动服务器
$this->tcp->start();
}
public function formatData($str)
{
$str = preg_replace("/[^a-z,A-Z,0-9,\/,\.,-]/", '', $str);
$str = rtrim(trim($str), '/');
$str = str_replace('null', -1, $str);
preg_match("/^[a-z,A-Z,0-9,\-]{6,32}\/(\d{1,2})\/(\-?)([0-9,\.]{1,8})$/", $str, $out);
if (count($out) > 0) {
return $str;
} else {
return false;
}
}
}
\ No newline at end of file
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
<?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;
use Illuminate\Support\Facades\Config;
class ZehongTcpController extends Controller
{
//获取 tcp 上传数据
public function swooletcplist($data = '')
{
if ($data != '') {
return $this->substrdata($data);
}
}
// 解开数据包
protected function substrdata($data)
{
if (is_string($data) && strlen($data) == 26) {
$deviceId = substr($data, 0, 15); // 设备编号
$status = substr($data, 15, 1); // 状态
$devicenp = substr($data, 16, 3); // 浓度
$devicefamen = substr($data, 19, 1);
$devicechongqi = substr($data, 20, 1);
$devicezijian = substr($data, 21, 1);
$devicecrc = substr($data, 22, 4);
$isdata = substr($data, 0, 22);
if($this->getPrc($isdata) == $devicecrc){
$data = ['id'=>$deviceId,'status'=>$status,'np'=>$devicenp,'famen'=>$devicefamen,'chongqi'=>$devicechongqi,'zijian'=>$devicezijian];
$totcp = json_decode($this->mysqldb($data),true);
if ($totcp == "暂无设备"){
return $totcp;
}
if($totcp['nd'] < 999 ){
$totcp['nd'] = '0' . $totcp['nd'];
}
$totcpdata = $totcp['devicenum'] .$totcp['devicepolice'] .$totcp['nd'] . $totcp['shutoff_status'] . $devicechongqi . $devicezijian;
$crcdata = $this->getPrc($totcpdata);
return $totcpdata . $crcdata;
}
} else {
return "数据格式错误";
}
}
//解出prc
protected function getPrc($msg)
{
/**
* If your input string is HEX-formatted you should comment #15 line
* for example: $msg="0123" equals to 0x0123 without leading 0x
*/
//conversion input string to plain HEX string. See comment above
$msg = bin2hex($msg);
//pack HEX-formatted $msg to the pure HEX array
$data = pack('H*', $msg);
//initialize crc as start HEX value;
$crc = 0xFFFF;
//loop $data array of HEX bytes
for ($i = 0; $i < strlen($data); $i++) {
//xor bits in the first byte of HEX value
$crc ^= ord($data[$i]);
//loop to shift every of 8 bits
for ($j = 8; $j != 0; $j--) {
//shift bits to the right and xor with polynome
if (($crc & 0x0001) != 0) {
$crc >>= 1;
$crc ^= 0xA001;
} else $crc >>= 1;
}
}
//return the result as HEX-formatted string
$data = strrev(sprintf('%04X', $crc));
$crc1 = strrev(substr($data, 0, 2));
$crc2 = strrev(substr($data, 2, 2));
return $crc1 . $crc2;
}
//获取上报数据从数据库查询
public function mysqldb($data){
if($data != []){
$datainfo = DB::table('device')
->where('devicenum','=',$data['id'])
->update(['nd'=>intval($data['np']),'shutoff_status'=>$data['famen'],'devicepolice'=>$data['status'] == 0 ? '1' : $data['status']]);
$todata = DB::table('device')
->where('devicenum','=',$data['id'])
->select('devicenum','nd','shutoff_status','devicepolice')
->first();
if ($todata){
return json_encode($todata);
}else{
return "暂无设备";
}
}
}
}
\ No newline at end of file
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
This diff is collapsed.
......@@ -21,23 +21,42 @@ use Validator;
class HomepageController extends Controller
{
//返回用户数量 设备数量, 报警数量 ,
public function homepagecount()
public function homepagecount(Request $request)
{
$type = $request->input('isuser');
if ($type == 'user') {
$usercount = Users::count();
$devicecount = Device::count();
$devicepolice = Device::where('devicepolice', '>', '1')->count();
$devicecount = Device::where('uid','=',Auth::id())->count();
$devicepolice = Device::where('uid','=',Auth::id())->where('devicepolice', '>', '1')->count();
// 设备在线数量
$device_online = Device::whereNotIn('devicepolice', [9, 15])->count();
$device_online = Device::where('uid','=',Auth::id())->whereNotIn('devicepolice', [9, 15])->count();
// 设备报警数量
$device_alarm = Device::whereIn('devicepolice', [4, 5, 6, 16])->count();
$device_alarm = Device::where('uid','=',Auth::id())->whereIn('devicepolice', [4, 5, 6, 16])->count();
// 未报警设备数量
$device_normal = Device::where('devicepolice', 1)->count();
$device_normal = Device::where('uid','=',Auth::id())->where('devicepolice', 1)->count();
// 故障设备
$device_offline = Device::whereNotIn('devicepolice', [1, 4, 5, 6, 16])->count();
$device_offline = Device::where('uid','=',Auth::id())->whereNotIn('devicepolice', [1, 4, 5, 6, 16])->count();
$t = time();//当前时间
$start = mktime(0, 0, 0, date("m", $t), date("d", $t), date("Y", $t));//今天的开始
$end = mktime(23, 59, 59, date("m", $t), date("d", $t), date("Y", $t));//今天的结束
$timedevicepolice = DB::table('reportpolice')->where('status', '=', '1')->whereBetween('starttime', [$start, $end])->count();
} else {
$usercount = Users::count();
$devicecount = Device::count();
$devicepolice = Device::where('devicepolice', '>', '1')->count();
// 设备在线数量
$device_online = Device::whereNotIn('devicepolice', [9, 15])->count();
// 设备报警数量
$device_alarm = Device::whereIn('devicepolice', [4, 5, 6, 16])->count();
// 未报警设备数量
$device_normal = Device::where('devicepolice', 1)->count();
// 故障设备
$device_offline = Device::whereNotIn('devicepolice', [1, 4, 5, 6, 16])->count();
$t = time();//当前时间
$start = mktime(0, 0, 0, date("m", $t), date("d", $t), date("Y", $t));//今天的开始
$end = mktime(23, 59, 59, date("m", $t), date("d", $t), date("Y", $t));//今天的结束
$timedevicepolice = DB::table('reportpolice')->where('status', '=', '1')->whereBetween('starttime', [$start, $end])->count();
}
return $this->jsonSuccessData([
'usercount' => $usercount,
'devicecount' => $devicecount,
......@@ -58,39 +77,62 @@ class HomepageController extends Controller
}
//返回一年当前月份
public function devicemonthcount()
public function devicemonthcount(Request $request)
{
$year_start = strtotime(date("Y") . "-01-01"); // 获取当前的1月份的时间戳
$endThismonth = mktime(23, 59, 59, date('m'), date('t'), date('Y')); //获取当月的时间戳
$devicedata = Device::whereBetween('deviceaddtime', [$year_start, $endThismonth])
->selectRaw('from_unixtime(deviceaddtime,"%Y-%m") as date,COUNT(id) as value')
->groupBy('date')
->get()
->toArray();
$policedata = Users::whereBetween('created_at', [date('Y-m-d H:i:s',$year_start), date('Y-m-d H:i:s',$endThismonth)])
->selectRaw('from_unixtime(unix_timestamp(created_at),"%Y-%m") as date,COUNT(id) as value')
->groupBy('date')
->get()
->toArray();
$devicepolice = Device::whereBetween('deviceaddtime', [$year_start, $endThismonth])
->where('devicepolice', '>', 1)
->selectRaw('from_unixtime(deviceaddtime,"%Y-%m") as date,COUNT(id) as value')
->groupBy('date')
->get()
->toArray();
$type = $request->input('isuser');
if ($type == 'user') {
$year_start = strtotime(date("Y") . "-01-01"); // 获取当前的1月份的时间戳
$endThismonth = mktime(23, 59, 59, date('m'), date('t'), date('Y')); //获取当月的时间戳
$devicedata = Device::where('uid','=',Auth::id())->whereBetween('deviceaddtime', [$year_start, $endThismonth])
->selectRaw('from_unixtime(deviceaddtime,"%Y-%m") as date,COUNT(id) as value')
->groupBy('date')
->get()
->toArray();
$policedata = Users::whereBetween('created_at', [date('Y-m-d H:i:s', $year_start), date('Y-m-d H:i:s', $endThismonth)])
->selectRaw('from_unixtime(unix_timestamp(created_at),"%Y-%m") as date,COUNT(id) as value')
->groupBy('date')
->get()
->toArray();
$devicepolice = Device::where('uid','=',Auth::id())->whereBetween('deviceaddtime', [$year_start, $endThismonth])
->where('devicepolice', '>', 1)
->selectRaw('from_unixtime(deviceaddtime,"%Y-%m") as date,COUNT(id) as value')
->groupBy('date')
->get()
->toArray();
}else{
$year_start = strtotime(date("Y") . "-01-01"); // 获取当前的1月份的时间戳
$endThismonth = mktime(23, 59, 59, date('m'), date('t'), date('Y')); //获取当月的时间戳
$devicedata = Device::whereBetween('deviceaddtime', [$year_start, $endThismonth])
->selectRaw('from_unixtime(deviceaddtime,"%Y-%m") as date,COUNT(id) as value')
->groupBy('date')
->get()
->toArray();
$policedata = Users::whereBetween('created_at', [date('Y-m-d H:i:s', $year_start), date('Y-m-d H:i:s', $endThismonth)])
->selectRaw('from_unixtime(unix_timestamp(created_at),"%Y-%m") as date,COUNT(id) as value')
->groupBy('date')
->get()
->toArray();
$devicepolice = Device::whereBetween('deviceaddtime', [$year_start, $endThismonth])
->where('devicepolice', '>', 1)
->selectRaw('from_unixtime(deviceaddtime,"%Y-%m") as date,COUNT(id) as value')
->groupBy('date')
->get()
->toArray();
}
return $this->jsonSuccessData(['devicedata' => $this->datamonth($devicedata), 'policedata' => $this->datamonth($policedata), 'devicepolice' => $this->datamonth($devicepolice)]);
}
//用户统计
public function UserStatistics (){
$devicecount = Device::where('uid','=',Auth::id())->count();
$devicepolice = Device::where('devicepolice', '>', '1')->where('uid','=',Auth::id())->count();
public function UserStatistics()
{
$devicecount = Device::where('uid', '=', Auth::id())->count();
$devicepolice = Device::where('devicepolice', '>', '1')->where('uid', '=', Auth::id())->count();
$t = time();//当前时间
$start = mktime(0, 0, 0, date("m", $t), date("d", $t), date("Y", $t));//今天的开始
$end = mktime(23, 59, 59, date("m", $t), date("d", $t), date("Y", $t));//今天的结束
$timedevicepolice = DB::table('reportpolice as r')
->join('device as d','d.devicenum','=','r.devicenumber')
->where('d.uid','=',Auth::id())
->join('device as d', 'd.devicenum', '=', 'r.devicenumber')
->where('d.uid', '=', Auth::id())
->where('r.status', '=', '1')
->whereBetween('r.starttime', [$start, $end])
->count();
......@@ -103,12 +145,12 @@ class HomepageController extends Controller
\Session::put(['loginuid' => Auth::id()]);
$year_start = strtotime(date("Y") . "-01-01"); // 获取当前的1月份的时间戳
$endThismonth = mktime(23, 59, 59, date('m'), date('t'), date('Y')); //获取当月的时间戳
$devicedata = Device::where('uid','=',Auth::id())->whereBetween('deviceaddtime', [$year_start, $endThismonth])
$devicedata = Device::where('uid', '=', Auth::id())->whereBetween('deviceaddtime', [$year_start, $endThismonth])
->selectRaw('from_unixtime(deviceaddtime,"%Y-%m") as date,COUNT(id) as value')
->groupBy('date')
->get()
->toArray();
$devicepolice = Device::where('uid','=',Auth::id())->whereBetween('deviceaddtime', [$year_start, $endThismonth])
$devicepolice = Device::where('uid', '=', Auth::id())->whereBetween('deviceaddtime', [$year_start, $endThismonth])
->where('devicepolice', '>', 1)
->selectRaw('from_unixtime(deviceaddtime,"%Y-%m") as date,COUNT(id) as value')
->groupBy('date')
......@@ -128,7 +170,7 @@ class HomepageController extends Controller
$size = $this->getDirSize($phay);
$base_path = @round($size / pow(1024, ($i = floor(log($size, 1024)))), 2);
$end_time = microtime(true);
return $this->jsonSuccessData(['memory' => round($memory), 'base_path' => round($base_path) / 10, 'end_time' => round($end_time - $start_time), 'dabatime' => ceil($this->dabadas()),'rand'=>rand(1,100)]);
return $this->jsonSuccessData(['memory' => round($memory), 'base_path' => round($base_path) / 10, 'end_time' => round($end_time - $start_time), 'dabatime' => ceil($this->dabadas()), 'rand' => rand(1, 100)]);
}
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
......@@ -40,60 +40,115 @@ class UinappHomeController extends Controller
public function imitation(Request $request)
{
$imitationdata = $request->input('imitationdata');
$type = $request->input('isuser');
if ($imitationdata != '') {
if ($this->isKanji($imitationdata)) {
if ($type == 'user') {
$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.username', 'like', '%' . $imitationdata . '%')
->where('u.id', '=', Auth::id())
->select('d.*', 't.tname', 'g.gas', 'w.danwei', 's.status_name', 'u.username as nameh', 'u.isadmin')
->get();
} else {
$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.username', 'like', '%' . $imitationdata . '%')
->select('d.*', 't.tname', 'g.gas', 'w.danwei', 's.status_name', 'u.username as nameh', 'u.isadmin')
->get();
}
} else {
if ($type == 'user') {
$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.devicenum', 'like', '%' . $imitationdata . '%')
->where('u.id','=',Auth::id())
->select('d.*', 't.tname', 'g.gas', 'w.danwei', 's.status_name', 'u.username as nameh', 'u.isadmin')
->get();
}else{
$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.devicenum', 'like', '%' . $imitationdata . '%')
->select('d.*', 't.tname', 'g.gas', 'w.danwei', 's.status_name', 'u.username as nameh', 'u.isadmin')
->get();
}
}
return $this->jsonSuccessData($data);
} else {
return $this->jsonSuccessData('');
}
}
//指定查询
public function setseachdata(Request $request)
{
$setdata = $request->input('setseachdata');
$type = $request->input('isuser');
if ($this->isKanji($setdata)) {
if($type == 'user'){
$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.username', 'like', '%' . $imitationdata . '%')
->where('d.username', '=', $setdata)
->where('u.id','=',Auth::id())
->select('d.*', 't.tname', 'g.gas', 'w.danwei', 's.status_name', 'u.username as nameh', 'u.isadmin')
->get();
} else {
}else{
$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.devicenum', 'like', '%' . $imitationdata . '%')
->where('d.username', '=', $setdata)
->select('d.*', 't.tname', 'g.gas', 'w.danwei', 's.status_name', 'u.username as nameh', 'u.isadmin')
->get();
}
return $this->jsonSuccessData($data);
} else {
return $this->jsonSuccessData('');
}
}
//指定查询
public function setseachdata(Request $request)
{
$setdata = $request->input('setseachdata');
if ($this->isKanji($setdata)) {
$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.username', '=', $setdata)
->select('d.*', 't.tname', 'g.gas', 'w.danwei', 's.status_name', 'u.username as nameh', 'u.isadmin')
->get();
} else {
$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.devicenum', '=', $setdata)
->select('d.*', 't.tname', 'g.gas', 'w.danwei', 's.status_name', 'u.username as nameh', 'u.isadmin')
->get();
if($type == 'user'){
$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.devicenum', '=', $setdata)
->where('u.id','=',Auth::id())
->select('d.*', 't.tname', 'g.gas', 'w.danwei', 's.status_name', 'u.username as nameh', 'u.isadmin')
->get();
}else{
$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.devicenum', '=', $setdata)
->select('d.*', 't.tname', 'g.gas', 'w.danwei', 's.status_name', 'u.username as nameh', 'u.isadmin')
->get();
}
}
return $this->jsonSuccessData($data);
}
......@@ -141,11 +196,11 @@ class UinappHomeController extends Controller
// die();
$isemail = $request->input('email');
$num = str_pad(mt_rand(0, 999999), 6, "0", STR_PAD_BOTH);
if ($isemail != ''){
$send = $this->PHPMailer($isemail,$num);
if($send == 200){
return $this->jsonSuccessData($num);
}
if ($isemail != '') {
$send = $this->PHPMailer($isemail, $num);
if ($send == 200) {
return $this->jsonSuccessData($num);
}
}
}
......@@ -158,11 +213,12 @@ class UinappHomeController extends Controller
return false;
}
}
/*
* $name 发件人
* $num 随机字符串 验证码
* */
private function PHPMailer($name,$num)
private function PHPMailer($name, $num)
{
include_once app_path() . '/Http/Controllers/src/PHPMailer.php';
include_once app_path() . '/Http/Controllers/src/SMTP.php';
......
......@@ -16,7 +16,7 @@ class UploadimgController extends Controller
// 上传图片接口
public function uploadingimg(Request $request)
{
if ($request->isMethod('POST')) { //判断文件是否是 POST的方式上传
if ($request->isMethod('post')) { //判断文件是否是 POST的方式上传
$tmp = $request->file('file');
if (is_null($tmp)){
return $this->jsonErrorData(105,'上传图片不能为空');
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
This diff is collapsed.
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
This diff is collapsed.
File mode changed from 100644 to 100755
This diff is collapsed.
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
This diff is collapsed.
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
This diff is collapsed.
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
This diff is collapsed.
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
This diff is collapsed.
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
This diff is collapsed.
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
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