123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460 |
- <?php
- namespace Mshop\Lib;
- use Dever;
- class Feieyun
- {
- private $config = array
- (
-
- 'user' => 'liuxuemei@zsma.com.cn',
-
- 'ukey' => 'pMsXhZWu5F65MYyV',
-
- 'sn' => '',
-
- 'host' => 'http://api.feieyun.cn:80/Api/Open/',
- );
-
- public function param(&$param)
- {
- $time = time();
- $param['user'] = $this->config['user'];
- $param['stime'] = $time;
- $param['sig'] = sha1($this->config['user'] . $this->config['ukey'] . $time);
- }
-
- public function send()
- {
- $url = $this->config['host'];
- $param = $this->param($param);
- return Dever::curl($url, $param, 'post');
- }
-
- public function add()
- {
- $msgInfo = array(
- 'user'=>USER,
- 'stime'=>$time,
- 'sig'=>signature($time),
- 'apiname'=>'Open_printerAddlist',
- 'printerContent'=>$printerContent
- );
- $client = new HttpClient(IP,PORT);
- if(!$client->post(PATH,$msgInfo)){
- echo 'error';
- }else{
- $result = $client->getContent();
- echo $result;
- }
- }
- <?php
- header("Content-type: text/html; charset=utf-8");
- include 'HttpClient.class.php';
- define('USER', 'xxxxxxxxxxxxxxxxx');
- define('UKEY', 'xxxxxxxxxxxxxxxxx');
- define('SN', 'xxxxxxxxxxxxxxxxx');
-
- define('IP','api.feieyun.cn');
- define('PORT',80);
- define('PATH','/Api/Open/');
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- $content = '<CB>测试打印</CB><BR>';
- $content .= '名称 单价 数量 金额<BR>';
- $content .= '--------------------------------<BR>';
- $content .= '饭 10.0 10 100.0<BR>';
- $content .= '炒饭 10.0 10 100.0<BR>';
- $content .= '蛋炒饭 10.0 10 100.0<BR>';
- $content .= '鸡蛋炒饭 10.0 10 100.0<BR>';
- $content .= '西红柿炒饭 10.0 10 100.0<BR>';
- $content .= '西红柿蛋炒饭 10.0 10 100.0<BR>';
- $content .= '西红柿鸡蛋炒饭 10.0 10 100.0<BR>';
- $content .= '--------------------------------<BR>';
- $content .= '备注:加辣<BR>';
- $content .= '合计:xx.0元<BR>';
- $content .= '送货地点:广州市南沙区xx路xx号<BR>';
- $content .= '联系电话:13888888888888<BR>';
- $content .= '订餐时间:2014-08-08 08:08:08<BR>';
- $content .= '<QR>http://www.feieyun.com</QR>';
-
-
-
-
-
-
-
-
-
-
-
- $content = "<DIRECTION>1</DIRECTION>";
- $content .= "<TEXT x='9' y='10' font='12' w='1' h='2' r='0'>#001 五号桌 1/3</TEXT><TEXT x='80' y='80' font='12' w='2' h='2' r='0'>可乐鸡翅</TEXT><TEXT x='9' y='180' font='12' w='1' h='1' r='0'>张三先生 13800138000</TEXT>";
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- function printerAddlist($printerContent){
- $time = time();
- $msgInfo = array(
- 'user'=>USER,
- 'stime'=>$time,
- 'sig'=>signature($time),
- 'apiname'=>'Open_printerAddlist',
- 'printerContent'=>$printerContent
- );
- $client = new HttpClient(IP,PORT);
- if(!$client->post(PATH,$msgInfo)){
- echo 'error';
- }else{
- $result = $client->getContent();
- echo $result;
- }
- }
-
- function printMsg($sn,$content,$times){
- $time = time();
- $msgInfo = array(
- 'user'=>USER,
- 'stime'=>$time,
- 'sig'=>signature($time),
- 'apiname'=>'Open_printMsg',
- 'sn'=>$sn,
- 'content'=>$content,
- 'times'=>$times
- );
- $client = new HttpClient(IP,PORT);
- if(!$client->post(PATH,$msgInfo)){
- echo 'error';
- }else{
-
- $result = $client->getContent();
- echo $result;
- }
- }
-
- function printLabelMsg($sn,$content,$times){
- $time = time();
- $msgInfo = array(
- 'user'=>USER,
- 'stime'=>$time,
- 'sig'=>signature($time),
- 'apiname'=>'Open_printLabelMsg',
- 'sn'=>$sn,
- 'content'=>$content,
- 'times'=>$times
- );
- $client = new HttpClient(IP,PORT);
- if(!$client->post(PATH,$msgInfo)){
- echo 'error';
- }else{
-
- $result = $client->getContent();
- echo $result;
- }
- }
-
- function printerDelList($snlist){
- $time = time();
- $msgInfo = array(
- 'user'=>USER,
- 'stime'=>$time,
- 'sig'=>signature($time),
- 'apiname'=>'Open_printerDelList',
- 'snlist'=>$snlist
- );
- $client = new HttpClient(IP,PORT);
- if(!$client->post(PATH,$msgInfo)){
- echo 'error';
- }else{
- $result = $client->getContent();
- echo $result;
- }
- }
-
- function printerEdit($sn,$name,$phonenum){
- $time = time();
- $msgInfo = array(
- 'user'=>USER,
- 'stime'=>$time,
- 'sig'=>signature($time),
- 'apiname'=>'Open_printerEdit',
- 'sn'=>$sn,
- 'name'=>$name,
- 'phonenum'=>$phonenum
- );
- $client = new HttpClient(IP,PORT);
- if(!$client->post(PATH,$msgInfo)){
- echo 'error';
- }else{
- $result = $client->getContent();
- echo $result;
- }
- }
-
- function delPrinterSqs($sn){
- $time = time();
- $msgInfo = array(
- 'user'=>USER,
- 'stime'=>$time,
- 'sig'=>signature($time),
- 'apiname'=>'Open_delPrinterSqs',
- 'sn'=>$sn
- );
- $client = new HttpClient(IP,PORT);
- if(!$client->post(PATH,$msgInfo)){
- echo 'error';
- }else{
- $result = $client->getContent();
- echo $result;
- }
- }
-
- function queryOrderState($orderid){
- $time = time();
- $msgInfo = array(
- 'user'=>USER,
- 'stime'=>$time,
- 'sig'=>signature($time),
- 'apiname'=>'Open_queryOrderState',
- 'orderid'=>$orderid
- );
- $client = new HttpClient(IP,PORT);
- if(!$client->post(PATH,$msgInfo)){
- echo 'error';
- }else{
- $result = $client->getContent();
- echo $result;
- }
- }
-
- function queryOrderInfoByDate($sn,$date){
- $time = time();
- $msgInfo = array(
- 'user'=>USER,
- 'stime'=>$time,
- 'sig'=>signature($time),
- 'apiname'=>'Open_queryOrderInfoByDate',
- 'sn'=>$sn,
- 'date'=>$date
- );
- $client = new HttpClient(IP,PORT);
- if(!$client->post(PATH,$msgInfo)){
- echo 'error';
- }else{
- $result = $client->getContent();
- echo $result;
- }
- }
-
- function queryPrinterStatus($sn){
- $time = time();
- $msgInfo = array(
- 'user'=>USER,
- 'stime'=>$time,
- 'sig'=>signature($time),
- 'apiname'=>'Open_queryPrinterStatus',
- 'sn'=>$sn
- );
- $client = new HttpClient(IP,PORT);
- if(!$client->post(PATH,$msgInfo)){
- echo 'error';
- }else{
- $result = $client->getContent();
- echo $result;
- }
- }
-
- function signature($time){
- return sha1(USER.UKEY.$time);
- }
- ?>
- }
|