Fix
parent
153e830ed3
commit
cd75ea7a2b
|
|
@ -9,6 +9,7 @@ use App\Services\LinkosDeviceLogService;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Arr;
|
use Illuminate\Support\Arr;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
class LinkosController extends Controller
|
class LinkosController extends Controller
|
||||||
{
|
{
|
||||||
|
|
@ -16,20 +17,22 @@ class LinkosController extends Controller
|
||||||
{
|
{
|
||||||
$input = $request->input();
|
$input = $request->input();
|
||||||
|
|
||||||
if (isset($input['notify_type'])) {
|
DB::transaction(function () use ($input) {
|
||||||
// 设备上线、离线通知
|
if (isset($input['notify_type'])) {
|
||||||
if ($input['notify_type'] === 'online_state_change') {
|
// 设备上线、离线通知
|
||||||
$this->handleOnlineStateChangeNotify($input);
|
if ($input['notify_type'] === 'online_state_change') {
|
||||||
}
|
$this->handleOnlineStateChangeNotify($input);
|
||||||
} elseif (Arr::has($input, ['device_id', 'device_unit', 'device_category'])) {
|
}
|
||||||
$type = (int) ($input['type'] ?? 0);
|
} elseif (Arr::has($input, ['device_id', 'device_unit', 'device_category'])) {
|
||||||
|
$type = (int) ($input['type'] ?? 0);
|
||||||
|
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case 0:
|
case 0:
|
||||||
$this->handleDeviceDataNotify($input);
|
$this->handleDeviceDataNotify($input);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
return response()->json(['code' => 0, 'msg' => 'ok']);
|
return response()->json(['code' => 0, 'msg' => 'ok']);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -437,8 +437,10 @@ class LinkosDeviceLogService
|
||||||
// 角度转弧度
|
// 角度转弧度
|
||||||
$radian = deg2rad($sample['wind_degree']);
|
$radian = deg2rad($sample['wind_degree']);
|
||||||
|
|
||||||
$x += $sample['wind_speed'] * sin($radian);
|
// $x += $sample['wind_speed'] * sin($radian);
|
||||||
$y += $sample['wind_speed'] * cos($radian);
|
// $y += $sample['wind_speed'] * cos($radian);
|
||||||
|
$x += sin($radian);
|
||||||
|
$y += cos($radian);
|
||||||
}
|
}
|
||||||
|
|
||||||
$degree = round(rad2deg(atan($x / $y)));
|
$degree = round(rad2deg(atan($x / $y)));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue