京东打印

This commit is contained in:
杨建炊 2024-12-30 14:09:39 +08:00
parent a054dab135
commit 2f71543507
2 changed files with 49 additions and 3 deletions

View File

@ -18,6 +18,9 @@ class WayBillService
public $adminUser;
// 标准模板
public $templateUrl = 'https://template-content.jd.com/template-oss?tempCode=jdkd76x130';
// 标准模板
public $customerTempUrl = "https://template-content.jd.com/template-open?templateCode=customerInfo";
// 时效类型
public $timedDeliveryCode;
@ -55,6 +58,8 @@ class WayBillService
if (!empty($resp[0]['perPrintData'])) {
$waybill->status = Waybill::$STATUS_CREATE_WAYBILL_ENCRYPTED_DATA;
$waybill->templateUrl = $this->templateUrl;
$waybill->customer_temp_url = $this->customerTempUrl;
$waybill->customer_temp_data = json_encode(['productInfo' => $item['productInfo']], 256);
$waybill->encryptedData = $resp[0]['perPrintData'];
$waybill->save();
}
@ -251,8 +256,7 @@ class WayBillService
];
$note .= $item['goods_name'] . " " . $count . "件,";
}
$note .= "[备注:" . $info['note'] . "]";
$info['note'] = $note;
$info['productInfo'] = $note;
$this->orders[$order['shop_id']][] = $info;
}
@ -262,7 +266,8 @@ class WayBillService
private function getShopSend($shopId)
{
return ShopSender::query()
->where('status', 1)->orderBy('sort')
->where('shop_id', $shopId)
->where('status', 1)->orderByDesc('sort')
->first();
}

View File

@ -0,0 +1,41 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddCustomerTempUrlToWaybillsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//
if (Schema::hasColumns('waybills', ["customer_temp_url"])) {
return;
}
Schema::table('waybills', function (Blueprint $table) {
$table->string('customer_temp_url', 191)->default('')->comment('自定义模版url');
$table->text('customer_temp_data')->nullable()->comment('自定义模版参数');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
Schema::table('waybills', function (Blueprint $table) {
//
$table->dropColumn('customer_temp_url');
$table->dropColumn('customer_temp_data');
});
}
}