From de9af0c7f9f670251e0d4a196d8acd2d029bb7c9 Mon Sep 17 00:00:00 2001 From: lanzu_qsy <334039090@qq.com> Date: Mon, 7 Sep 2020 21:03:07 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0RPC=20=E6=89=93=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/JsonRpc/FeieService.php | 29 +++++++++++++++++++ app/JsonRpc/PrintServiceInterface.php | 10 +++++++ .../v3/Implementations/FeiePrintService.php | 13 ++++----- config/autoload/dependencies.php | 1 + config/autoload/feie.php | 2 +- 5 files changed, 46 insertions(+), 9 deletions(-) create mode 100644 app/JsonRpc/FeieService.php create mode 100644 app/JsonRpc/PrintServiceInterface.php diff --git a/app/JsonRpc/FeieService.php b/app/JsonRpc/FeieService.php new file mode 100644 index 0000000..9ac61ef --- /dev/null +++ b/app/JsonRpc/FeieService.php @@ -0,0 +1,29 @@ +feieprintService->feiePrint($oid); + + } +} \ No newline at end of file diff --git a/app/JsonRpc/PrintServiceInterface.php b/app/JsonRpc/PrintServiceInterface.php new file mode 100644 index 0000000..1da3ceb --- /dev/null +++ b/app/JsonRpc/PrintServiceInterface.php @@ -0,0 +1,10 @@ +orderBy('s.id') ->get() ->toArray(); + if (empty($data)) { return ; } @@ -59,6 +60,7 @@ class FeiePrintService implements FeiePrintServiceInterface } $content = $this->printFormat($data, 14, 6, 3, 6); + $res = $this->printMsg($data[0]['sn'], $content, 1); return ($res); } @@ -82,7 +84,6 @@ class FeiePrintService implements FeiePrintServiceInterface 'content' => $content, 'times' => $times//打印次数 ); - $client = new FeiePrintClient($this->feieHost, $this->feiePort); if (!$client->post($this->feieApiPath, $msgInfo)) { echo 'error'; @@ -110,14 +111,10 @@ class FeiePrintService implements FeiePrintServiceInterface $shopname = $v5['shopname']; } $name = $v5['name']; - if(!empty($v5['spec'])) { - $name .= "(规格:". $v5['spec'].")"; - }elseif (!empty($v5['good_unit'])){ - $name .= "(规格:". $v5['good_unit'].")"; - } - $price = $v5['money']; + $name .= "(规格:". $v5['goods_unit'].")"; + $price = $v5['m_money']; $num = $v5['number']; - $prices = sprintf("%.2f",$v5['money']*$v5['number']); + $prices = sprintf("%.2f",$v5['m_money']*$v5['number']); $kw3 = ''; $kw1 = ''; $kw2 = ''; diff --git a/config/autoload/dependencies.php b/config/autoload/dependencies.php index d3ec392..337037d 100644 --- a/config/autoload/dependencies.php +++ b/config/autoload/dependencies.php @@ -78,4 +78,5 @@ return [ \App\Service\v3\Interfaces\UserServiceInterface::class => \App\Service\v3\Implementations\UserService::class, \App\Service\v3\Interfaces\CouponRebateServiceInterface::class => \App\Service\v3\Implementations\CouponRebateService::class, \App\Service\v3\Interfaces\SmsServiceInterface::class => \App\Service\v3\Implementations\SmsAliService::class, + \App\JsonRpc\PrintServiceInterface::class => \App\JsonRpc\FeieService::class, ]; diff --git a/config/autoload/feie.php b/config/autoload/feie.php index 44c39b9..4b98666 100644 --- a/config/autoload/feie.php +++ b/config/autoload/feie.php @@ -5,7 +5,7 @@ declare(strict_types=1); return [ 'user' => env('FEIE_USER', ''), 'ukey' => env('FEIE_UKEY', ''), - 'host' => env('FEIE_API_PATH', ''), + 'host' => env('FEIE_HOST', ''), 'port' => env('FEIE_PORT', ''), 'api_path' => env('FEIE_API_PATH', ''), ]; \ No newline at end of file