作者 lyh

gx

... ... @@ -26,7 +26,6 @@ class AiVideoController extends BaseController
*/
public function ImageCallBack(){
$this->saveLog('数据详情:'.json_encode($this->param,true));
Log::channel('ai_video')->info('数据详情:'.json_encode($this->param,true));
$count = Redis::decr('ai_video_image');
if ($count < 0) {
Redis::set('ai_video_image', 0);
... ... @@ -34,18 +33,19 @@ class AiVideoController extends BaseController
$data = $this->param['attachments'][0] ?? [];
$aiVideoAutoLogModel = new AiVideoAutoLog();
if(empty($data) || empty($data['url'])){
$this->saveLog('未获取到回调数据详情');
$aiVideoAutoLogModel->edit(['status'=>9,'result'=>json_encode($this->param,true)],['trigger_id'=>$this->param['id']]);
}
//获取当前数据详情
$info = $aiVideoAutoLogModel->read(['trigger_id'=>$this->param['id']]);
if($info === false){
@file_put_contents(storage_path('logs/ai_video.log'), var_export($info, true) . PHP_EOL, FILE_APPEND);
Log::channel('ai_video')->info('当前数据不存在或已被删除'.$this->param['id']);
$this->saveLog('未获取到当前数据详情。'.$info);
$this->response('success');
}
//上传图片 返回cdn链接
$cosService = new CosService();
$imagePath = $cosService->uploadRemote($info['project_id'],'video',$data['url']);
@file_put_contents(storage_path('logs/ai_video.log'), var_export($imagePath, true) . PHP_EOL, FILE_APPEND);
$this->saveLog($imagePath);
try {
if($imagePath){
$cos = config('filesystems.disks.cos');
... ... @@ -60,11 +60,11 @@ class AiVideoController extends BaseController
}
}
$images = array_merge($images,$info['images']);
Log::channel('ai_video')->info('图片:'.json_encode($images));
$this->saveLog('返回的数据详情。'.$images);
$aiVideoAutoLogModel->edit(['images'=>$images,'result'=>json_encode($this->param,true),'status'=>1],['id'=>$info['id']]);
}
}catch (\Exception $e){
Log::channel('ai_video')->info('上传图片失败'.$e->getMessage());
$this->saveLog('上传图片失败,获取到数据详情。'.$e->getMessage());
}
$this->response('success');
}
... ...