审查视图

simplewind/vendor/yly-openapi/yly-openapi-sdk/Lib/Api/PrinterService.php 6.3 KB
景龙 authored
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236
<?php

namespace App\Api;

class PrinterService extends RpcService{

    /**
     * 自有型应用授权终端
     *
     * @param $machineCode string 机器码
     * @param $mSign string 机器密钥
     * @param string $printName 打印机昵称
     * @param string $phone gprs卡号
     * @return mixed
     */
    public function addPrinter($machineCode, $mSign,  $printName = '', $phone = '')
    {
        $params = array(
            'machine_code' => $machineCode,
            'msign' => $mSign,
        );
        if (!empty($phone)) {
            $params['phone'] = $phone;
        }
        if (!empty($printName)) {
            $params['print_name'] = $printName;
        }
        return $this->client->call('printer/addprinter', $params);
    }


    /**
     * 设置内置语音接口
     * 注意: 仅支持K4-WA、K4-GAD、K4-WGEAD型号
     *
     * @param $machineCode string 机器码
     * @param $content string 在线语音地址链接 or 自定义语音内容
     * @param bool $isFile true or false
     * @param string $aid int 0~9 , 定义需设置的语音编号,若不提交,默认升序
     * @return mixed
     */
    public function setVoice($machineCode, $content, $isFile = false, $aid = '')
    {
        $params = array(
            'machine_code' => $machineCode,
            'content' => $content,
            'is_file' => $isFile,
        );
        if (!empty($aid)){
            $params ['aid'] = $aid;
        }
        return $this->client->call('printer/setvoice', $params);
    }


    /**
     * 删除内置语音接口
     * 注意: 仅支持K4-WA、K4-GAD、K4-WGEAD型号
     *
     * @param $machineCode string 机器码
     * @param $aid int 0 ~ 9 编号
     * @return mixed
     */
    public function deleteVoice($machineCode, $aid)
    {
        return $this->client->call('printer/deletevoice', array('machine_code' => $machineCode, 'aid' => $aid));
    }


    /**
     * 删除终端授权接口
     *
     * @param $machineCode string 机器码
     * @return mixed
     */
    public function deletePrinter($machineCode)
    {
        return $this->client->call('printer/deleteprinter', array('machine_code' => $machineCode));
    }


    /**
     * 关机重启接口
     *
     * @param $machineCode string 机器码
     * @param $responseType string restart or shutdown
     * @return mixed
     */
    public function shutdownRestart($machineCode, $responseType)
    {
        return $this->client->call('printer/shutdownrestart', array('machine_code' => $machineCode, 'response_type' => $responseType));
    }


    /**
     * 声音调节接口
     *
     * @param $machineCode string 机器码
     * @param $voice string 音量 0 or 1 or 2 or 3
     * @param $responseType string buzzer (蜂鸣器) or horn (喇叭)
     * @return mixed
     */
    public function setsound($machineCode, $voice, $responseType)
    {
        return $this->client->call('printer/setsound', array('machine_code' => $machineCode, 'voice' => $voice, 'response_type' => $responseType));
    }


    /**
     * 获取机型打印宽度接口
     *
     * @param $machineCode string 机器码
     * @return mixed
     */
    public function printInfo($machineCode)
    {
        return $this->client->call('printer/printinfo', array('machine_code' => $machineCode));
    }


    /**
     * 获取机型软硬件版本接口
     *
     * @param $machineCode string 机器码
     * @return mixed
     */
    public function getVersion($machineCode)
    {
        return $this->client->call('printer/getversion', array('machine_code' => $machineCode));
    }


    /**
     * 取消所有未打印订单接口
     *
     * @param $machineCode string 机器码
     * @return mixed
     */
    public function cancelAll($machineCode)
    {
        return $this->client->call('printer/cancelall', array('machine_code' => $machineCode));
    }


    /**
     * 取消单条未打印订单接口
     *
     * @param $machineCode string 机器码
     * @param $orderId string 未打印的易联云ID
     * @return mixed
     */
    public function cancelOne($machineCode, $orderId)
    {
        return $this->client->call('printer/cancelone', array('machine_code' => $machineCode, 'order_id' => $orderId));
    }


    /**
     * 设置logo接口
     *
     * @param $machineCode string 机器码
     * @param $imgUrl string logo链接地址
     * @return mixed
     */
    public function setIcon($machineCode, $imgUrl)
    {
        return $this->client->call('printer/seticon', array('machine_code' => $machineCode, 'img_url' => $imgUrl));
    }


    /**
     * 取消logo接口
     *
     * @param $machineCode string 机器码
     * @return mixed
     */
    public function deleteIcon($machineCode)
    {
        return $this->client->call('printer/deleteicon', array('machine_code' => $machineCode));
    }


    /**
     * 打印方式接口
     *
     * @param $machineCode string 机器码
     * @param $responseType string btnopen or btnclose
     * @return mixed
     */
    public function btnPrint($machineCode, $responseType)
    {
        return $this->client->call('printer/btnprint', array('machine_code' => $machineCode, 'response_type' => $responseType));
    }


    /**
     * 接单拒单设置接口
     *
     * @param $machineCode string 机器码
     * @param $responseType string open or close
     * @return mixed
     */
    public function getOrder($machineCode, $responseType)
    {
        return $this->client->call('printer/getorder', array('machine_code' => $machineCode, 'response_type' => $responseType));
    }


    /**
     * 获取订单状态接口
     *
     * @param $machineCode string 机器码
     * @param $orderId  string 易联云订单id
     * @return mixed
     */
    public function getOrderStatus($machineCode, $orderId)
    {
        return $this->client->call('printer/getorderstatus', array('machine_code' => $machineCode, 'order_id' => $orderId));
    }


    /**
     * 获取订单列表接口
     *
     * @param $machineCode string 机器码
     * @param $pageIndex int 第几页
     * @param $pageSize int 查询条数
     * @return mixed
     */
    public function getOrderPagingList($machineCode, $pageIndex = 1 , $pageSize = 10)
    {
        return $this->client->call('printer/getorderpaginglist', array('machine_code' => $machineCode, 'page_index' => $pageIndex, 'page_size' => $pageSize));
    }


}