添加网站文件

This commit is contained in:
2025-12-22 13:59:40 +08:00
commit 117aaf83d1
19468 changed files with 2111999 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
<?php
namespace App\Api;
class ExpressPrintService extends RpcService{
/**
* 面单打印接口
* 不支持机型: k4-wh, k4-wa, m1 (k4系列机型不建议使用不干胶热敏纸)
*
* @param $machineCode string 机器码
* @param $content array 面单数据
* @param $originId string 商户系统内部订单号要求32个字符内只能是数字、大小写字母
* @return mixed
*/
public function index($machineCode, $content, $originId)
{
return $this->client->call('expressprint/index', array('machine_code' => $machineCode, 'content' => $content, 'origin_id' => $originId));
}
}

View File

@@ -0,0 +1,22 @@
<?php
namespace App\Api;
class OauthService extends RpcService{
/**
* 设置推送URL接口
*
* @param $cmd string 推送队列键
* @param $url string 推送地址
* @param $status string 推送开关
* @return mixed
*/
public function setPushUrl($cmd, $url, $status = 'open')
{
return $this->client->call('oauth/setpushurl', array('cmd' => $cmd, 'url' => $url, 'status' => $status));
}
}

View File

@@ -0,0 +1,21 @@
<?php
namespace App\Api;
class PicturePrintService extends RpcService{
/**
* 图形打印接口
* 不支持机型: k4-wh, k4-wa, m1
*
* @param $machineCode string 机器码
* @param $pictureUrl string 图片链接地址
* @param $originId string 商户系统内部订单号要求32个字符内只能是数字、大小写字母
* @return mixed
*/
public function index($machineCode, $pictureUrl, $originId)
{
return $this->client->call('pictureprint/index', array('machine_code' => $machineCode, 'picture_url' => $pictureUrl, 'origin_id' => $originId));
}
}

View File

@@ -0,0 +1,19 @@
<?php
namespace App\Api;
class PrintMenuService extends RpcService{
/**
* 添加应用菜单接口
*
* @param $machineCode string 机器码
* @param $content string 菜单详情(json)
* @return mixed
*/
public function addPrintMenu($machineCode, $content)
{
return $this->client->call('printmenu/addprintmenu', array('machine_code' => $machineCode, 'content' => $content));
}
}

View File

@@ -0,0 +1,19 @@
<?php
namespace App\Api;
class PrintService extends RpcService{
/**
* 打印接口
*
* @param $machineCode string 机器码
* @param $content string 打印内容
* @param $originId string 商户系统内部订单号要求32个字符内只能是数字、大小写字母
* @return mixed
*/
public function index($machineCode, $content, $originId)
{
return $this->client->call('print/index', array('machine_code' => $machineCode, 'content' => $content, 'origin_id' => $originId));
}
}

View File

@@ -0,0 +1,247 @@
<?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));
}
/**
* 获取终端状态接口
*
* @param $machineCode string 机器码
* @return mixed
*/
public function getPrintStatus($machineCode)
{
return $this->client->call('printer/getprintstatus', array('machine_code' => $machineCode));
}
}

View File

@@ -0,0 +1,17 @@
<?php
namespace App\Api;
use App\Config\YlyConfig;
use App\Protocol\YlyRpcClient;
class RpcService{
protected $client;
public function __construct($token, YlyConfig $config)
{
$this->client = new YlyRpcClient($token, $config);
}
}