亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

搜索
博主信息
博文 48
粉絲 0
評(píng)論 0
訪問(wèn)量 12598
最新下載
更多>
網(wǎng)站特效
網(wǎng)站源碼
網(wǎng)站素材
前端模板
PHP 打印擴(kuò)展開發(fā):從易聯(lián)云到小鵝通的多驅(qū)動(dòng)集成實(shí)踐
い獨(dú)霸天下う
原創(chuàng)
290人瀏覽過(guò)

目前已有易聯(lián)云WIFI打印機(jī)擴(kuò)展

擴(kuò)展入口文件

文件目錄 crmeb\services\printer\Printer.php

  1. namespace crmeb\services\printer;
  2. use crmeb\basic\BaseManager;
  3. use think\facade\Config;
  4. use think\Container;
  5. /**
  6. * Class Printer
  7. * @package crmeb\services\auth
  8. * @mixin \crmeb\services\printer\storage\YiLianYun
  9. */
  10. class Printer extends BaseManager
  11. {
  12. //...
  13. }

使用打印擴(kuò)展

  1. use crmeb\services\printer\Printer;
  2. $printer = new Printer([
  3. 'clientId'=>'',
  4. 'apiKey'=>'',
  5. 'partner'=>' ',
  6. 'terminal'=>'',
  7. ]);
  8. $res = $printer->setPrinterContent([
  9. 'name'=> '標(biāo)題',
  10. 'orderInfo'=> [],//訂單信息
  11. 'product'=> [],//商品信息
  12. ])->startPrinter();
  13. var_dump($res);

舉例增加:小鵝通打印擴(kuò)展

創(chuàng)建文件:crmeb\services\printer\storage\XiaoETong.php

  1. namespace crmeb\services\printer\storage;
  2. class XiaoETong extends BasePrinter
  3. {
  4. //初始化
  5. protected function initialize(array $config)
  6. {
  7. }
  8. //開始打印
  9. public function startPrinter()
  10. {
  11. }
  12. //設(shè)置打印內(nèi)容
  13. public function setPrinterContent(array $config): self
  14. {
  15. return $this;
  16. }
  17. }

增加小鵝通獲取AccessToken

  1. namespace crmeb\services\printer;
  2. class AccessToken extends HttpService
  3. {
  4. /**
  5. * 獲取token
  6. * @return mixed|null|string
  7. * @throws \Exception
  8. */
  9. public function getAccessToken()
  10. {
  11. if (isset($this->accessToken[$this->name])) {
  12. return $this->accessToken[$this->name];
  13. }
  14. $action = 'get' . Str::studly($this->name) . 'AccessToken';
  15. if (method_exists($this, $action)) {
  16. return $this->{$action}();
  17. } else {
  18. throw new \RuntimeException(__CLASS__ . '->' . $action . '(),Method not worn in');
  19. }
  20. }
  21. //增加小鵝通獲取access_token類
  22. protected function getXiaoETongAccessToken()
  23. {
  24. /** @var CacheServices $cacheServices */
  25. $cacheServices = app()->make(CacheServices::class);
  26. $this->accessToken[$this->name] = $cacheServices->getDbCache('XET_access_token', function () {
  27. //寫獲取$access_token的邏輯
  28. //...
  29. $access_token = '';
  30. return $access_token;
  31. }, 86400);
  32. if (!$this->accessToken[$this->name])
  33. throw new AdminException(400718);
  34. return $this->accessToken[$this->name];
  35. }
  36. }

使用小鵝通打印機(jī)

  1. use crmeb\services\printer\Printer;
  2. $printer = new Printer('xiao_e_tong',[
  3. 'clientId'=>'',//小鵝通打印配置
  4. 'apiKey'=>'',//小鵝通打印配置
  5. 'partner'=>' ',//小鵝通打印配置
  6. 'terminal'=>'',//小鵝通打印配置
  7. ]);
  8. $res = $printer->setPrinterContent([
  9. 'name'=> '標(biāo)題',
  10. 'orderInfo'=> [],//訂單信息
  11. 'product'=> [],//商品信息
  12. ])->startPrinter();
  13. var_dump($res);

附件:https://gitee.com/ZhongBangKeJi/CRMEB

本博文版權(quán)歸博主所有,轉(zhuǎn)載請(qǐng)注明地址!如有侵權(quán)、違法,請(qǐng)聯(lián)系admin@php.cn舉報(bào)處理!
全部評(píng)論 文明上網(wǎng)理性發(fā)言,請(qǐng)遵守新聞評(píng)論服務(wù)協(xié)議
0條評(píng)論
關(guān)于我們 免責(zé)申明 意見反饋 講師合作 廣告合作 最新更新
php中文網(wǎng):公益在線php培訓(xùn),幫助PHP學(xué)習(xí)者快速成長(zhǎng)!
關(guān)注服務(wù)號(hào) 技術(shù)交流群
PHP中文網(wǎng)訂閱號(hào)
每天精選資源文章推送
PHP中文網(wǎng)APP
隨時(shí)隨地碎片化學(xué)習(xí)
PHP中文網(wǎng)抖音號(hào)
發(fā)現(xiàn)有趣的

Copyright 2014-2025 http://ipnx.cn/ All Rights Reserved | php.cn | 湘ICP備2023035733號(hào)

  • 登錄PHP中文網(wǎng),和優(yōu)秀的人一起學(xué)習(xí)!
    全站2000+教程免費(fèi)學(xué)