From 319b09ac4ecf4c399861c1d60832aa42db42aa63 Mon Sep 17 00:00:00 2001 From: lanzu_qsy <334039090@qq.com> Date: Thu, 3 Sep 2020 10:18:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=93=E5=8D=B0,=E9=9C=80=E8=B0=83=E7=94=A8h?= =?UTF-8?q?yperf=E6=89=93=E5=8D=B0api?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Admin/Extensions/OrderPrint.php | 39 +++++++++++++++++++++++++++++ app/Models/Feprint.php | 14 +++++++++++ 2 files changed, 53 insertions(+) create mode 100644 app/Models/Feprint.php diff --git a/app/Admin/Extensions/OrderPrint.php b/app/Admin/Extensions/OrderPrint.php index d813fd1..2af1e85 100644 --- a/app/Admin/Extensions/OrderPrint.php +++ b/app/Admin/Extensions/OrderPrint.php @@ -4,6 +4,8 @@ namespace App\Admin\Extensions; +use App\Models\Feprint; +use App\Models\ImsCjdcOrderMain; use Dcat\Admin\Grid\RowAction; use Illuminate\Http\Request; @@ -19,6 +21,7 @@ class OrderPrint extends RowAction public function handle(Request $request) { $id = $this->getKey(); + $this->doPrint(); dd($id); } @@ -31,4 +34,40 @@ class OrderPrint extends RowAction { } + + public function doPrint() + { + $oid = $this->getKey(); + $row = ImsCjdcOrderMain::find($oid); + + //>>1.获取打印机状态 + $result = $this->getPrintStatus($row->market_id); + //>>2.调用打印 + if ($result==1){ + $this->feiErPrint($row->order_num); + } + //>>3.记录打印次数 + } + + /** + * @param $oid //主订单ID + * @return int + */ + public function getPrintStatus($mid) + { + $fe = Feprint::where('market_id',$mid)->first(); + if ($fe){ + return $fe->status; + }else{ + return -1; + } + } + + public function feiErPrint($order_num) + { + + include_once app_path('Libs\feier_print\api_php_demo.php'); + $result = json_decode(FeiePrint($order_num)); + dd($result); + } } diff --git a/app/Models/Feprint.php b/app/Models/Feprint.php new file mode 100644 index 0000000..56dd942 --- /dev/null +++ b/app/Models/Feprint.php @@ -0,0 +1,14 @@ +