|
|
@@ -69,10 +69,35 @@ class printUtil
|
|
|
$client = new \HttpClient(self::IP, self::PORT);
|
|
|
if (!$client->post(self::PATH, $msgInfo)) {
|
|
|
return false;
|
|
|
- } else {
|
|
|
- $client->getContent();
|
|
|
+ }
|
|
|
+ $content = $client->getContent();
|
|
|
+ $respond = json_decode($content, true);
|
|
|
+ if (isset($respond['data']['ok']) && !empty($respond['data']['ok'])) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ $no = $respond['data']['no'][0] ?? '';
|
|
|
+ if (strstr($no, "已被添加过")) {
|
|
|
return true;
|
|
|
}
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ //查询打印机状态 shish 20210714
|
|
|
+ public function queryPrinterStatus($sn)
|
|
|
+ {
|
|
|
+ $time = time(); //请求时间
|
|
|
+ $msgInfo = array(
|
|
|
+ 'user' => $this->user,
|
|
|
+ 'stime' => $time,
|
|
|
+ 'sig' => $this->signature($time),
|
|
|
+ 'apiname' => 'Open_queryPrinterStatus',
|
|
|
+ 'sn' => $sn
|
|
|
+ );
|
|
|
+ $client = new \HttpClient(self::IP, self::PORT);
|
|
|
+ if (!$client->post(self::PATH, $msgInfo)) {
|
|
|
+ echo 'error';
|
|
|
+ }
|
|
|
+ $client->getContent();
|
|
|
}
|
|
|
|
|
|
}
|