|
|
@@ -29,79 +29,6 @@ class ManDeviceJobLf implements ShouldQueue
|
|
|
$this->url = config('ip.zslfip');
|
|
|
}
|
|
|
|
|
|
-// public function handle()
|
|
|
-// {
|
|
|
-// try{
|
|
|
-// if(empty($this->data['data'])) return;
|
|
|
-//
|
|
|
-// $deviceId = $this->data['data']['deviceId'];
|
|
|
-// if($this->data['type'] == "dataPoint"){
|
|
|
-// foreach ($this->data['data']['dataPoints'] as $value){
|
|
|
-// $dev_eui = $deviceId . $value['dataPointId'];
|
|
|
-//
|
|
|
-// if(empty($value['value'])) continue;
|
|
|
-//
|
|
|
-// //发送给朗峰
|
|
|
-// $this->sendToDevice(['dev_eui' => $dev_eui, 'value' => $value['value']]);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }catch (\Exception $exception){
|
|
|
-// file_put_contents('send_man_error_lf.txt',date("Y-m-d H:i:s").json_encode($this->data).PHP_EOL.$exception->getMessage().$exception->getLine().$exception->getFile().PHP_EOL,8);
|
|
|
-// $this->delete();
|
|
|
-// }
|
|
|
-// }
|
|
|
-
|
|
|
-// public function sendToDevice($data){
|
|
|
-// list($status,$token) = ClearDataService::getTokenLf();
|
|
|
-// if(! $status) return;
|
|
|
-//
|
|
|
-// $url = $this->url . "api/module-data/device_machine_record/device_machine_record/diy/create_single_data";
|
|
|
-// $post = [
|
|
|
-// 'bizId' => -1,
|
|
|
-// 'bizTypeEk' => 'LOWCODE',
|
|
|
-// 'data' => [
|
|
|
-// 'device_machine_record' => [
|
|
|
-// 'machine_code' => $data['dev_eui'],
|
|
|
-// 'param_value' => floatval($data['value']),
|
|
|
-// 'record_time' => $this->getNowDay()
|
|
|
-// ]
|
|
|
-// ],
|
|
|
-// 'dynamicFormId' => '477743923368955904',
|
|
|
-// 'showModelId' => '477745421456904192'
|
|
|
-// ];
|
|
|
-// $header = ["Authorization: Bearer {$token}","Content-Type:application/json","Site:LFMY"];
|
|
|
-//
|
|
|
-// $curl = curl_init();
|
|
|
-// curl_setopt_array($curl, array(
|
|
|
-// CURLOPT_URL => $url,
|
|
|
-// CURLOPT_RETURNTRANSFER => true,
|
|
|
-// CURLOPT_ENCODING => '',
|
|
|
-// CURLOPT_MAXREDIRS => 10,
|
|
|
-// CURLOPT_TIMEOUT => 15,
|
|
|
-// CURLOPT_FOLLOWLOCATION => true,
|
|
|
-// CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
|
|
-// CURLOPT_CUSTOMREQUEST => 'POST',
|
|
|
-// CURLOPT_POSTFIELDS => json_encode($post),
|
|
|
-// CURLOPT_SSL_VERIFYPEER => false,
|
|
|
-// CURLOPT_HTTPHEADER => $header,
|
|
|
-// ));
|
|
|
-// $response = curl_exec($curl);
|
|
|
-// if ($response === false) {
|
|
|
-// // 获取错误号
|
|
|
-// $errorNumber = curl_errno($curl);
|
|
|
-// // 获取错误信息
|
|
|
-// $errorMessage = curl_error($curl);
|
|
|
-// $message = "cURL Error #{$errorNumber}: {$errorMessage}";
|
|
|
-// file_put_contents('record_man_lf_error.txt',date('Y-m-d H:i:s'). PHP_EOL . $message .PHP_EOL,8);
|
|
|
-// }
|
|
|
-// curl_close($curl);
|
|
|
-//
|
|
|
-// $res = json_decode($response,true);
|
|
|
-// if(! isset($res['status'])){//报错了
|
|
|
-// file_put_contents('record_man_lf_error.txt',date('Y-m-d H:i:s'). PHP_EOL . $response .PHP_EOL.json_encode($post),8);
|
|
|
-// }
|
|
|
-// }
|
|
|
-
|
|
|
/**
|
|
|
* Execute the job.
|
|
|
*
|