作者 lyh

gx

@@ -26,7 +26,6 @@ class AiVideoController extends BaseController @@ -26,7 +26,6 @@ class AiVideoController extends BaseController
26 */ 26 */
27 public function ImageCallBack(){ 27 public function ImageCallBack(){
28 $this->saveLog('数据详情:'.json_encode($this->param,true)); 28 $this->saveLog('数据详情:'.json_encode($this->param,true));
29 - Log::channel('ai_video')->info('数据详情:'.json_encode($this->param,true));  
30 $count = Redis::decr('ai_video_image'); 29 $count = Redis::decr('ai_video_image');
31 if ($count < 0) { 30 if ($count < 0) {
32 Redis::set('ai_video_image', 0); 31 Redis::set('ai_video_image', 0);
@@ -34,18 +33,19 @@ class AiVideoController extends BaseController @@ -34,18 +33,19 @@ class AiVideoController extends BaseController
34 $data = $this->param['attachments'][0] ?? []; 33 $data = $this->param['attachments'][0] ?? [];
35 $aiVideoAutoLogModel = new AiVideoAutoLog(); 34 $aiVideoAutoLogModel = new AiVideoAutoLog();
36 if(empty($data) || empty($data['url'])){ 35 if(empty($data) || empty($data['url'])){
  36 + $this->saveLog('未获取到回调数据详情');
37 $aiVideoAutoLogModel->edit(['status'=>9,'result'=>json_encode($this->param,true)],['trigger_id'=>$this->param['id']]); 37 $aiVideoAutoLogModel->edit(['status'=>9,'result'=>json_encode($this->param,true)],['trigger_id'=>$this->param['id']]);
38 } 38 }
39 //获取当前数据详情 39 //获取当前数据详情
40 $info = $aiVideoAutoLogModel->read(['trigger_id'=>$this->param['id']]); 40 $info = $aiVideoAutoLogModel->read(['trigger_id'=>$this->param['id']]);
41 if($info === false){ 41 if($info === false){
42 - @file_put_contents(storage_path('logs/ai_video.log'), var_export($info, true) . PHP_EOL, FILE_APPEND);  
43 - Log::channel('ai_video')->info('当前数据不存在或已被删除'.$this->param['id']); 42 + $this->saveLog('未获取到当前数据详情。'.$info);
  43 + $this->response('success');
44 } 44 }
45 //上传图片 返回cdn链接 45 //上传图片 返回cdn链接
46 $cosService = new CosService(); 46 $cosService = new CosService();
47 $imagePath = $cosService->uploadRemote($info['project_id'],'video',$data['url']); 47 $imagePath = $cosService->uploadRemote($info['project_id'],'video',$data['url']);
48 - @file_put_contents(storage_path('logs/ai_video.log'), var_export($imagePath, true) . PHP_EOL, FILE_APPEND); 48 + $this->saveLog($imagePath);
49 try { 49 try {
50 if($imagePath){ 50 if($imagePath){
51 $cos = config('filesystems.disks.cos'); 51 $cos = config('filesystems.disks.cos');
@@ -60,11 +60,11 @@ class AiVideoController extends BaseController @@ -60,11 +60,11 @@ class AiVideoController extends BaseController
60 } 60 }
61 } 61 }
62 $images = array_merge($images,$info['images']); 62 $images = array_merge($images,$info['images']);
63 - Log::channel('ai_video')->info('图片:'.json_encode($images)); 63 + $this->saveLog('返回的数据详情。'.$images);
64 $aiVideoAutoLogModel->edit(['images'=>$images,'result'=>json_encode($this->param,true),'status'=>1],['id'=>$info['id']]); 64 $aiVideoAutoLogModel->edit(['images'=>$images,'result'=>json_encode($this->param,true),'status'=>1],['id'=>$info['id']]);
65 } 65 }
66 }catch (\Exception $e){ 66 }catch (\Exception $e){
67 - Log::channel('ai_video')->info('上传图片失败'.$e->getMessage()); 67 + $this->saveLog('上传图片失败,获取到数据详情。'.$e->getMessage());
68 } 68 }
69 $this->response('success'); 69 $this->response('success');
70 } 70 }