作者 李宇航

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

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



查看合并请求 !720
... ... @@ -232,6 +232,9 @@ class ImageController extends Controller
$suffix = array_pop($nameArr) ?? 'jpg';
$nameStr = implode('-', $nameArr);
$enName = generateRoute(Translate::tran($nameStr, 'en'));
if(substr($enName, 0, 1) === '-'){
$enName = $nameStr;
}
$fileName = $enName;
$i=1;
while($this->onlyName($enName.'.'.$suffix,$project_id)){
... ...
... ... @@ -781,8 +781,9 @@ class BTemplateLogic extends BaseLogic
$productTypeModel = new ProductType();
$productTypeList = $productTypeModel->list(['project_id'=>$this->user['project_id']],'id',['id','name']);
if(!empty($productTypeList)){
foreach ($productTypeList as $items){
$items['id'] = 'product_type_'.$items['id'];
foreach ($productTypeList as $item){
$items['id'] = 'product_type_'.$item['id'];
$items['title'] = $item['name'];
$data["products"]["category"][] =$items;
}
}
... ... @@ -840,20 +841,21 @@ class BTemplateLogic extends BaseLogic
foreach ($data as $key => $values){
switch ($values['name']){
case '产品':
$productCategory = $this->getCategoryList((new Category()),1,['id','title','pid']);
if(!empty($productCategory)){
foreach ($productCategory as $item){
$values['category'][] = $item;
}
}
$productTypeModel = new ProductType();
$productTypeList = $productTypeModel->list(['project_id'=>$this->user['project_id']],'id',['id','name']);
if(!empty($productTypeList)){
foreach ($productTypeList as $items){
$items['id'] = 'product_type_'.$items['id'];
foreach ($productTypeList as $item){
$items['id'] = 'product_type_'.$item['id'];
$items['title'] = $item['name'];
$values['category'][] = $items;
}
}
$productCategory = $this->getCategoryList((new Category()),1,['id','title','pid']);
if(!empty($productCategory)){
foreach ($productCategory as $item){
$values['category'][] = $item;
}
}
break;
case '新闻':
$newCategory = $this->getCategoryList((new NewsCategory()),0,['id','name','pid']);
... ...