feat: 上传文件大小限制

This commit is contained in:
weifashi 2023-11-14 18:17:53 +08:00
parent 4205b68b8c
commit d541397594
7 changed files with 40 additions and 15 deletions

View File

@ -238,13 +238,14 @@ class File extends AbstractModel
}
}
//
$setting = Base::setting('system');
$path = 'uploads/tmp/' . date("Ym") . '/';
$data = Base::upload([
"file" => Request::file('files'),
"type" => 'more',
"autoThumb" => false,
"path" => $path,
"size" => 100 * 1024
"size" => ($setting['file_upload_limit'] ?: 0) * 1024
]);
if (Base::isError($data)) {
throw new ApiException($data['msg']);

View File

@ -611,12 +611,13 @@ class WebSocketDialog extends AbstractModel
Base::makeDir(public_path($path));
copy($filePath, public_path($path) . basename($filePath));
} else {
$setting = Base::setting('system');
$data = Base::upload([
"file" => $files,
"type" => 'more',
"path" => $path,
"fileName" => $fileName,
"size" => 100 * 1024
"size" => ($setting['file_upload_limit'] ?: 0) * 1024
]);
}
//

View File

@ -1380,10 +1380,13 @@ APP推送
通义千问
模型
设置时间
计划
检测到所属的任务列表已被删除,该操作将会还原任务列表,你确定要还原归档吗?
打包下载
你确定要打包下载【(*)】文件吗?
你确定要打包下载(*)等(*)个文件吗?
此文件夹内已有共享文件夹,子文件的共享状态将被取消,是否继续?
文件上传限制
包含消息发送的文件
特殊设置
打包列表

View File

@ -189,6 +189,7 @@
ref="chatUpload"
class="chat-upload"
:dialog-id="dialogId"
:maxSize="maxSize"
@on-progress="chatFile('progress', $event)"
@on-success="chatFile('success', $event)"
@on-error="chatFile('error', $event)"/>
@ -677,6 +678,7 @@ export default {
computed: {
...mapState([
'systemConfig',
'userIsAdmin',
'taskId',
'dialogSearchMsgId',
@ -980,6 +982,13 @@ export default {
}
})
return list
},
maxSize() {
if(this.systemConfig?.file_upload_limit){
return this.systemConfig.file_upload_limit * 1024
}
return 1024000
}
},

View File

@ -813,7 +813,7 @@ export default {
}];
list.push({
value: -1,
label: `${this.$L('未设置时间')} (${allTask.filter(({start_at}) => {return !start_at}).length})`,
label: `${this.$L('未计划')} (${allTask.filter(({start_at}) => {return !start_at}).length})`,
children: []
});
const flows = flowList.map(item1 => {

View File

@ -503,7 +503,6 @@ export default {
uploadList: [],
uploadFormat: [], //
uploadAccept: '',
maxSize: 1024000,
contextMenuItem: {},
contextMenuVisible: false,
@ -736,7 +735,7 @@ export default {
},
computed: {
...mapState(['userIsAdmin', 'userInfo', 'fileLists', 'wsOpenNum']),
...mapState(['systemConfig', 'userIsAdmin', 'userInfo', 'fileLists', 'wsOpenNum']),
pid() {
const {folderId} = this.$route.params;
@ -852,6 +851,13 @@ export default {
compressedSownloadDisabled() {
return this.fileList?.find((res)=> res._checked && res.permission < 1) ? true : false
},
maxSize() {
if(this.systemConfig?.file_upload_limit){
return this.systemConfig.file_upload_limit * 1024
}
return 1024000
}
},

View File

@ -158,13 +158,6 @@
</RadioGroup>
<div class="form-tip">{{$L('是否将消息中的网络图片保存到本地服务器。')}}</div>
</FormItem>
<FormItem v-if="$A.isDooServer()" :label="$L('是否启动首页')" prop="startHome">
<RadioGroup v-model="formDatum.start_home">
<Radio label="open">{{$L('开启')}}</Radio>
<Radio label="close">{{$L('关闭')}}</Radio>
</RadioGroup>
<div class="form-tip">{{$L('仅支持网页版。')}}</div>
</FormItem>
<FormItem v-if="$A.isDooServer()" :label="$L('文件上传限制')" prop="fileUploadLimit">
<div style="width: 192px;">
<Input type="number" number v-model="formDatum.file_upload_limit" :placeholder="$L('默认不限制')">
@ -173,7 +166,19 @@
</template>
</Input>
</div>
<div class="form-tip">{{$L('包含消息发送文件')}}</div>
<div class="form-tip">{{$L('包含消息发送的文件')}}</div>
</FormItem>
</div>
</div>
<div class="block-setting-box" v-if="$A.isDooServer()">
<h3>{{ $L('特殊设置') }}</h3>
<div class="form-box">
<FormItem :label="$L('是否启动首页')" prop="startHome">
<RadioGroup v-model="formDatum.start_home">
<Radio label="open">{{$L('开启')}}</Radio>
<Radio label="close">{{$L('关闭')}}</Radio>
</RadioGroup>
<div class="form-tip">{{$L('仅支持网页版。')}}</div>
</FormItem>
</div>
</div>