|
|
|
@ -327,7 +327,7 @@ class Upload extends BaseController |
|
|
|
} |
|
|
|
$prefix='emoji/'.$uid.'/'; |
|
|
|
$name=str_replace('.'.$info['ext'],'',$info['name']); |
|
|
|
$fileInfo=FileModel::where(['md5'=>$info['md5'],'user_id'=>$uid])->find(); |
|
|
|
$fileInfo=FileModel::where(['md5'=>$info['md5'],'user_id'=>$uid,'delete_time'=>0])->find(); |
|
|
|
// 判断文件是否存在,如果有则不再上传 |
|
|
|
if(!$fileInfo){ |
|
|
|
$newName = uniqid() . '.' . $info['ext']; |
|
|
|
@ -350,8 +350,7 @@ class Upload extends BaseController |
|
|
|
$fileInfo=new FileModel; |
|
|
|
$fileInfo->save($ret); |
|
|
|
}else{ |
|
|
|
//$object = $fileInfo->src; |
|
|
|
return shutdown(lang('file.emojiExist')); |
|
|
|
$object = $fileInfo->src; |
|
|
|
} |
|
|
|
// 把左边的/去掉再加上,避免有些有/有些没有 |
|
|
|
$object='/'.ltrim($object,'/'); |
|
|
|
@ -362,6 +361,10 @@ class Upload extends BaseController |
|
|
|
"type" => 2, |
|
|
|
"file_id" => $fileInfo->file_id, |
|
|
|
]; |
|
|
|
$query = Emoji::where($emojiInfo)->find(); |
|
|
|
if ($query) { |
|
|
|
return shutdown(lang('file.emojiExist')); |
|
|
|
} |
|
|
|
Emoji::create($emojiInfo); |
|
|
|
return success('',$this->url.$object); |
|
|
|
} catch(\Exception $e) { |
|
|
|
|