作者 lyh

gx

@@ -57,7 +57,7 @@ class EditVideoMp4 extends Command @@ -57,7 +57,7 @@ class EditVideoMp4 extends Command
57 $list = $templateModel->list(['id'=>1]); 57 $list = $templateModel->list(['id'=>1]);
58 foreach ($list as $k1 => $v1){ 58 foreach ($list as $k1 => $v1){
59 echo date('Y-m-d H:i:s') . '更新的id:'.$v1['id'] . PHP_EOL; 59 echo date('Y-m-d H:i:s') . '更新的id:'.$v1['id'] . PHP_EOL;
60 - $this->getVideoSrc($v1['id'],$v1['main_html']); 60 + $this->getVideoSrc($v1['id'],$v1['main_html'],'main_html');
61 } 61 }
62 return true; 62 return true;
63 } 63 }
@@ -69,9 +69,9 @@ class EditVideoMp4 extends Command @@ -69,9 +69,9 @@ class EditVideoMp4 extends Command
69 * @method :post 69 * @method :post
70 * @time :2024/4/16 9:46 70 * @time :2024/4/16 9:46
71 */ 71 */
72 - public function getVideoSrc($id,$html){ 72 + public function getVideoSrc($id,$html,$filed){
73 $main_html = $html; 73 $main_html = $html;
74 - $pattern = '/<img.*?src=[\'"]([^\'"]+)[\'"].*?>/i'; 74 + $pattern = '/<video.*?src="([^"]+)"[^>]*>/i';
75 preg_match_all($pattern, $html, $matches); 75 preg_match_all($pattern, $html, $matches);
76 $srcLinks = $matches[1]; 76 $srcLinks = $matches[1];
77 foreach ($srcLinks as $link) { 77 foreach ($srcLinks as $link) {
@@ -79,7 +79,7 @@ class EditVideoMp4 extends Command @@ -79,7 +79,7 @@ class EditVideoMp4 extends Command
79 $main_html = str_replace($link, $newLink, $main_html); 79 $main_html = str_replace($link, $newLink, $main_html);
80 } 80 }
81 $templateModel = new BTemplate(); 81 $templateModel = new BTemplate();
82 - $templateModel->edit(['main_html'=>$main_html],['id'=>$id]); 82 + $templateModel->edit([$filed=>$main_html],['id'=>$id]);
83 return true; 83 return true;
84 } 84 }
85 85
@@ -55,11 +55,13 @@ class TranslateLogic extends BaseLogic @@ -55,11 +55,13 @@ class TranslateLogic extends BaseLogic
55 // 原始校对程序 55 // 原始校对程序
56 $old_key = [];//key值组成数据 56 $old_key = [];//key值组成数据
57 $data_read = json_decode($info ? $info['data'] : '',JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); 57 $data_read = json_decode($info ? $info['data'] : '',JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
  58 + if(!empty($data_read)){
58 foreach ($data_read as $k => $v){ 59 foreach ($data_read as $k => $v){
59 $k = urldecode($k); 60 $k = urldecode($k);
60 $old_key[] = $k; 61 $old_key[] = $k;
61 $data[] = [$k => $v]; 62 $data[] = [$k => $v];
62 } 63 }
  64 + }
63 $arr2 = []; 65 $arr2 = [];
64 foreach ($text_array as $val) { 66 foreach ($text_array as $val) {
65 if (FALSE == in_array($val, $old_key)){ 67 if (FALSE == in_array($val, $old_key)){