Documentation
¶
Index ¶
- func APIInterface(config *Config, strAction string, params map[string]interface{}) (interface{}, error)
- func GetUUID4() string
- func RequestUrl() string
- type APIError
- type ApiClient
- type Config
- func (conf *Config) GetHost() string
- func (conf *Config) GetSign(timestamp string) string
- func (conf *Config) SetClientId(cid string)
- func (conf *Config) SetClientSecret(secret string)
- func (conf *Config) SetLogger(logger YlySdkLogger)
- func (conf *Config) SetRequestUrl(reqUrl string)
- func (conf *Config) SetToken(token Token)
- type OAuthClient
- func (oauth *OAuthClient) GetAccessToken() Token
- func (oauth *OAuthClient) GetAccessTokenByAuthCode(code string) Token
- func (oauth *OAuthClient) GetAccessTokenByRefreshToken(refreshToken string) Token
- func (oauth *OAuthClient) GetAccessTokenBySecret(machineCode string, secret string, secretType int) Token
- func (oauth *OAuthClient) GetAuthUrl(redirectUri string, state string) string
- func (oauth *OAuthClient) GetUUID4() string
- func (oauth *OAuthClient) SetConfig(conf Config)
- type PrintService
- func (PrintService *PrintService) ExpressOrderCancel(machineCode string, content string) (interface{}, error)
- func (PrintService *PrintService) ExpressOrderPrint(machineCode string, content string, originId string, sandbox int) (interface{}, error)
- func (PrintService *PrintService) PicturePrint(machineCode string, pictureUrl string, originId string, idempotence int) (interface{}, error)
- func (PrintService *PrintService) TextPrint(machineCode string, content string, originId string, idempotence int) (interface{}, error)
- type SetPrinter
- func (SetPrinter *SetPrinter) AddPrinter(machineCode string, mSign string, printName string) (interface{}, error)
- func (SetPrinter *SetPrinter) CancelAPrintOrder(machineCode string, orderId string) (interface{}, error)
- func (SetPrinter *SetPrinter) CancelAllPrintOrders(machineCode string) (interface{}, error)
- func (SetPrinter *SetPrinter) DelIcon(machineCode string) (interface{}, error)
- func (SetPrinter *SetPrinter) DelPrinter(machineCode string) (interface{}, error)
- func (SetPrinter *SetPrinter) DelVoice(machineCode string, aId int) (interface{}, error)
- func (SetPrinter *SetPrinter) GetOrderList(machineCode string, pageIndex int, pageSize int) (interface{}, error)
- func (SetPrinter *SetPrinter) GetOrderStatus(machineCode string, orderId string) (interface{}, error)
- func (SetPrinter *SetPrinter) GetPrintStatus(machineCode string) (interface{}, error)
- func (SetPrinter *SetPrinter) GetPrinterInfo(machineCode string) (interface{}, error)
- func (SetPrinter *SetPrinter) GetPrinterVersion(machineCode string) (interface{}, error)
- func (SetPrinter *SetPrinter) PushSwitch(machineCode string, status string, mode int) (interface{}, error)
- func (SetPrinter *SetPrinter) Reprint(machineCode string, orderId string) (interface{}, error)
- func (SetPrinter *SetPrinter) SetIcon(machineCode string, imgUrl string) (interface{}, error)
- func (SetPrinter *SetPrinter) SetKeywords(machineCode string, keys string, keyType string, content string) (interface{}, error)
- func (SetPrinter *SetPrinter) SetOrderConfirmation(machineCode string, responseType string) (interface{}, error)
- func (SetPrinter *SetPrinter) SetPrintMode(machineCode string, responseType string) (interface{}, error)
- func (SetPrinter *SetPrinter) SetPrinterMenu(machineCode string, content string) (interface{}, error)
- func (SetPrinter *SetPrinter) SetPushUrlByAuth(machineCode string, cmd string, url string, status string) (interface{}, error)
- func (SetPrinter *SetPrinter) SetPushUrlByClient(cmd string, url string, status string) (interface{}, error)
- func (SetPrinter *SetPrinter) SetSound(machineCode string, responseType string, voice string) (interface{}, error)
- func (SetPrinter *SetPrinter) SetVoice(machineCode string, content string, isFile string, aId int) (interface{}, error)
- func (SetPrinter *SetPrinter) Setting(machineCode string, usbPrintMode int, usbInputMode int, cameraDecodeTxMode int) (interface{}, error)
- func (SetPrinter *SetPrinter) ShutdownOrRestart(machineCode string, responseType string) (interface{}, error)
- type SimpleLogger
- type Token
- type TokenBody
- type YlySdkLogger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func APIInterface ¶
func RequestUrl ¶
func RequestUrl() string
Types ¶
type ApiClient ¶
type ApiClient struct { PrintService PrintService SetPrinter SetPrinter // contains filtered or unexported fields }
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
func (*Config) SetClientId ¶
func (*Config) SetClientSecret ¶
func (*Config) SetLogger ¶
func (conf *Config) SetLogger(logger YlySdkLogger)
func (*Config) SetRequestUrl ¶
type OAuthClient ¶
type OAuthClient struct {
// contains filtered or unexported fields
}
func NewAuthClient ¶
func NewAuthClient(conf Config) OAuthClient
func (*OAuthClient) GetAccessTokenByAuthCode ¶
func (oauth *OAuthClient) GetAccessTokenByAuthCode(code string) Token
开放型应用获取调用凭API code 授权码
func (*OAuthClient) GetAccessTokenByRefreshToken ¶
func (oauth *OAuthClient) GetAccessTokenByRefreshToken(refreshToken string) Token
自有应用&开放型应用刷新调用凭证API 需刷新令牌refresh_token
func (*OAuthClient) GetAccessTokenBySecret ¶
func (oauth *OAuthClient) GetAccessTokenBySecret(machineCode string, secret string, secretType int) Token
极速授权获取调用凭证API 注意:仅支持开放型应用 machineCode 终端号 secret 密钥(可能是msign或qr_key)
func (*OAuthClient) GetAuthUrl ¶
func (oauth *OAuthClient) GetAuthUrl(redirectUri string, state string) string
获取授权url API redirectUri 回调地址 state 用于保持请求和回调的状态,在回调时,会回传该参数。开发者可以用这个参数验证请求有效性,也可以记录用户请求授权页前的位置。可防止CSRF攻击
func (*OAuthClient) SetConfig ¶
func (oauth *OAuthClient) SetConfig(conf Config)
type PrintService ¶
type PrintService struct {
// contains filtered or unexported fields
}
func (*PrintService) ExpressOrderCancel ¶
func (PrintService *PrintService) ExpressOrderCancel(machineCode string, content string) (interface{}, error)
面单取消。参数(终端号machineCode,面单数据详情请看文档content
func (*PrintService) ExpressOrderPrint ¶
func (PrintService *PrintService) ExpressOrderPrint(machineCode string, content string, originId string, sandbox int) (interface{}, error)
面单生成并打印。参数(终端号machineCode,面单数据详情请看文档content,商户订单号originId,sandbox沙箱环境:1 正式环境:0)
func (*PrintService) PicturePrint ¶
func (PrintService *PrintService) PicturePrint(machineCode string, pictureUrl string, originId string, idempotence int) (interface{}, error)
图片打印。参数(终端号machineCode,图片链接pictureUrl,商户订单号originId)
type SetPrinter ¶
type SetPrinter struct {
// contains filtered or unexported fields
}
func (*SetPrinter) AddPrinter ¶
func (SetPrinter *SetPrinter) AddPrinter(machineCode string, mSign string, printName string) (interface{}, error)
绑定打印机API machineCode 终端号 mSign 终端密钥 printName 打印机别名
func (*SetPrinter) CancelAPrintOrder ¶
func (SetPrinter *SetPrinter) CancelAPrintOrder(machineCode string, orderId string) (interface{}, error)
取消单条未打印订单API machineCode 终端号 orderId 易联云打印id
func (*SetPrinter) CancelAllPrintOrders ¶
func (SetPrinter *SetPrinter) CancelAllPrintOrders(machineCode string) (interface{}, error)
取消所有未打印订单API machineCode 终端号
func (*SetPrinter) DelIcon ¶
func (SetPrinter *SetPrinter) DelIcon(machineCode string) (interface{}, error)
取消LOGO API machineCode 终端号
func (*SetPrinter) DelPrinter ¶
func (SetPrinter *SetPrinter) DelPrinter(machineCode string) (interface{}, error)
删除已授权的打印机API machineCode 终端号
func (*SetPrinter) DelVoice ¶
func (SetPrinter *SetPrinter) DelVoice(machineCode string, aId int) (interface{}, error)
删除内置语音API machineCode 终端号 aid 内置语音编号0~9
func (*SetPrinter) GetOrderList ¶
func (SetPrinter *SetPrinter) GetOrderList(machineCode string, pageIndex int, pageSize int) (interface{}, error)
获取订单列表API machineCode 终端号 pageIndex 查询条件—当前页码,暂只提供前100页数据 pageSize 查询条件—每页显示条数,每页最大条数100
func (*SetPrinter) GetOrderStatus ¶
func (SetPrinter *SetPrinter) GetOrderStatus(machineCode string, orderId string) (interface{}, error)
获取订单状态API machineCode 终端号 orderId 易联云打印id
func (*SetPrinter) GetPrintStatus ¶
func (SetPrinter *SetPrinter) GetPrintStatus(machineCode string) (interface{}, error)
获取终端状态API machineCode 终端号
func (*SetPrinter) GetPrinterInfo ¶
func (SetPrinter *SetPrinter) GetPrinterInfo(machineCode string) (interface{}, error)
获取机型打印宽度API machineCode 终端号
func (*SetPrinter) GetPrinterVersion ¶
func (SetPrinter *SetPrinter) GetPrinterVersion(machineCode string) (interface{}, error)
获取机型软硬件版本API machineCode 终端号
func (*SetPrinter) PushSwitch ¶
func (SetPrinter *SetPrinter) PushSwitch(machineCode string, status string, mode int) (interface{}, error)
K8推送开关设置API machineCode 终端号 status 开启"open",关闭"close" mode 扫码数据推送模式 1=标准模式(全推送给开发者,不支持易联云出餐、核销、收银服务);2=支付模式(付款、退款、带YLY标识内容推送给开发者,支持易联云出餐、核销服务);3=标识模式(仅带YLY标识内容推送给开发者,支持易联云出餐、核销、收银服务);默认标准模式
func (*SetPrinter) Reprint ¶
func (SetPrinter *SetPrinter) Reprint(machineCode string, orderId string) (interface{}, error)
订单重打(单订单)API machineCode 终端号 orderId 易联云打印id
func (*SetPrinter) SetIcon ¶
func (SetPrinter *SetPrinter) SetIcon(machineCode string, imgUrl string) (interface{}, error)
设置LOGO API machineCode 终端号 imgUrl logo图标地址,图片宽度最大为350px,文件大小不能超过40Kb
func (*SetPrinter) SetKeywords ¶
func (SetPrinter *SetPrinter) SetKeywords(machineCode string, keys string, keyType string, content string) (interface{}, error)
K8关键词设置API machineCode 终端号 keys 关键词-key type 黑白名单类型 content 关键词-value 数据类型 json数组
func (*SetPrinter) SetOrderConfirmation ¶
func (SetPrinter *SetPrinter) SetOrderConfirmation(machineCode string, responseType string) (interface{}, error)
设置订单确认API machineCode 终端号 responseType 开启"open",关闭"close"
func (*SetPrinter) SetPrintMode ¶
func (SetPrinter *SetPrinter) SetPrintMode(machineCode string, responseType string) (interface{}, error)
设置打印方式API machineCode 终端号 responseType 开启"btnopen",关闭"btnclose"
func (*SetPrinter) SetPrinterMenu ¶
func (SetPrinter *SetPrinter) SetPrinterMenu(machineCode string, content string) (interface{}, error)
设置应用菜单API machineCode 终端号 content json字符串["菜单名","菜单url"]
func (*SetPrinter) SetPushUrlByAuth ¶
func (SetPrinter *SetPrinter) SetPushUrlByAuth(machineCode string, cmd string, url string, status string) (interface{}, error)
设置推送url API (开放型) machineCode 终端号 cmd 打印完成标识"oauth_finish",接单拒单标识"oauth_getOrder",终端状态标识"oauth_printStatus", 按键请求标识"oauth_request" url 推送地址填写必须以http://或https://开头的地址。推送地址需要支持GET访问,当GET请求访问时,请直接返回{"data":"OK"},用于推送地址的可用性测试 status 开启"open",关闭"close"
func (*SetPrinter) SetPushUrlByClient ¶
func (SetPrinter *SetPrinter) SetPushUrlByClient(cmd string, url string, status string) (interface{}, error)
设置推送url API (自有型) cmd 打印完成标识"oauth_finish",接单拒单标识"oauth_getOrder",终端状态标识"oauth_printStatus", 按键请求标识"oauth_request" url 推送地址填写必须以http://或https://开头的地址。推送地址需要支持GET访问,当GET请求访问时,请直接返回{"data":"OK"},用于推送地址的可用性测试 status 开启"open",关闭"close"
func (*SetPrinter) SetSound ¶
func (SetPrinter *SetPrinter) SetSound(machineCode string, responseType string, voice string) (interface{}, error)
声音调节API machineCode 终端号 responseType 蜂鸣器"buzzer",喇叭"horn" voice 音量大小0~4
func (*SetPrinter) SetVoice ¶
func (SetPrinter *SetPrinter) SetVoice(machineCode string, content string, isFile string, aId int) (interface{}, error)
设置内置语音API machineCode 终端号 content (播报内容,音量(1~9),声音类型(0,1,3,4)组成json字符串) 或者 (在线语音链接,语音内容请小于24kb) isFile "true" or "false" , 判断content是否为在线语音链接,格式MP3 aid 定义需设置的语音编号0~9
func (*SetPrinter) Setting ¶
func (SetPrinter *SetPrinter) Setting(machineCode string, usbPrintMode int, usbInputMode int, cameraDecodeTxMode int) (interface{}, error)
K8高级设置API machineCode 终端号 usbPrintMode USB打印设置 直接打印:0 扫码支付后打印:1 usbInputMode USB输入方式设置 键盘输入:0 刷脸或扫码设备输入:1 cameraDecodeTxMode 扫码输出设置 输出到服务器:0 输出到收银机:1
func (*SetPrinter) ShutdownOrRestart ¶
func (SetPrinter *SetPrinter) ShutdownOrRestart(machineCode string, responseType string) (interface{}, error)
关机重启API machineCode 终端号 responseType 重启"restart",关闭"shutdown" 仅支持k4机型,子版本中带字母A的机器
type SimpleLogger ¶
type SimpleLogger struct { }
func (*SimpleLogger) Error ¶
func (logger *SimpleLogger) Error(message string)
func (*SimpleLogger) Info ¶
func (logger *SimpleLogger) Info(message string)