Browse Source

表情已存在限制

master
wanghongjun 3 months ago
parent
commit
7f435ddec4
  1. 5
      app/common/controller/Upload.php
  2. 3
      app/lang/en_us.php
  3. 1
      app/lang/zh_cn.php

5
app/common/controller/Upload.php

@ -327,7 +327,7 @@ class Upload extends BaseController
}
$prefix='emoji/'.$uid.'/';
$name=str_replace('.'.$info['ext'],'',$info['name']);
$fileInfo=false;//FileModel::where(['md5'=>$info['md5'],'user_id'=>$uid])->find();
$fileInfo=FileModel::where(['md5'=>$info['md5'],'user_id'=>$uid])->find();
// 判断文件是否存在,如果有则不再上传
if(!$fileInfo){
$newName = uniqid() . '.' . $info['ext'];
@ -350,7 +350,8 @@ class Upload extends BaseController
$fileInfo=new FileModel;
$fileInfo->save($ret);
}else{
$object = $fileInfo->src;
//$object = $fileInfo->src;
return shutdown(lang('file.emojiExist'));
}
// 把左边的/去掉再加上,避免有些有/有些没有
$object='/'.ltrim($object,'/');

3
app/lang/en_us.php

@ -154,7 +154,8 @@ return [
'file' => [
'preview' => "Preview file",
'browserDown' => "Please use the browser to download",
'exist' => "The file does not exist", // Note: This might be a duplicate of 'preview' and could be replaced with a more specific message
'exist' => "The file does not exist", // Note: This might be a duplicate of 'preview' and could be replaced with a more specific message
'emojiExist'=>"The emoji already exists",
'uploadLimit' => "File size cannot exceed {:size}MB",
'typeNotSupport' => "File format is not supported",
'error'=>"Upload failed",

1
app/lang/zh_cn.php

@ -154,6 +154,7 @@ return [
'preview'=>"预览文件",
'browserDown'=>"请使用浏览器下载",
'exist'=>"文件不存在",
'emojiExist'=>"表情已存在",
'uploadLimit'=>"文件大小不能超过{:size}MB",
'typeNotSupport'=>"文件格式不支持",
'error'=>"上传失败",

Loading…
Cancel
Save