|
|
|
@ -2,15 +2,24 @@ |
|
|
|
|
|
|
|
namespace App\Service\v3\Implementations; |
|
|
|
|
|
|
|
use App\Commons\Log; |
|
|
|
use App\Constants\v3\Shipping; |
|
|
|
use App\Libs\FeiePrintClient; |
|
|
|
use App\Model\v3\Feprint; |
|
|
|
use App\Model\v3\OrderMain; |
|
|
|
use App\Service\v3\Interfaces\FeiePrintServiceInterface; |
|
|
|
use Hyperf\DbConnection\Db; |
|
|
|
use Hyperf\Di\Annotation\Inject; |
|
|
|
|
|
|
|
class FeiePrintService implements FeiePrintServiceInterface |
|
|
|
{ |
|
|
|
|
|
|
|
/** |
|
|
|
* @Inject |
|
|
|
* @var Log |
|
|
|
*/ |
|
|
|
protected $log; |
|
|
|
|
|
|
|
// *必填*:飞鹅云后台注册账号
|
|
|
|
const USER = '13161443713@163.com'; |
|
|
|
// *必填*: 飞鹅云后台注册账号后生成的UKEY 【备注:这不是填打印机的KEY】
|
|
|
|
@ -48,6 +57,7 @@ class FeiePrintService implements FeiePrintServiceInterface |
|
|
|
$query->with('store','orderGoods'); |
|
|
|
} |
|
|
|
])->where('global_order_id',$globalOrderId)->first(); |
|
|
|
$this->log->event('feieprint_rpc', ['order_data' => json_encode($data)]); |
|
|
|
if (empty($data)) { |
|
|
|
return ; |
|
|
|
} |
|
|
|
@ -55,6 +65,7 @@ class FeiePrintService implements FeiePrintServiceInterface |
|
|
|
// $item = (array)$item;
|
|
|
|
// }
|
|
|
|
$printSn = Feprint::query()->where('market_id',$data->market_id)->value('sn'); |
|
|
|
$this->log->event('feieprint_rpc', ['printSn' => json_encode($printSn)]); |
|
|
|
if (env('APP_ENV') === 'dev') { |
|
|
|
$client = new FeiePrintClient($this->feieHost, $this->feiePort); |
|
|
|
$msgInfo = array( |
|
|
|
@ -76,7 +87,9 @@ class FeiePrintService implements FeiePrintServiceInterface |
|
|
|
} |
|
|
|
} |
|
|
|
$content = $this->printFormat($data, 4, 14, 7, 7); |
|
|
|
$this->log->event('feieprint_rpc', ['content' => json_encode($content)]); |
|
|
|
$res = $this->printMsg($printSn, $content, 1); |
|
|
|
$this->log->event('feieprint_rpc', ['res' => json_encode($res)]); |
|
|
|
return $res; |
|
|
|
} |
|
|
|
|
|
|
|
|