正在显示
1 个修改的文件
包含
1 行增加
和
21 行删除
| @@ -83,30 +83,9 @@ class TranslateLogic extends BaseLogic | @@ -83,30 +83,9 @@ class TranslateLogic extends BaseLogic | ||
| 83 | 83 | ||
| 84 | } | 84 | } |
| 85 | } | 85 | } |
| 86 | - $data = $this->unique_multidimensional_array($data); | ||
| 87 | return $this->success($data); | 86 | return $this->success($data); |
| 88 | } | 87 | } |
| 89 | 88 | ||
| 90 | - /** | ||
| 91 | - * @remark :多维数组去重 | ||
| 92 | - * @name :unique_multidimensional_array | ||
| 93 | - * @author :lyh | ||
| 94 | - * @method :post | ||
| 95 | - * @time :2024/3/8 16:38 | ||
| 96 | - */ | ||
| 97 | - public function unique_multidimensional_array($array) { | ||
| 98 | - $tempArray = []; | ||
| 99 | - $uniqueArray = []; | ||
| 100 | - foreach ($array as $value) { | ||
| 101 | - // 使用键作为临时数组的键,如果不存在则添加到去重后的数组中 | ||
| 102 | - $key = key($value); | ||
| 103 | - if (!isset($tempArray[$key])) { | ||
| 104 | - $tempArray[$key] = true; | ||
| 105 | - $uniqueArray[] = $value; | ||
| 106 | - } | ||
| 107 | - } | ||
| 108 | - return $uniqueArray; | ||
| 109 | - } | ||
| 110 | 89 | ||
| 111 | /** | 90 | /** |
| 112 | * @remark :获取图片列表 | 91 | * @remark :获取图片列表 |
| @@ -207,6 +186,7 @@ class TranslateLogic extends BaseLogic | @@ -207,6 +186,7 @@ class TranslateLogic extends BaseLogic | ||
| 207 | } | 186 | } |
| 208 | $need_tran[] = $description ? $description->attr['content'] : ''; | 187 | $need_tran[] = $description ? $description->attr['content'] : ''; |
| 209 | $need_tran[] = $keywords ? $keywords->attr['content'] : ''; | 188 | $need_tran[] = $keywords ? $keywords->attr['content'] : ''; |
| 189 | + $need_tran = array_unique($need_tran); | ||
| 210 | return $need_tran; | 190 | return $need_tran; |
| 211 | } | 191 | } |
| 212 | 192 |
-
请 注册 或 登录 后发表评论