mirror of
https://gitee.com/fit2cloud-feizhiyun/1Panel.git
synced 2024-12-05 13:29:11 +08:00
fix: 解决病毒扫描病毒策略更新失败的问题 (#5709)
This commit is contained in:
parent
0d3e834b37
commit
0c2653d270
@ -135,6 +135,9 @@ func (f *ClamService) Create(req dto.ClamCreate) error {
|
||||
if err := copier.Copy(&clam, &req); err != nil {
|
||||
return errors.WithMessage(constant.ErrStructTransform, err.Error())
|
||||
}
|
||||
if clam.InfectedStrategy == "none" || clam.InfectedStrategy == "remove" {
|
||||
clam.InfectedDir = ""
|
||||
}
|
||||
if err := clamRepo.Create(&clam); err != nil {
|
||||
return err
|
||||
}
|
||||
@ -146,9 +149,14 @@ func (f *ClamService) Update(req dto.ClamUpdate) error {
|
||||
if clam.ID == 0 {
|
||||
return constant.ErrRecordNotFound
|
||||
}
|
||||
if req.InfectedStrategy == "none" || req.InfectedStrategy == "remove" {
|
||||
req.InfectedDir = ""
|
||||
}
|
||||
upMap := map[string]interface{}{}
|
||||
upMap["name"] = req.Name
|
||||
upMap["path"] = req.Path
|
||||
upMap["infected_dir"] = req.InfectedDir
|
||||
upMap["infected_strategy"] = req.InfectedStrategy
|
||||
upMap["description"] = req.Description
|
||||
if err := clamRepo.Update(req.ID, upMap); err != nil {
|
||||
return err
|
||||
|
@ -127,7 +127,7 @@ export const searchClamBaseInfo = () => {
|
||||
return http.post<Toolbox.ClamBaseInfo>(`/toolbox/clam/base`);
|
||||
};
|
||||
export const updateClamBaseInfo = (operate: string) => {
|
||||
return http.post(`/toolbox/clam/operate`, { Operation: operate });
|
||||
return http.post(`/toolbox/clam/operate`, { Operation: operate }, TimeoutEnum.T_60S);
|
||||
};
|
||||
export const searchClam = (param: ReqPage) => {
|
||||
return http.post<ResPage<Toolbox.ClamInfo>>(`/toolbox/clam/search`, param);
|
||||
|
@ -53,12 +53,12 @@
|
||||
import { reactive, ref } from 'vue';
|
||||
import { Rules } from '@/global/form-rules';
|
||||
import i18n from '@/lang';
|
||||
import { ElForm, FormItemRule } from 'element-plus';
|
||||
import { ElForm } from 'element-plus';
|
||||
import DrawerHeader from '@/components/drawer-header/index.vue';
|
||||
import { MsgSuccess } from '@/utils/message';
|
||||
import { Host } from '@/api/interface/host';
|
||||
import { operateForwardRule } from '@/api/modules/host';
|
||||
import { checkCidr, checkIpV4V6, deepCopy } from '@/utils/util';
|
||||
import { checkCidr, checkIpV4V6, checkPort, deepCopy } from '@/utils/util';
|
||||
|
||||
const loading = ref();
|
||||
const oldRule = ref<Host.RuleForward>();
|
||||
@ -87,23 +87,22 @@ const handleClose = () => {
|
||||
drawerVisible.value = false;
|
||||
};
|
||||
|
||||
const strPortValidator: FormItemRule = {
|
||||
required: true,
|
||||
trigger: 'blur',
|
||||
validator: (_, value: string) => {
|
||||
const port = parseInt(value);
|
||||
return port >= 1 && port <= 65535;
|
||||
},
|
||||
message: i18n.global.t('commons.rule.port'),
|
||||
};
|
||||
|
||||
const rules = reactive({
|
||||
protocol: [Rules.requiredSelect],
|
||||
port: [Rules.requiredInput, strPortValidator],
|
||||
targetPort: [Rules.requiredInput, strPortValidator],
|
||||
port: [{ validator: checkPortRule, trigger: 'blur' }],
|
||||
targetPort: [{ validator: checkPortRule, trigger: 'blur' }],
|
||||
targetIP: [{ validator: checkAddress, trigger: 'blur' }],
|
||||
});
|
||||
|
||||
function checkPortRule(rule: any, value: string, callback: any) {
|
||||
if (!value) {
|
||||
return callback();
|
||||
}
|
||||
if (checkPort(value)) {
|
||||
return callback(new Error(i18n.global.t('firewall.portFormatError')));
|
||||
}
|
||||
callback();
|
||||
}
|
||||
function checkAddress(rule: any, value: string, callback: any) {
|
||||
if (!value) {
|
||||
return callback();
|
||||
|
@ -151,7 +151,7 @@ const data = ref();
|
||||
const paginationConfig = reactive({
|
||||
cacheSizeKey: 'clam-page-size',
|
||||
currentPage: 1,
|
||||
pageSize: Number(localStorage.getItem('ftp-page-size')) || 10,
|
||||
pageSize: Number(localStorage.getItem('clam-page-size')) || 10,
|
||||
total: 0,
|
||||
orderBy: 'created_at',
|
||||
order: 'null',
|
||||
|
Loading…
Reference in New Issue
Block a user