|
@@ -98,7 +98,7 @@ class JRFIDServerService extends Service
|
|
'body' => $encryptedData,
|
|
'body' => $encryptedData,
|
|
];
|
|
];
|
|
|
|
|
|
- list($status,$result) = $this->post_helper($url,json_encode($post),['Content-Type:application/json'],62);
|
|
|
|
|
|
+ list($status,$result) = $this->post_helper($url,json_encode($post),['Content-Type:application/json']);
|
|
if(! $status) return [false, $result];
|
|
if(! $status) return [false, $result];
|
|
|
|
|
|
if(! empty($result['status']) && $result['status'] == 'error') return [false, $result['message']];
|
|
if(! empty($result['status']) && $result['status'] == 'error') return [false, $result['message']];
|
|
@@ -211,6 +211,33 @@ class JRFIDServerService extends Service
|
|
return [true, $result];
|
|
return [true, $result];
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public function screenPrint($data){
|
|
|
|
+ if(empty($data['id'])) return [false, '数据ID不能为空'];
|
|
|
|
+ if(empty($data['type'])) return [false, 'TYPE不能为空'];
|
|
|
|
+ if(empty($data['print_type'])) return [false, 'PRINTTYPE不能为空'];
|
|
|
|
+
|
|
|
|
+ $rsaService = new RsaEncryptionService();
|
|
|
|
+ $dataToEncrypt = [
|
|
|
|
+ 'id' => $data['id'],
|
|
|
|
+ 'type' => $data['type'],
|
|
|
|
+ 'print_type' => $data['print_type']
|
|
|
|
+ ];
|
|
|
|
+ $encryptedData = $rsaService->encrypt(json_encode($dataToEncrypt));
|
|
|
|
+
|
|
|
|
+ $url = config("j_rfid.screen_print");
|
|
|
|
+ $post = [
|
|
|
|
+ 'body' => $encryptedData,
|
|
|
|
+ ];
|
|
|
|
+
|
|
|
|
+ list($status,$result) = $this->post_helper($url,json_encode($post),['Content-Type:application/json']);
|
|
|
|
+ if(! $status) return [false, $result];
|
|
|
|
+
|
|
|
|
+ if(! empty($result['status']) && $result['status'] == 'error') return [false, $result['message']];
|
|
|
|
+ if(! empty($result['type']) && $result['type'] == 'errorVm') return [false, $result['message']];
|
|
|
|
+
|
|
|
|
+ return [true, $result];
|
|
|
|
+ }
|
|
|
|
+
|
|
public function post_helper($url, $data, $header = [], $timeout = 20){
|
|
public function post_helper($url, $data, $header = [], $timeout = 20){
|
|
file_put_contents('jrfid_record.txt',date('Y-m-d H:i:s') . PHP_EOL. "请求API:" . $url . PHP_EOL . "请求参数:" . $data . PHP_EOL . "请求头部:" . json_encode($header) . PHP_EOL,8);
|
|
file_put_contents('jrfid_record.txt',date('Y-m-d H:i:s') . PHP_EOL. "请求API:" . $url . PHP_EOL . "请求参数:" . $data . PHP_EOL . "请求头部:" . json_encode($header) . PHP_EOL,8);
|
|
$ch = curl_init();
|
|
$ch = curl_init();
|