作者 李宇航

合并分支 'master-server' 到 'master'

处理图片上传出现名称翻译失败情况



查看合并请求 !720
@@ -232,6 +232,9 @@ class ImageController extends Controller @@ -232,6 +232,9 @@ class ImageController extends Controller
232 $suffix = array_pop($nameArr) ?? 'jpg'; 232 $suffix = array_pop($nameArr) ?? 'jpg';
233 $nameStr = implode('-', $nameArr); 233 $nameStr = implode('-', $nameArr);
234 $enName = generateRoute(Translate::tran($nameStr, 'en')); 234 $enName = generateRoute(Translate::tran($nameStr, 'en'));
  235 + if(substr($enName, 0, 1) === '-'){
  236 + $enName = $nameStr;
  237 + }
235 $fileName = $enName; 238 $fileName = $enName;
236 $i=1; 239 $i=1;
237 while($this->onlyName($enName.'.'.$suffix,$project_id)){ 240 while($this->onlyName($enName.'.'.$suffix,$project_id)){
@@ -781,8 +781,9 @@ class BTemplateLogic extends BaseLogic @@ -781,8 +781,9 @@ class BTemplateLogic extends BaseLogic
781 $productTypeModel = new ProductType(); 781 $productTypeModel = new ProductType();
782 $productTypeList = $productTypeModel->list(['project_id'=>$this->user['project_id']],'id',['id','name']); 782 $productTypeList = $productTypeModel->list(['project_id'=>$this->user['project_id']],'id',['id','name']);
783 if(!empty($productTypeList)){ 783 if(!empty($productTypeList)){
784 - foreach ($productTypeList as $items){  
785 - $items['id'] = 'product_type_'.$items['id']; 784 + foreach ($productTypeList as $item){
  785 + $items['id'] = 'product_type_'.$item['id'];
  786 + $items['title'] = $item['name'];
786 $data["products"]["category"][] =$items; 787 $data["products"]["category"][] =$items;
787 } 788 }
788 } 789 }
@@ -840,20 +841,21 @@ class BTemplateLogic extends BaseLogic @@ -840,20 +841,21 @@ class BTemplateLogic extends BaseLogic
840 foreach ($data as $key => $values){ 841 foreach ($data as $key => $values){
841 switch ($values['name']){ 842 switch ($values['name']){
842 case '产品': 843 case '产品':
843 - $productCategory = $this->getCategoryList((new Category()),1,['id','title','pid']);  
844 - if(!empty($productCategory)){  
845 - foreach ($productCategory as $item){  
846 - $values['category'][] = $item;  
847 - }  
848 - }  
849 $productTypeModel = new ProductType(); 844 $productTypeModel = new ProductType();
850 $productTypeList = $productTypeModel->list(['project_id'=>$this->user['project_id']],'id',['id','name']); 845 $productTypeList = $productTypeModel->list(['project_id'=>$this->user['project_id']],'id',['id','name']);
851 if(!empty($productTypeList)){ 846 if(!empty($productTypeList)){
852 - foreach ($productTypeList as $items){  
853 - $items['id'] = 'product_type_'.$items['id']; 847 + foreach ($productTypeList as $item){
  848 + $items['id'] = 'product_type_'.$item['id'];
  849 + $items['title'] = $item['name'];
854 $values['category'][] = $items; 850 $values['category'][] = $items;
855 } 851 }
856 } 852 }
  853 + $productCategory = $this->getCategoryList((new Category()),1,['id','title','pid']);
  854 + if(!empty($productCategory)){
  855 + foreach ($productCategory as $item){
  856 + $values['category'][] = $item;
  857 + }
  858 + }
857 break; 859 break;
858 case '新闻': 860 case '新闻':
859 $newCategory = $this->getCategoryList((new NewsCategory()),0,['id','name','pid']); 861 $newCategory = $this->getCategoryList((new NewsCategory()),0,['id','name','pid']);