上传素材调整
This commit is contained in:
@@ -574,12 +574,13 @@ class Material
|
|||||||
//记录处理开始
|
//记录处理开始
|
||||||
$iNum = count($aUploadStep);
|
$iNum = count($aUploadStep);
|
||||||
$sRedisKey = 'queue_material_job:upload:'.$iArticleId;
|
$sRedisKey = 'queue_material_job:upload:'.$iArticleId;
|
||||||
$result = $this->oQueueRedis->recordProcessingStart($sRedisKey,$iNum);
|
$result = $this->oQueueRedis->recordQuestionProcessingStart($sRedisKey,$iNum);
|
||||||
$result = empty($result) ? 0 : $result;
|
$result = empty($result) ? 0 : $result;
|
||||||
if($result == 1){
|
if($result == 1){
|
||||||
foreach ($aUploadStep as $key => $value) {
|
foreach ($aUploadStep as $key => $value) {
|
||||||
$aParam = empty($value['params']) ? [] : $value['params'];
|
$aParam = empty($value['params']) ? [] : $value['params'];
|
||||||
$aParam += ['chunkIndex' => $key+1,'func_name' => empty($value['func_name']) ? '' : $value['func_name']];
|
$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');
|
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']);
|
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);
|
$aResult = json_decode($this->$sFuncName($aParam),true);
|
||||||
$iStatus = empty($aResult['status']) ? 0 : $aResult['status'];
|
$iStatus = empty($aResult['status']) ? 0 : $aResult['status'];
|
||||||
$sMsg = empty($aResult['msg']) ? 'upload fail' : $aResult['msg'];
|
$sMsg = empty($aResult['msg']) ? 'upload fail' : $aResult['msg'];
|
||||||
|
|
||||||
//更新处理进度
|
//更新处理进度
|
||||||
$iIndex = empty($aParam['chunkIndex']) ? 0 : $aParam['chunkIndex'];
|
$sKeyName = empty($aParam['key_name']) ? 'queue_1_completed' : $aParam['key_name'];
|
||||||
$sRedisKey = 'queue_material_job:upload:'.$iId;
|
$iProgress = $this->oQueueRedis->updateQuestionProcessingProgress($sRedisKey,$sKeyName);
|
||||||
$iProgress = $this->oQueueRedis->updateProcessingProgress($sRedisKey,$iIndex);
|
|
||||||
//保存内容
|
//保存内容
|
||||||
$sRedisKey = 'queue_job:article_material_upload_progress:'.$iId;
|
$sRedisKey = 'queue_job:article_material_upload_progress:'.$iId;
|
||||||
$this->oQueueRedis->saveChunkProgress($sRedisKey, $iIndex,json_encode($aResult));
|
$this->oQueueRedis->saveChunkProgress($sRedisKey, $iIndex,json_encode($aResult));
|
||||||
@@ -628,7 +635,7 @@ class Material
|
|||||||
$aLog = json_decode($this->getWechatLog($aWhere),true);
|
$aLog = json_decode($this->getWechatLog($aWhere),true);
|
||||||
$aLog = empty($aLog['data']) ? [] : $aLog['data'];
|
$aLog = empty($aLog['data']) ? [] : $aLog['data'];
|
||||||
if(!empty($aLog)){
|
if(!empty($aLog)){
|
||||||
$sMsg .= empty($aLog['msg']) ? '' : ';'.$aLog['msg'];
|
$sMsg .= empty($aLog['msg']) ? '' : "\n".$aLog['msg'];
|
||||||
}
|
}
|
||||||
$sStatusName = 'processing';
|
$sStatusName = 'processing';
|
||||||
if($iStatus != 1) {
|
if($iStatus != 1) {
|
||||||
|
|||||||
Reference in New Issue
Block a user