|
|
@@ -0,0 +1,35 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+namespace App\Services;
|
|
|
+
|
|
|
+use App\OrderPackage;
|
|
|
+use App\Traits\ServiceAppAop;
|
|
|
+use App\OrderPackageExpressBillPrintRecords;
|
|
|
+use Illuminate\Support\Facades\Auth;
|
|
|
+
|
|
|
+class OrderPackageExpressBillPrintRecordsService
|
|
|
+{
|
|
|
+ use ServiceAppAop;
|
|
|
+ protected $modelClass=OrderPackageExpressBillPrintRecords::class;
|
|
|
+
|
|
|
+ // 添加 快递面单打印记录
|
|
|
+ public function expressBillPrintRecord($logisticNumber): array
|
|
|
+ {
|
|
|
+ $orderPackage = OrderPackage::query()->with('order')->where('logistic_number',$logisticNumber)->first();
|
|
|
+ $data = ['logistic_number' => $logisticNumber];
|
|
|
+ if ($orderPackage){
|
|
|
+ $data['order_id'] = $orderPackage['order']['id'];
|
|
|
+ $data['order_package_id'] = $orderPackage['id'];
|
|
|
+ }
|
|
|
+
|
|
|
+ $printCount = OrderPackageExpressBillPrintRecords::query()->where('logistic_number',$logisticNumber)->max("print_count");
|
|
|
+ if ($printCount == 0) $printCount = 1;
|
|
|
+ else $printCount ++;
|
|
|
+ $data['print_count'] = $printCount;
|
|
|
+
|
|
|
+ $data['process_id'] = Auth::user()['id'];
|
|
|
+ OrderPackageExpressBillPrintRecords::query()->create($data);
|
|
|
+ return ['success' => true];
|
|
|
+ }
|
|
|
+
|
|
|
+}
|