|
|
@@ -4,6 +4,8 @@ namespace App\Services;
|
|
|
|
|
|
use App\OracleDocOrderDeliveryInfo;
|
|
|
use App\OracleDOCOrderHeader;
|
|
|
+use Illuminate\Support\Carbon;
|
|
|
+use Illuminate\Support\Facades\Cache;
|
|
|
|
|
|
class DeliveryService
|
|
|
{
|
|
|
@@ -19,10 +21,9 @@ class DeliveryService
|
|
|
$deliveryInfo = OracleDocOrderDeliveryInfo::query()->selectRaw('trackingNo')->whereIn('orderno',$orderCodes)->get()->toArray();
|
|
|
$logisticNumbers = array_unique(array_merge($logisticNumbers,array_column($deliveryInfo,'trackingno')));
|
|
|
}
|
|
|
-
|
|
|
$OracleDocOrderDeliveryInfos = OracleDocOrderDeliveryInfo::query()->with('docOrderHeader')->whereIn('trackingNo',$logisticNumbers)->get();
|
|
|
-
|
|
|
$tbParams = app(TBDeliveryService::class)->getDeliveryInfo($OracleDocOrderDeliveryInfos);
|
|
|
+
|
|
|
$pddParams = app(PDDDeliveryService::class)->getDeliveryInfo($OracleDocOrderDeliveryInfos);
|
|
|
$sfParams = app(SFDeliveryService::class)->getDeliveryInfo($OracleDocOrderDeliveryInfos);
|
|
|
$jdParams = app(JDDeliveryService::class)->getDeliveryInfo($logisticNumbers);
|
|
|
@@ -43,18 +44,38 @@ class DeliveryService
|
|
|
return [$batchesCodes ?? [], $orderCodes ?? [], $logisticNumbers ?? []];
|
|
|
}
|
|
|
|
|
|
- public function encodeBase64($params){
|
|
|
- foreach ($params as $param) {
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
/**
|
|
|
* 快递面单填充自定义区域内容 或 自制面单
|
|
|
- * @param $params
|
|
|
+ * @param $items
|
|
|
+ * @return array
|
|
|
*/
|
|
|
- public function customProcessing($params)
|
|
|
+ public function customProcessing(array $items)
|
|
|
{
|
|
|
+ foreach ($items as $key =>$item) {
|
|
|
+ if ($item['is_process'] == false) continue;
|
|
|
+ $items[$key] = app(TBDeliveryService::class)->processing($item);
|
|
|
+ }
|
|
|
+ return $items;
|
|
|
+ }
|
|
|
|
|
|
+ /**
|
|
|
+ * 根据缓存删除十分钟前的文件
|
|
|
+ */
|
|
|
+ public function destroyFile(){
|
|
|
+ if (Cache::has('print-template-file-list')){
|
|
|
+ $arr = Cache::get('print-template-file-list');
|
|
|
+ $now = Carbon::now();
|
|
|
+ foreach ($arr as $key=>$item) {
|
|
|
+ $time = (new Carbon($item['time']))->addMilliseconds(10);
|
|
|
+ if ($now->lt($time)){
|
|
|
+ if(file_exists($item['path'])){
|
|
|
+ unlink($item['path']);
|
|
|
+ }
|
|
|
+ unset($arr[$key]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Cache::put('print-template-file-list',$arr);
|
|
|
+ }
|
|
|
}
|
|
|
}
|