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