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

应用

parent 68275847
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 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
...@@ -57,18 +57,13 @@ class alarm extends Command ...@@ -57,18 +57,13 @@ class alarm extends Command
{ {
$url = config('public.swoolwebsocketurl'); $url = config('public.swoolwebsocketurl');
$por = config('public.swoolwebsocketurlpor'); $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( $this->ws->set(array(
'reactor_num' => 2, //reactor线程数 'reactor_num' => 2, //reactor线程数
'worker_num' => 4, //worker进程数 'worker_num' => 4, //worker进程数
'backlog' => 128, //Listen队列长度 'backlog' => 128, //Listen队列长度
'max_request' => 10,//最大连接 'max_request' => 10,//最大连接
'daemonize'=>0,//守护进程 'daemonize'=>0,//守护进程
'ssl_cert_file' => base_path() . '/tests/textcert/ssl.pem',
'ssl_key_file' => base_path() . '/tests/textcert/4544322_iot.zhkjgf.com.key',
// 'ssl_verify_peer' => true,
// 'ssl_allow_self_signed' => true,
// 'ssl_client_cert_file' => base_path() . '/tests/textcert/4544322_iot.zhkjgf.com_chain',
)); ));
$this->ws->on('open', function ($ws, $request) { $this->ws->on('open', function ($ws, $request) {
// //链接成功 // //链接成功
......
...@@ -57,18 +57,13 @@ class chemicalswb extends Command ...@@ -57,18 +57,13 @@ class chemicalswb extends Command
{ {
$url = config('public.swoolwebsocketurl'); $url = config('public.swoolwebsocketurl');
$por = config('public.swoolwebsocketurlpor'); $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); //创建一个端口
$this->ws->set(array( $this->ws->set(array(
'reactor_num' => 2, //reactor线程数 'reactor_num' => 2, //reactor线程数
'worker_num' => 4, //worker进程数 'worker_num' => 4, //worker进程数
'backlog' => 128, //Listen队列长度 'backlog' => 128, //Listen队列长度
'max_request' => 10,//最大连接 'max_request' => 10,//最大连接
'daemonize'=>0,//守护进程 'daemonize'=>0,//守护进程
'ssl_cert_file' => base_path() . '/tests/textcert/4544322_iot.zhkjgf.com_public.crt',
'ssl_key_file' => base_path() . '/tests/textcert/4544322_iot.zhkjgf.com.key',
// 'ssl_verify_peer' => true,
// 'ssl_allow_self_signed' => true,
// 'ssl_client_cert_file' => base_path() . '/tests/textcert/4544322_iot.zhkjgf.com_chain',
)); ));
$this->ws->on('open', function ($ws, $request) { $this->ws->on('open', function ($ws, $request) {
// //链接成功 // //链接成功
......
...@@ -57,18 +57,13 @@ class firewb extends Command ...@@ -57,18 +57,13 @@ class firewb extends Command
{ {
$url = config('public.swoolwebsocketurl'); $url = config('public.swoolwebsocketurl');
$por = config('public.swoolwebsocketurlpor'); $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); //创建一个端口
$this->ws->set(array( $this->ws->set(array(
'reactor_num' => 2, //reactor线程数 'reactor_num' => 2, //reactor线程数
'worker_num' => 4, //worker进程数 'worker_num' => 4, //worker进程数
'backlog' => 128, //Listen队列长度 'backlog' => 128, //Listen队列长度
'max_request' => 10,//最大连接 'max_request' => 10,//最大连接
'daemonize'=>0,//守护进程 'daemonize'=>0,//守护进程
'ssl_cert_file' => base_path() . '/tests/textcert/4544322_iot.zhkjgf.com_public.crt',
'ssl_key_file' => base_path() . '/tests/textcert/4544322_iot.zhkjgf.com.key',
'ssl_verify_peer' => true,
'ssl_allow_self_signed' => true,
'ssl_client_cert_file' => base_path() . '/tests/textcert/4544322_iot.zhkjgf.com_chain',
)); ));
$this->ws->on('open', function ($ws, $request) { $this->ws->on('open', function ($ws, $request) {
// //链接成功 // //链接成功
......
...@@ -57,18 +57,13 @@ class swoole extends Command ...@@ -57,18 +57,13 @@ class swoole extends Command
{ {
$url = config('public.swoolwebsocketurl'); $url = config('public.swoolwebsocketurl');
$por = config('public.swoolwebsocketurlpor'); $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); //创建一个端口
$this->ws->set(array( $this->ws->set(array(
'reactor_num' => 2, //reactor线程数 'reactor_num' => 2, //reactor线程数
'worker_num' => 4, //worker进程数 'worker_num' => 4, //worker进程数
'backlog' => 128, //Listen队列长度 'backlog' => 128, //Listen队列长度
'max_request' => 10,//最大连接 'max_request' => 10,//最大连接
'daemonize'=>0,//守护进程 'daemonize'=>0,//守护进程
'ssl_cert_file' => base_path() . '/tests/textcert/4544322_iot.zhkjgf.com_public.crt',
'ssl_key_file' => base_path() . '/tests/textcert/4544322_iot.zhkjgf.com.key',
'ssl_verify_peer' => true,
'ssl_allow_self_signed' => true,
'ssl_client_cert_file' => base_path() . '/tests/textcert/4544322_iot.zhkjgf.com_chain',
)); ));
$this->ws->on('open', function ($ws, $request) { $this->ws->on('open', function ($ws, $request) {
// //链接成功 // //链接成功
...@@ -92,7 +87,6 @@ class swoole extends Command ...@@ -92,7 +87,6 @@ class swoole extends Command
echo "client:{$fd} is closed\n"; echo "client:{$fd} is closed\n";
swoole_timer_clear($this->time); swoole_timer_clear($this->time);
}); });
$this->ws->start(); $this->ws->start();
} }
} }
...@@ -55,10 +55,10 @@ class swooleMeTcp extends Command ...@@ -55,10 +55,10 @@ class swooleMeTcp extends Command
public function start() public function start()
{ {
$url = config('public.swooletcpurl'); $url = config('public.swooletcpurl');
$this->tcp = new \swoole_server('0.0.0.0', 9503, SWOOLE_PROCESS,SWOOLE_SOCK_TCP | SWOOLE_SSL); $this->tcp = new \swoole_server('0.0.0.0', 9504,SWOOLE_PROCESS);
$this->tcp->addlistener('0.0.0.0', 9504, SWOOLE_PROCESS,SWOOLE_SOCK_TCP | SWOOLE_SSL); // 添加 TCP端口监听 $this->tcp->addlistener('0.0.0.0', 9504,SWOOLE_SOCK_TCP); // 添加 TCP端口监听
$this->tcp->addlistener('0.0.0.0', 9505, SWOOLE_PROCESS,SWOOLE_SOCK_TCP | SWOOLE_SSL); // 添加 TCP端口监听 $this->tcp->addlistener('0.0.0.0', 9505,SWOOLE_SOCK_TCP); // 添加 TCP端口监听
$this->tcp->addlistener('0.0.0.0', 9506, SWOOLE_PROCESS,SWOOLE_SOCK_TCP | SWOOLE_SSL); // 添加 TCP端口监听 // $this->tcp->addlistener('0.0.0.0', 9506,SWOOLE_SOCK_TCP); // 添加 TCP端口监听
$this->tcp->set([ $this->tcp->set([
'worker_num' => 2,//设置启动的 Worker 进程数 'worker_num' => 2,//设置启动的 Worker 进程数
'max_request' =>30,//最大任务数 'max_request' =>30,//最大任务数
...@@ -67,11 +67,6 @@ class swooleMeTcp extends Command ...@@ -67,11 +67,6 @@ class swooleMeTcp extends Command
'backlog' => 128, 'backlog' => 128,
'heartbeat_check_interval' => 30, 'heartbeat_check_interval' => 30,
'heartbeat_idle_time' => 65, 'heartbeat_idle_time' => 65,
'ssl_cert_file' => base_path() . '/tests/textcert/4544322_iot.zhkjgf.com_public.crt',
'ssl_key_file' => base_path() . '/tests/textcert/4544322_iot.zhkjgf.com.key',
'ssl_verify_peer' => true,
'ssl_allow_self_signed' => true,
'ssl_client_cert_file' => base_path() . '/tests/textcert/4544322_iot.zhkjgf.com_chain',
]); ]);
//监听连接进入事件 //监听连接进入事件
$this->tcp->on('Connect', function ($serv, $fd) { $this->tcp->on('Connect', function ($serv, $fd) {
...@@ -86,6 +81,7 @@ class swooleMeTcp extends Command ...@@ -86,6 +81,7 @@ class swooleMeTcp extends Command
//监听数据接收事件 //监听数据接收事件
$this->tcp->on('Receive', function ($serv, $fd, $from_id, $data) { $this->tcp->on('Receive', function ($serv, $fd, $from_id, $data) {
//验证数据格式 //验证数据格式
$serv->send($fd,$data);
if($this->formatData($data)){ if($this->formatData($data)){
$swooletcp = new SwooleCommandMeTcpController(); $swooletcp = new SwooleCommandMeTcpController();
$swooletcp->swooletcplist($data); $swooletcp->swooletcplist($data);
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 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.
...@@ -21,8 +21,21 @@ use Validator; ...@@ -21,8 +21,21 @@ use Validator;
class HomepageController extends Controller class HomepageController extends Controller
{ {
//返回用户数量 设备数量, 报警数量 , //返回用户数量 设备数量, 报警数量 ,
public function homepagecount() public function homepagecount(Request $request)
{ {
$type = $request->input('isuser');
if ($type == 'user') {
$usercount = Users::count();
$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')->where('status', '=', '1')->whereBetween('starttime', [$start, $end])->count();
$offdevice = Device::where('devicepolice', '=', '1')->where('uid','=',Auth::id())->count();
//计算设备在线
$deviceurt = $devicecount / $offdevice;
} else {
$usercount = Users::count(); $usercount = Users::count();
$devicecount = Device::count(); $devicecount = Device::count();
$devicepolice = Device::where('devicepolice', '>', '1')->count(); $devicepolice = Device::where('devicepolice', '>', '1')->count();
...@@ -30,7 +43,11 @@ class HomepageController extends Controller ...@@ -30,7 +43,11 @@ class HomepageController extends Controller
$start = mktime(0, 0, 0, date("m", $t), date("d", $t), date("Y", $t));//今天的开始 $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));//今天的结束 $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(); $timedevicepolice = DB::table('reportpolice')->where('status', '=', '1')->whereBetween('starttime', [$start, $end])->count();
return $this->jsonSuccessData(['usercount' => $usercount, 'devicecount' => $devicecount, 'devicepolice' => $devicepolice, 'timedevicepolice' => $timedevicepolice]); $offdevice = Device::where('devicepolice', '=', '1')->count();
//计算设备在线
$deviceurt = $devicecount / $offdevice;
}
return $this->jsonSuccessData(['usercount' => $usercount, 'devicecount' => $devicecount, 'devicepolice' => $devicepolice, 'timedevicepolice' => $timedevicepolice, 'offdevice' => $offdevice, 'deviceurt' => round($deviceurt)]);
} }
public function gettimeline() public function gettimeline()
...@@ -39,8 +56,29 @@ class HomepageController extends Controller ...@@ -39,8 +56,29 @@ class HomepageController extends Controller
} }
//返回一年当前月份 //返回一年当前月份
public function devicemonthcount() public function devicemonthcount(Request $request)
{ {
$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月份的时间戳 $year_start = strtotime(date("Y") . "-01-01"); // 获取当前的1月份的时间戳
$endThismonth = mktime(23, 59, 59, date('m'), date('t'), date('Y')); //获取当月的时间戳 $endThismonth = mktime(23, 59, 59, date('m'), date('t'), date('Y')); //获取当月的时间戳
$devicedata = Device::whereBetween('deviceaddtime', [$year_start, $endThismonth]) $devicedata = Device::whereBetween('deviceaddtime', [$year_start, $endThismonth])
...@@ -48,7 +86,7 @@ class HomepageController extends Controller ...@@ -48,7 +86,7 @@ class HomepageController extends Controller
->groupBy('date') ->groupBy('date')
->get() ->get()
->toArray(); ->toArray();
$policedata = Users::whereBetween('created_at', [date('Y-m-d H:i:s',$year_start), date('Y-m-d H:i:s',$endThismonth)]) $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') ->selectRaw('from_unixtime(unix_timestamp(created_at),"%Y-%m") as date,COUNT(id) as value')
->groupBy('date') ->groupBy('date')
->get() ->get()
...@@ -59,19 +97,21 @@ class HomepageController extends Controller ...@@ -59,19 +97,21 @@ class HomepageController extends Controller
->groupBy('date') ->groupBy('date')
->get() ->get()
->toArray(); ->toArray();
}
return $this->jsonSuccessData(['devicedata' => $this->datamonth($devicedata), 'policedata' => $this->datamonth($policedata), 'devicepolice' => $this->datamonth($devicepolice)]); return $this->jsonSuccessData(['devicedata' => $this->datamonth($devicedata), 'policedata' => $this->datamonth($policedata), 'devicepolice' => $this->datamonth($devicepolice)]);
} }
//用户统计 //用户统计
public function UserStatistics (){ public function UserStatistics()
$devicecount = Device::where('uid','=',Auth::id())->count(); {
$devicepolice = Device::where('devicepolice', '>', '1')->where('uid','=',Auth::id())->count(); $devicecount = Device::where('uid', '=', Auth::id())->count();
$devicepolice = Device::where('devicepolice', '>', '1')->where('uid', '=', Auth::id())->count();
$t = time();//当前时间 $t = time();//当前时间
$start = mktime(0, 0, 0, date("m", $t), date("d", $t), date("Y", $t));//今天的开始 $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));//今天的结束 $end = mktime(23, 59, 59, date("m", $t), date("d", $t), date("Y", $t));//今天的结束
$timedevicepolice = DB::table('reportpolice as r') $timedevicepolice = DB::table('reportpolice as r')
->join('device as d','d.devicenum','=','r.devicenumber') ->join('device as d', 'd.devicenum', '=', 'r.devicenumber')
->where('d.uid','=',Auth::id()) ->where('d.uid', '=', Auth::id())
->where('r.status', '=', '1') ->where('r.status', '=', '1')
->whereBetween('r.starttime', [$start, $end]) ->whereBetween('r.starttime', [$start, $end])
->count(); ->count();
...@@ -84,12 +124,12 @@ class HomepageController extends Controller ...@@ -84,12 +124,12 @@ class HomepageController extends Controller
\Session::put(['loginuid' => Auth::id()]); \Session::put(['loginuid' => Auth::id()]);
$year_start = strtotime(date("Y") . "-01-01"); // 获取当前的1月份的时间戳 $year_start = strtotime(date("Y") . "-01-01"); // 获取当前的1月份的时间戳
$endThismonth = mktime(23, 59, 59, date('m'), date('t'), date('Y')); //获取当月的时间戳 $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') ->selectRaw('from_unixtime(deviceaddtime,"%Y-%m") as date,COUNT(id) as value')
->groupBy('date') ->groupBy('date')
->get() ->get()
->toArray(); ->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) ->where('devicepolice', '>', 1)
->selectRaw('from_unixtime(deviceaddtime,"%Y-%m") as date,COUNT(id) as value') ->selectRaw('from_unixtime(deviceaddtime,"%Y-%m") as date,COUNT(id) as value')
->groupBy('date') ->groupBy('date')
...@@ -109,7 +149,7 @@ class HomepageController extends Controller ...@@ -109,7 +149,7 @@ class HomepageController extends Controller
$size = $this->getDirSize($phay); $size = $this->getDirSize($phay);
$base_path = @round($size / pow(1024, ($i = floor(log($size, 1024)))), 2); $base_path = @round($size / pow(1024, ($i = floor(log($size, 1024)))), 2);
$end_time = microtime(true); $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,9 +40,10 @@ class UinappHomeController extends Controller ...@@ -40,9 +40,10 @@ class UinappHomeController extends Controller
public function imitation(Request $request) public function imitation(Request $request)
{ {
$imitationdata = $request->input('imitationdata'); $imitationdata = $request->input('imitationdata');
$type = $request->input('isuser');
if ($imitationdata != '') { if ($imitationdata != '') {
if ($this->isKanji($imitationdata)) { if ($this->isKanji($imitationdata)) {
if ($type == 'user') {
$data = DB::table('device as d') $data = DB::table('device as d')
->join('device_type as t', 'd.dtype', '=', 't.tid') ->join('device_type as t', 'd.dtype', '=', 't.tid')
->join('gas as g', 'd.status', '=', 'g.id') ->join('gas as g', 'd.status', '=', 'g.id')
...@@ -50,9 +51,34 @@ class UinappHomeController extends Controller ...@@ -50,9 +51,34 @@ class UinappHomeController extends Controller
->join('status as s', 'd.devicepolice', '=', 's.id') ->join('status as s', 'd.devicepolice', '=', 's.id')
->join('users as u', 'd.uid', '=', 'u.id') ->join('users as u', 'd.uid', '=', 'u.id')
->where('d.username', 'like', '%' . $imitationdata . '%') ->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') ->select('d.*', 't.tname', 'g.gas', 'w.danwei', 's.status_name', 'u.username as nameh', 'u.isadmin')
->get(); ->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.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') $data = DB::table('device as d')
->join('device_type as t', 'd.dtype', '=', 't.tid') ->join('device_type as t', 'd.dtype', '=', 't.tid')
->join('gas as g', 'd.status', '=', 'g.id') ->join('gas as g', 'd.status', '=', 'g.id')
...@@ -63,6 +89,8 @@ class UinappHomeController extends Controller ...@@ -63,6 +89,8 @@ class UinappHomeController extends Controller
->select('d.*', 't.tname', 'g.gas', 'w.danwei', 's.status_name', 'u.username as nameh', 'u.isadmin') ->select('d.*', 't.tname', 'g.gas', 'w.danwei', 's.status_name', 'u.username as nameh', 'u.isadmin')
->get(); ->get();
} }
}
return $this->jsonSuccessData($data); return $this->jsonSuccessData($data);
} else { } else {
return $this->jsonSuccessData(''); return $this->jsonSuccessData('');
...@@ -74,7 +102,9 @@ class UinappHomeController extends Controller ...@@ -74,7 +102,9 @@ class UinappHomeController extends Controller
public function setseachdata(Request $request) public function setseachdata(Request $request)
{ {
$setdata = $request->input('setseachdata'); $setdata = $request->input('setseachdata');
$type = $request->input('isuser');
if ($this->isKanji($setdata)) { if ($this->isKanji($setdata)) {
if($type == 'user'){
$data = DB::table('device as d') $data = DB::table('device as d')
->join('device_type as t', 'd.dtype', '=', 't.tid') ->join('device_type as t', 'd.dtype', '=', 't.tid')
->join('gas as g', 'd.status', '=', 'g.id') ->join('gas as g', 'd.status', '=', 'g.id')
...@@ -82,9 +112,33 @@ class UinappHomeController extends Controller ...@@ -82,9 +112,33 @@ class UinappHomeController extends Controller
->join('status as s', 'd.devicepolice', '=', 's.id') ->join('status as s', 'd.devicepolice', '=', 's.id')
->join('users as u', 'd.uid', '=', 'u.id') ->join('users as u', 'd.uid', '=', 'u.id')
->where('d.username', '=', $setdata) ->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') ->select('d.*', 't.tname', 'g.gas', 'w.danwei', 's.status_name', 'u.username as nameh', 'u.isadmin')
->get(); ->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', '=', $setdata)
->select('d.*', 't.tname', 'g.gas', 'w.danwei', 's.status_name', 'u.username as nameh', 'u.isadmin')
->get();
}
} else { } 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', '=', $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') $data = DB::table('device as d')
->join('device_type as t', 'd.dtype', '=', 't.tid') ->join('device_type as t', 'd.dtype', '=', 't.tid')
->join('gas as g', 'd.status', '=', 'g.id') ->join('gas as g', 'd.status', '=', 'g.id')
...@@ -95,6 +149,7 @@ class UinappHomeController extends Controller ...@@ -95,6 +149,7 @@ class UinappHomeController extends Controller
->select('d.*', 't.tname', 'g.gas', 'w.danwei', 's.status_name', 'u.username as nameh', 'u.isadmin') ->select('d.*', 't.tname', 'g.gas', 'w.danwei', 's.status_name', 'u.username as nameh', 'u.isadmin')
->get(); ->get();
} }
}
return $this->jsonSuccessData($data); return $this->jsonSuccessData($data);
} }
...@@ -141,9 +196,9 @@ class UinappHomeController extends Controller ...@@ -141,9 +196,9 @@ class UinappHomeController extends Controller
// die(); // die();
$isemail = $request->input('email'); $isemail = $request->input('email');
$num = str_pad(mt_rand(0, 999999), 6, "0", STR_PAD_BOTH); $num = str_pad(mt_rand(0, 999999), 6, "0", STR_PAD_BOTH);
if ($isemail != ''){ if ($isemail != '') {
$send = $this->PHPMailer($isemail,$num); $send = $this->PHPMailer($isemail, $num);
if($send == 200){ if ($send == 200) {
return $this->jsonSuccessData($num); return $this->jsonSuccessData($num);
} }
} }
...@@ -158,11 +213,12 @@ class UinappHomeController extends Controller ...@@ -158,11 +213,12 @@ class UinappHomeController extends Controller
return false; return false;
} }
} }
/* /*
* $name 发件人 * $name 发件人
* $num 随机字符串 验证码 * $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/PHPMailer.php';
include_once app_path() . '/Http/Controllers/src/SMTP.php'; include_once app_path() . '/Http/Controllers/src/SMTP.php';
......
...@@ -16,7 +16,7 @@ class UploadimgController extends Controller ...@@ -16,7 +16,7 @@ class UploadimgController extends Controller
// 上传图片接口 // 上传图片接口
public function uploadingimg(Request $request) public function uploadingimg(Request $request)
{ {
if ($request->isMethod('POST')) { //判断文件是否是 POST的方式上传 if ($request->isMethod('post')) { //判断文件是否是 POST的方式上传
$tmp = $request->file('file'); $tmp = $request->file('file');
if (is_null($tmp)){ if (is_null($tmp)){
return $this->jsonErrorData(105,'上传图片不能为空'); 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
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 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.
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 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