合并分支 'akun' 到 'master'
Akun 查看合并请求 !997
正在显示
1 个修改的文件
包含
25 行增加
和
0 行删除
| @@ -9,6 +9,7 @@ use App\Models\Product\Category; | @@ -9,6 +9,7 @@ use App\Models\Product\Category; | ||
| 9 | use App\Models\Product\Detail; | 9 | use App\Models\Product\Detail; |
| 10 | use App\Models\Product\Keyword; | 10 | use App\Models\Product\Keyword; |
| 11 | use App\Models\Product\Product; | 11 | use App\Models\Product\Product; |
| 12 | +use App\Models\Template\BCustomTemplate; | ||
| 12 | use App\Services\ProjectServer; | 13 | use App\Services\ProjectServer; |
| 13 | use Illuminate\Console\Command; | 14 | use Illuminate\Console\Command; |
| 14 | 15 | ||
| @@ -193,6 +194,30 @@ class SiteTranslate extends Command | @@ -193,6 +194,30 @@ class SiteTranslate extends Command | ||
| 193 | } | 194 | } |
| 194 | 195 | ||
| 195 | $this->output('项目ID : ' . $project_id . ' , 产品关键词翻译完成'); | 196 | $this->output('项目ID : ' . $project_id . ' , 产品关键词翻译完成'); |
| 197 | + | ||
| 198 | + //翻译单页 | ||
| 199 | + $pages = BCustomTemplate::select(['id', 'name', 'title', 'keywords', 'description'])->get(); | ||
| 200 | + foreach ($pages as $v_page) { | ||
| 201 | + $need_trans_page = [ | ||
| 202 | + $v_page->name, | ||
| 203 | + $v_page->title, | ||
| 204 | + $v_page->keywords, | ||
| 205 | + $v_page->description, | ||
| 206 | + ]; | ||
| 207 | + $re_trans_page = Translate::translate($need_trans_page, $tls); | ||
| 208 | + if (isset($re_trans_page[0]['code']) && $re_trans_page[0]['code'] == 200) { | ||
| 209 | + $page_trans_texts = $re_trans_page[0]['texts']; | ||
| 210 | + $v_page->name = $page_trans_texts[0] != $replace ? $page_trans_texts[0] : ''; | ||
| 211 | + $v_page->title = $page_trans_texts[1] != $replace ? $page_trans_texts[1] : ''; | ||
| 212 | + $v_page->keywords = $page_trans_texts[2] != $replace ? $page_trans_texts[2] : ''; | ||
| 213 | + $v_page->description = $page_trans_texts[3] != $replace ? $page_trans_texts[3] : ''; | ||
| 214 | + $v_page->save(); | ||
| 215 | + } | ||
| 216 | + } | ||
| 217 | + | ||
| 218 | + $this->output('项目ID : ' . $project_id . ' , 单页翻译完成'); | ||
| 219 | + | ||
| 220 | + $this->output('项目ID : ' . $project_id . ' , 整站内容翻译结束'); | ||
| 196 | } | 221 | } |
| 197 | 222 | ||
| 198 | 223 |
-
请 注册 或 登录 后发表评论