shish 4 жил өмнө
parent
commit
d0a230b821

+ 7 - 1
biz-hd/work/classes/WorkClass.php

@@ -36,7 +36,13 @@ class WorkClass extends BaseClass
             }
             OrderClass::onlinePrint($order);
         } else {
-            self::printWork($work, $shop);
+
+            $p = new printUtil('570200946');
+            $p->times = 10;
+            $content = '<BC128 x="60" y="100" h="80" s="1" r="0" n="2" w="2">1005</BC128>';
+            $p->printMsg($content);
+
+            //self::printWork($work, $shop);
         }
     }
 

+ 22 - 0
common/components/printUtil.php

@@ -24,6 +24,28 @@ class printUtil
         $this->sn = $sn;
     }
 
+    public function printLabelMsg($content)
+    {
+        $time = time();         //请求时间
+        $msgInfo = array(
+            'user' => $this->user,
+            'stime' => $time,
+            'sig' => $this->signature($time),
+            'apiname' => 'Open_printLabelMsg',
+            'sn' => $this->sn,
+            'content' => $content,
+            'times' => $this->times//打印次数
+        );
+        $client = new \HttpClient(self::IP, self::PORT);
+        if (!$client->post(self::PATH, $msgInfo)) {
+            //echo 'error';
+        } else {
+            //服务器返回的JSON字符串,建议要当做日志记录起来
+            $result = $client->getContent();
+            //echo $result;
+        }
+    }
+
     public function printMsg($content)
     {
         $time = time();         //请求时间