From db4f574d1c7876b5499a96fb16d4d5a93726e9c8 Mon Sep 17 00:00:00 2001 From: chengxl Date: Thu, 21 Aug 2025 14:45:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E7=B4=A0=E6=9D=90=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/common/Material.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/application/common/Material.php b/application/common/Material.php index 735aada..180de34 100644 --- a/application/common/Material.php +++ b/application/common/Material.php @@ -574,12 +574,13 @@ class Material //记录处理开始 $iNum = count($aUploadStep); $sRedisKey = 'queue_material_job:upload:'.$iArticleId; - $result = $this->oQueueRedis->recordProcessingStart($sRedisKey,$iNum); + $result = $this->oQueueRedis->recordQuestionProcessingStart($sRedisKey,$iNum); $result = empty($result) ? 0 : $result; if($result == 1){ foreach ($aUploadStep as $key => $value) { $aParam = empty($value['params']) ? [] : $value['params']; $aParam += ['chunkIndex' => $key+1,'func_name' => empty($value['func_name']) ? '' : $value['func_name']]; + $aParam['key_name'] = 'queue_1_completed'; Queue::push('app\api\job\uploadMaterialStep@fire', $aParam, 'uploadMaterialStep'); } //返回结果 @@ -610,15 +611,21 @@ class Material return json_encode(['status' => 2, 'msg' => 'The execution method is null']); } + //更新处理进度 + $iIndex = empty($aParam['chunkIndex']) ? 0 : $aParam['chunkIndex']; + $sRedisKey = 'queue_material_job:upload:'.$iId; + $sChunkProgress = $this->oQueueRedis->getChunkProgress($sRedisKey, $iIndex); + if(!empty($sChunkProgress)){ + return json_encode(['status' => 3, 'msg' => $sRedisKey.'_'.$iIndex.' Uploaded']); + } //请求方法上传 $aResult = json_decode($this->$sFuncName($aParam),true); $iStatus = empty($aResult['status']) ? 0 : $aResult['status']; $sMsg = empty($aResult['msg']) ? 'upload fail' : $aResult['msg']; //更新处理进度 - $iIndex = empty($aParam['chunkIndex']) ? 0 : $aParam['chunkIndex']; - $sRedisKey = 'queue_material_job:upload:'.$iId; - $iProgress = $this->oQueueRedis->updateProcessingProgress($sRedisKey,$iIndex); + $sKeyName = empty($aParam['key_name']) ? 'queue_1_completed' : $aParam['key_name']; + $iProgress = $this->oQueueRedis->updateQuestionProcessingProgress($sRedisKey,$sKeyName); //保存内容 $sRedisKey = 'queue_job:article_material_upload_progress:'.$iId; $this->oQueueRedis->saveChunkProgress($sRedisKey, $iIndex,json_encode($aResult)); @@ -628,7 +635,7 @@ class Material $aLog = json_decode($this->getWechatLog($aWhere),true); $aLog = empty($aLog['data']) ? [] : $aLog['data']; if(!empty($aLog)){ - $sMsg .= empty($aLog['msg']) ? '' : ';'.$aLog['msg']; + $sMsg .= empty($aLog['msg']) ? '' : "\n".$aLog['msg']; } $sStatusName = 'processing'; if($iStatus != 1) {