diff --git a/app/Services/WayBill/JingDong/WayBillService.php b/app/Services/WayBill/JingDong/WayBillService.php index 88d1559..d39b9f6 100644 --- a/app/Services/WayBill/JingDong/WayBillService.php +++ b/app/Services/WayBill/JingDong/WayBillService.php @@ -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(); } diff --git a/database/migrations/2024_12_30_134206_add_customer_temp_url_to_waybills_table.php b/database/migrations/2024_12_30_134206_add_customer_temp_url_to_waybills_table.php new file mode 100644 index 0000000..0d3bd4d --- /dev/null +++ b/database/migrations/2024_12_30_134206_add_customer_temp_url_to_waybills_table.php @@ -0,0 +1,41 @@ +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'); + }); + } +}