| 123456789101112131415161718192021222324252627282930313233343536 |
- <?php
- namespace App\Services;
- use App\OrderPackage;
- use App\Traits\ServiceAppAop;
- use App\OrderPackageExpressBillPrintRecord;
- use Illuminate\Support\Facades\Auth;
- class OrderPackageExpressBillPrintRecordService
- {
- use ServiceAppAop;
- protected $modelClass=OrderPackageExpressBillPrintRecord::class;
- // 添加 快递面单打印记录
- public function expressBillPrintRecord($logisticNumber,$task_id): 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 = OrderPackageExpressBillPrintRecord::query()->where('logistic_number',$logisticNumber)->max("print_count");
- if ($printCount == 0) $printCount = 1;
- else $printCount ++;
- $data['print_count'] = $printCount;
- $data['task_id'] = $task_id;
- $data['process_id'] = Auth::user()['id'];
- OrderPackageExpressBillPrintRecord::query()->create($data);
- return ['success' => true];
- }
- }
|