diff --git a/server/api/v1/autocode/autocodeExample.go b/server/api/v1/autocode/autocodeExample.go index ff83240c2ef533c111dd8b27aa0f22d2c6220daf..ae1457d0b864ec8f05f96fcbb85460802b7e3f49 100644 --- a/server/api/v1/autocode/autocodeExample.go +++ b/server/api/v1/autocode/autocodeExample.go @@ -28,7 +28,7 @@ func (autoCodeExampleApi *AutoCodeExampleApi) CreateAutoCodeExample(c *gin.Conte var autoCodeExample autocode.AutoCodeExample _ = c.ShouldBindJSON(&autoCodeExample) if err := autoCodeExampleService.CreateAutoCodeExample(autoCodeExample); err != nil { - global.GVA_LOG.Error("创建失败!", zap.Any("err", err)) + global.GVA_LOG.Error("创建失败!", zap.Error(err)) response.FailWithMessage("创建失败", c) } else { response.OkWithMessage("创建成功", c) @@ -47,7 +47,7 @@ func (autoCodeExampleApi *AutoCodeExampleApi) DeleteAutoCodeExample(c *gin.Conte var autoCodeExample autocode.AutoCodeExample _ = c.ShouldBindJSON(&autoCodeExample) if err := autoCodeExampleService.DeleteAutoCodeExample(autoCodeExample); err != nil { - global.GVA_LOG.Error("删除失败!", zap.Any("err", err)) + global.GVA_LOG.Error("删除失败!", zap.Error(err)) response.FailWithMessage("删除失败", c) } else { response.OkWithMessage("删除成功", c) @@ -66,7 +66,7 @@ func (autoCodeExampleApi *AutoCodeExampleApi) UpdateAutoCodeExample(c *gin.Conte var autoCodeExample autocode.AutoCodeExample _ = c.ShouldBindJSON(&autoCodeExample) if err := autoCodeExampleService.UpdateAutoCodeExample(&autoCodeExample); err != nil { - global.GVA_LOG.Error("更新失败!", zap.Any("err", err)) + global.GVA_LOG.Error("更新失败!", zap.Error(err)) response.FailWithMessage("更新失败", c) } else { response.OkWithMessage("更新成功", c) @@ -89,7 +89,7 @@ func (autoCodeExampleApi *AutoCodeExampleApi) FindAutoCodeExample(c *gin.Context return } if err, reAutoCodeExample := autoCodeExampleService.GetAutoCodeExample(autoCodeExample.ID); err != nil { - global.GVA_LOG.Error("查询失败!", zap.Any("err", err)) + global.GVA_LOG.Error("查询失败!", zap.Error(err)) response.FailWithMessage("查询失败", c) } else { response.OkWithDetailed(gin.H{"reAutoCodeExample": reAutoCodeExample}, "查询成功", c) @@ -108,7 +108,7 @@ func (autoCodeExampleApi *AutoCodeExampleApi) GetAutoCodeExampleList(c *gin.Cont var pageInfo autocodeReq.AutoCodeExampleSearch _ = c.ShouldBindQuery(&pageInfo) if err, list, total := autoCodeExampleService.GetAutoCodeExampleInfoList(pageInfo); err != nil { - global.GVA_LOG.Error("获取失败!", zap.Any("err", err)) + global.GVA_LOG.Error("获取失败!", zap.Error(err)) response.FailWithMessage("获取失败", c) } else { response.OkWithDetailed(response.PageResult{ diff --git a/server/api/v1/example/exa_breakpoint_continue.go b/server/api/v1/example/exa_breakpoint_continue.go index cf20d55cddddd495f497d18f887225189b1098b4..e10db174f95d20ad92705662a0139d632ad6465f 100644 --- a/server/api/v1/example/exa_breakpoint_continue.go +++ b/server/api/v1/example/exa_breakpoint_continue.go @@ -30,13 +30,13 @@ func (u *FileUploadAndDownloadApi) BreakpointContinue(c *gin.Context) { chunkTotal, _ := strconv.Atoi(c.Request.FormValue("chunkTotal")) _, FileHeader, err := c.Request.FormFile("file") if err != nil { - global.GVA_LOG.Error("接收文件失败!", zap.Any("err", err)) + global.GVA_LOG.Error("接收文件失败!", zap.Error(err)) response.FailWithMessage("接收文件失败", c) return } f, err := FileHeader.Open() if err != nil { - global.GVA_LOG.Error("文件读取失败!", zap.Any("err", err)) + global.GVA_LOG.Error("文件读取失败!", zap.Error(err)) response.FailWithMessage("文件读取失败", c) return } @@ -48,25 +48,25 @@ func (u *FileUploadAndDownloadApi) BreakpointContinue(c *gin.Context) { }(f) cen, _ := ioutil.ReadAll(f) if !utils.CheckMd5(cen, chunkMd5) { - global.GVA_LOG.Error("检查md5失败!", zap.Any("err", err)) + global.GVA_LOG.Error("检查md5失败!", zap.Error(err)) response.FailWithMessage("检查md5失败", c) return } err, file := fileUploadAndDownloadService.FindOrCreateFile(fileMd5, fileName, chunkTotal) if err != nil { - global.GVA_LOG.Error("查找或创建记录失败!", zap.Any("err", err)) + global.GVA_LOG.Error("查找或创建记录失败!", zap.Error(err)) response.FailWithMessage("查找或创建记录失败", c) return } err, pathc := utils.BreakPointContinue(cen, fileName, chunkNumber, chunkTotal, fileMd5) if err != nil { - global.GVA_LOG.Error("断点续传失败!", zap.Any("err", err)) + global.GVA_LOG.Error("断点续传失败!", zap.Error(err)) response.FailWithMessage("断点续传失败", c) return } if err = fileUploadAndDownloadService.CreateFileChunk(file.ID, pathc, chunkNumber); err != nil { - global.GVA_LOG.Error("创建文件记录失败!", zap.Any("err", err)) + global.GVA_LOG.Error("创建文件记录失败!", zap.Error(err)) response.FailWithMessage("创建文件记录失败", c) return } @@ -87,7 +87,7 @@ func (u *FileUploadAndDownloadApi) FindFile(c *gin.Context) { chunkTotal, _ := strconv.Atoi(c.Query("chunkTotal")) err, file := fileUploadAndDownloadService.FindOrCreateFile(fileMd5, fileName, chunkTotal) if err != nil { - global.GVA_LOG.Error("查找失败!", zap.Any("err", err)) + global.GVA_LOG.Error("查找失败!", zap.Error(err)) response.FailWithMessage("查找失败", c) } else { response.OkWithDetailed(exampleRes.FileResponse{File: file}, "查找成功", c) @@ -107,7 +107,7 @@ func (b *FileUploadAndDownloadApi) BreakpointContinueFinish(c *gin.Context) { fileName := c.Query("fileName") err, filePath := utils.MakeFile(fileName, fileMd5) if err != nil { - global.GVA_LOG.Error("文件创建失败!", zap.Any("err", err)) + global.GVA_LOG.Error("文件创建失败!", zap.Error(err)) response.FailWithDetailed(exampleRes.FilePathResponse{FilePath: filePath}, "文件创建失败", c) } else { response.OkWithDetailed(exampleRes.FilePathResponse{FilePath: filePath}, "文件创建成功", c) @@ -132,7 +132,7 @@ func (u *FileUploadAndDownloadApi) RemoveChunk(c *gin.Context) { } err = fileUploadAndDownloadService.DeleteFileChunk(fileMd5, fileName, filePath) if err != nil { - global.GVA_LOG.Error("缓存切片删除失败!", zap.Any("err", err)) + global.GVA_LOG.Error("缓存切片删除失败!", zap.Error(err)) response.FailWithDetailed(exampleRes.FilePathResponse{FilePath: filePath}, "缓存切片删除失败", c) } else { response.OkWithDetailed(exampleRes.FilePathResponse{FilePath: filePath}, "缓存切片删除成功", c) diff --git a/server/api/v1/example/exa_customer.go b/server/api/v1/example/exa_customer.go index 3939ebfb58f76d82d62b11c40402ce67b6a3d7ab..5e22d65a6b9048b3f64b614330006e5c3c513d8c 100644 --- a/server/api/v1/example/exa_customer.go +++ b/server/api/v1/example/exa_customer.go @@ -32,7 +32,7 @@ func (e *CustomerApi) CreateExaCustomer(c *gin.Context) { customer.SysUserID = utils.GetUserID(c) customer.SysUserAuthorityID = utils.GetUserAuthorityId(c) if err := customerService.CreateExaCustomer(customer); err != nil { - global.GVA_LOG.Error("创建失败!", zap.Any("err", err)) + global.GVA_LOG.Error("创建失败!", zap.Error(err)) response.FailWithMessage("创建失败", c) } else { response.OkWithMessage("创建成功", c) @@ -55,7 +55,7 @@ func (e *CustomerApi) DeleteExaCustomer(c *gin.Context) { return } if err := customerService.DeleteExaCustomer(customer); err != nil { - global.GVA_LOG.Error("删除失败!", zap.Any("err", err)) + global.GVA_LOG.Error("删除失败!", zap.Error(err)) response.FailWithMessage("删除失败", c) } else { response.OkWithMessage("删除成功", c) @@ -82,7 +82,7 @@ func (e *CustomerApi) UpdateExaCustomer(c *gin.Context) { return } if err := customerService.UpdateExaCustomer(&customer); err != nil { - global.GVA_LOG.Error("更新失败!", zap.Any("err", err)) + global.GVA_LOG.Error("更新失败!", zap.Error(err)) response.FailWithMessage("更新失败", c) } else { response.OkWithMessage("更新成功", c) @@ -106,7 +106,7 @@ func (e *CustomerApi) GetExaCustomer(c *gin.Context) { } err, data := customerService.GetExaCustomer(customer.ID) if err != nil { - global.GVA_LOG.Error("获取失败!", zap.Any("err", err)) + global.GVA_LOG.Error("获取失败!", zap.Error(err)) response.FailWithMessage("获取失败", c) } else { response.OkWithDetailed(exampleRes.ExaCustomerResponse{Customer: data}, "获取成功", c) @@ -130,7 +130,7 @@ func (e *CustomerApi) GetExaCustomerList(c *gin.Context) { } err, customerList, total := customerService.GetCustomerInfoList(utils.GetUserAuthorityId(c), pageInfo) if err != nil { - global.GVA_LOG.Error("获取失败!", zap.Any("err", err)) + global.GVA_LOG.Error("获取失败!", zap.Error(err)) response.FailWithMessage("获取失败"+err.Error(), c) } else { response.OkWithDetailed(response.PageResult{ diff --git a/server/api/v1/example/exa_excel.go b/server/api/v1/example/exa_excel.go index 12dc2b9eb6539531b8d19003d7a03e84b761be94..263dec3ce4ec5bd42fdb546790cfe32350cc8a81 100644 --- a/server/api/v1/example/exa_excel.go +++ b/server/api/v1/example/exa_excel.go @@ -31,7 +31,7 @@ func (e *ExcelApi) ExportExcel(c *gin.Context) { filePath := global.GVA_CONFIG.Excel.Dir + excelInfo.FileName err := excelService.ParseInfoList2Excel(excelInfo.InfoList, filePath) if err != nil { - global.GVA_LOG.Error("转换Excel失败!", zap.Any("err", err)) + global.GVA_LOG.Error("转换Excel失败!", zap.Error(err)) response.FailWithMessage("转换Excel失败", c) return } @@ -50,7 +50,7 @@ func (e *ExcelApi) ExportExcel(c *gin.Context) { func (e *ExcelApi) ImportExcel(c *gin.Context) { _, header, err := c.Request.FormFile("file") if err != nil { - global.GVA_LOG.Error("接收文件失败!", zap.Any("err", err)) + global.GVA_LOG.Error("接收文件失败!", zap.Error(err)) response.FailWithMessage("接收文件失败", c) return } @@ -67,7 +67,7 @@ func (e *ExcelApi) ImportExcel(c *gin.Context) { func (e *ExcelApi) LoadExcel(c *gin.Context) { menus, err := excelService.ParseExcel2InfoList() if err != nil { - global.GVA_LOG.Error("加载数据失败!", zap.Any("err", err)) + global.GVA_LOG.Error("加载数据失败!", zap.Error(err)) response.FailWithMessage("加载数据失败", c) return } @@ -92,7 +92,7 @@ func (e *ExcelApi) DownloadTemplate(c *gin.Context) { filePath := global.GVA_CONFIG.Excel.Dir + fileName ok, err := utils.PathExists(filePath) if !ok || err != nil { - global.GVA_LOG.Error("文件不存在!", zap.Any("err", err)) + global.GVA_LOG.Error("文件不存在!", zap.Error(err)) response.FailWithMessage("文件不存在", c) return } diff --git a/server/api/v1/example/exa_file_upload_download.go b/server/api/v1/example/exa_file_upload_download.go index 5fdf6dc58b96f97d90c431dfe635c0f1cee853d7..658fd7eb57707cf17e53875ede38b0e1916bb3f3 100644 --- a/server/api/v1/example/exa_file_upload_download.go +++ b/server/api/v1/example/exa_file_upload_download.go @@ -26,13 +26,13 @@ func (u *FileUploadAndDownloadApi) UploadFile(c *gin.Context) { noSave := c.DefaultQuery("noSave", "0") _, header, err := c.Request.FormFile("file") if err != nil { - global.GVA_LOG.Error("接收文件失败!", zap.Any("err", err)) + global.GVA_LOG.Error("接收文件失败!", zap.Error(err)) response.FailWithMessage("接收文件失败", c) return } err, file = fileUploadAndDownloadService.UploadFile(header, noSave) // 文件上传后拿到文件路径 if err != nil { - global.GVA_LOG.Error("修改数据库链接失败!", zap.Any("err", err)) + global.GVA_LOG.Error("修改数据库链接失败!", zap.Error(err)) response.FailWithMessage("修改数据库链接失败", c) return } @@ -50,7 +50,7 @@ func (u *FileUploadAndDownloadApi) DeleteFile(c *gin.Context) { var file example.ExaFileUploadAndDownload _ = c.ShouldBindJSON(&file) if err := fileUploadAndDownloadService.DeleteFile(file); err != nil { - global.GVA_LOG.Error("删除失败!", zap.Any("err", err)) + global.GVA_LOG.Error("删除失败!", zap.Error(err)) response.FailWithMessage("删除失败", c) return } @@ -70,7 +70,7 @@ func (u *FileUploadAndDownloadApi) GetFileList(c *gin.Context) { _ = c.ShouldBindJSON(&pageInfo) err, list, total := fileUploadAndDownloadService.GetFileRecordInfoList(pageInfo) if err != nil { - global.GVA_LOG.Error("获取失败!", zap.Any("err", err)) + global.GVA_LOG.Error("获取失败!", zap.Error(err)) response.FailWithMessage("获取失败", c) } else { response.OkWithDetailed(response.PageResult{ diff --git a/server/api/v1/system/sys_api.go b/server/api/v1/system/sys_api.go index ba7fb8a37794938ad7dcb930a527a19d105a7da7..8f2e4dbeb085e024721c092106d31cbcca3ba4f5 100644 --- a/server/api/v1/system/sys_api.go +++ b/server/api/v1/system/sys_api.go @@ -32,7 +32,7 @@ func (s *SystemApiApi) CreateApi(c *gin.Context) { return } if err := apiService.CreateApi(api); err != nil { - global.GVA_LOG.Error("创建失败!", zap.Any("err", err)) + global.GVA_LOG.Error("创建失败!", zap.Error(err)) response.FailWithMessage("创建失败", c) } else { response.OkWithMessage("创建成功", c) @@ -55,7 +55,7 @@ func (s *SystemApiApi) DeleteApi(c *gin.Context) { return } if err := apiService.DeleteApi(api); err != nil { - global.GVA_LOG.Error("删除失败!", zap.Any("err", err)) + global.GVA_LOG.Error("删除失败!", zap.Error(err)) response.FailWithMessage("删除失败", c) } else { response.OkWithMessage("删除成功", c) @@ -78,7 +78,7 @@ func (s *SystemApiApi) GetApiList(c *gin.Context) { return } if err, list, total := apiService.GetAPIInfoList(pageInfo.SysApi, pageInfo.PageInfo, pageInfo.OrderKey, pageInfo.Desc); err != nil { - global.GVA_LOG.Error("获取失败!", zap.Any("err", err)) + global.GVA_LOG.Error("获取失败!", zap.Error(err)) response.FailWithMessage("获取失败", c) } else { response.OkWithDetailed(response.PageResult{ @@ -107,7 +107,7 @@ func (s *SystemApiApi) GetApiById(c *gin.Context) { } err, api := apiService.GetApiById(idInfo.ID) if err != nil { - global.GVA_LOG.Error("获取失败!", zap.Any("err", err)) + global.GVA_LOG.Error("获取失败!", zap.Error(err)) response.FailWithMessage("获取失败", c) } else { response.OkWithData(systemRes.SysAPIResponse{Api: api}, c) @@ -130,7 +130,7 @@ func (s *SystemApiApi) UpdateApi(c *gin.Context) { return } if err := apiService.UpdateApi(api); err != nil { - global.GVA_LOG.Error("修改失败!", zap.Any("err", err)) + global.GVA_LOG.Error("修改失败!", zap.Error(err)) response.FailWithMessage("修改失败", c) } else { response.OkWithMessage("修改成功", c) @@ -146,7 +146,7 @@ func (s *SystemApiApi) UpdateApi(c *gin.Context) { // @Router /api/getAllApis [post] func (s *SystemApiApi) GetAllApis(c *gin.Context) { if err, apis := apiService.GetAllApis(); err != nil { - global.GVA_LOG.Error("获取失败!", zap.Any("err", err)) + global.GVA_LOG.Error("获取失败!", zap.Error(err)) response.FailWithMessage("获取失败", c) } else { response.OkWithDetailed(systemRes.SysAPIListResponse{Apis: apis}, "获取成功", c) @@ -165,7 +165,7 @@ func (s *SystemApiApi) DeleteApisByIds(c *gin.Context) { var ids request.IdsReq _ = c.ShouldBindJSON(&ids) if err := apiService.DeleteApisByIds(ids); err != nil { - global.GVA_LOG.Error("删除失败!", zap.Any("err", err)) + global.GVA_LOG.Error("删除失败!", zap.Error(err)) response.FailWithMessage("删除失败", c) } else { response.OkWithMessage("删除成功", c) diff --git a/server/api/v1/system/sys_authority.go b/server/api/v1/system/sys_authority.go index 5cb6d96a44a855f535ca39a369762177313474b5..a1a25d8eeec9112829b92ae5ee8a4043f322dd1b 100644 --- a/server/api/v1/system/sys_authority.go +++ b/server/api/v1/system/sys_authority.go @@ -32,7 +32,7 @@ func (a *AuthorityApi) CreateAuthority(c *gin.Context) { return } if err, authBack := authorityService.CreateAuthority(authority); err != nil { - global.GVA_LOG.Error("创建失败!", zap.Any("err", err)) + global.GVA_LOG.Error("创建失败!", zap.Error(err)) response.FailWithMessage("创建失败"+err.Error(), c) } else { _ = menuService.AddMenuAuthority(systemReq.DefaultMenu(), authority.AuthorityId) @@ -61,7 +61,7 @@ func (a *AuthorityApi) CopyAuthority(c *gin.Context) { return } if err, authBack := authorityService.CopyAuthority(copyInfo); err != nil { - global.GVA_LOG.Error("拷贝失败!", zap.Any("err", err)) + global.GVA_LOG.Error("拷贝失败!", zap.Error(err)) response.FailWithMessage("拷贝失败"+err.Error(), c) } else { response.OkWithDetailed(systemRes.SysAuthorityResponse{Authority: authBack}, "拷贝成功", c) @@ -84,7 +84,7 @@ func (a *AuthorityApi) DeleteAuthority(c *gin.Context) { return } if err := authorityService.DeleteAuthority(&authority); err != nil { // 删除角色之前需要判断是否有用户正在使用此角色 - global.GVA_LOG.Error("删除失败!", zap.Any("err", err)) + global.GVA_LOG.Error("删除失败!", zap.Error(err)) response.FailWithMessage("删除失败"+err.Error(), c) } else { response.OkWithMessage("删除成功", c) @@ -107,7 +107,7 @@ func (a *AuthorityApi) UpdateAuthority(c *gin.Context) { return } if err, authority := authorityService.UpdateAuthority(auth); err != nil { - global.GVA_LOG.Error("更新失败!", zap.Any("err", err)) + global.GVA_LOG.Error("更新失败!", zap.Error(err)) response.FailWithMessage("更新失败"+err.Error(), c) } else { response.OkWithDetailed(systemRes.SysAuthorityResponse{Authority: authority}, "更新成功", c) @@ -130,7 +130,7 @@ func (a *AuthorityApi) GetAuthorityList(c *gin.Context) { return } if err, list, total := authorityService.GetAuthorityInfoList(pageInfo); err != nil { - global.GVA_LOG.Error("获取失败!", zap.Any("err", err)) + global.GVA_LOG.Error("获取失败!", zap.Error(err)) response.FailWithMessage("获取失败"+err.Error(), c) } else { response.OkWithDetailed(response.PageResult{ @@ -158,7 +158,7 @@ func (a *AuthorityApi) SetDataAuthority(c *gin.Context) { return } if err := authorityService.SetDataAuthority(auth); err != nil { - global.GVA_LOG.Error("设置失败!", zap.Any("err", err)) + global.GVA_LOG.Error("设置失败!", zap.Error(err)) response.FailWithMessage("设置失败"+err.Error(), c) } else { response.OkWithMessage("设置成功", c) diff --git a/server/api/v1/system/sys_auto_code.go b/server/api/v1/system/sys_auto_code.go index e8b7b049141fbd2da48c1a7793e2ed321e372975..855602eb6c24e3069f6045f3fd89bc49a9aaa83d 100644 --- a/server/api/v1/system/sys_auto_code.go +++ b/server/api/v1/system/sys_auto_code.go @@ -32,7 +32,7 @@ func (autoApi *AutoCodeApi) DelSysHistory(c *gin.Context) { _ = c.ShouldBindJSON(&id) err := autoCodeHistoryService.DeletePage(id.ID) if err != nil { - global.GVA_LOG.Error("获取失败!", zap.Any("err", err)) + global.GVA_LOG.Error("获取失败!", zap.Error(err)) response.FailWithMessage("获取失败", c) } response.OkWithMessage("删除成功", c) @@ -52,7 +52,7 @@ func (autoApi *AutoCodeApi) GetSysHistory(c *gin.Context) { _ = c.ShouldBindJSON(&search) err, list, total := autoCodeHistoryService.GetSysHistoryPage(search.PageInfo) if err != nil { - global.GVA_LOG.Error("获取失败!", zap.Any("err", err)) + global.GVA_LOG.Error("获取失败!", zap.Error(err)) response.FailWithMessage("获取失败", c) } else { response.OkWithDetailed(response.PageResult{ @@ -119,7 +119,7 @@ func (autoApi *AutoCodeApi) PreviewTemp(c *gin.Context) { } autoCode, err := autoCodeService.PreviewTemp(a) if err != nil { - global.GVA_LOG.Error("预览失败!", zap.Any("err", err)) + global.GVA_LOG.Error("预览失败!", zap.Error(err)) response.FailWithMessage("预览失败", c) } else { response.OkWithDetailed(gin.H{"autoCode": autoCode}, "预览成功", c) @@ -144,7 +144,7 @@ func (autoApi *AutoCodeApi) CreateTemp(c *gin.Context) { var apiIds []uint if a.AutoCreateApiToSql { if ids, err := autoCodeService.AutoCreateApi(&a); err != nil { - global.GVA_LOG.Error("自动化创建失败!请自行清空垃圾数据!", zap.Any("err", err)) + global.GVA_LOG.Error("自动化创建失败!请自行清空垃圾数据!", zap.Error(err)) c.Writer.Header().Add("success", "false") c.Writer.Header().Add("msg", url.QueryEscape("自动化创建失败!请自行清空垃圾数据!")) return @@ -182,7 +182,7 @@ func (autoApi *AutoCodeApi) GetTables(c *gin.Context) { dbName := c.DefaultQuery("dbName", global.GVA_CONFIG.Mysql.Dbname) err, tables := autoCodeService.GetTables(dbName) if err != nil { - global.GVA_LOG.Error("查询table失败!", zap.Any("err", err)) + global.GVA_LOG.Error("查询table失败!", zap.Error(err)) response.FailWithMessage("查询table失败", c) } else { response.OkWithDetailed(gin.H{"tables": tables}, "获取成功", c) @@ -198,7 +198,7 @@ func (autoApi *AutoCodeApi) GetTables(c *gin.Context) { // @Router /autoCode/getDatabase [get] func (autoApi *AutoCodeApi) GetDB(c *gin.Context) { if err, dbs := autoCodeService.GetDB(); err != nil { - global.GVA_LOG.Error("获取失败!", zap.Any("err", err)) + global.GVA_LOG.Error("获取失败!", zap.Error(err)) response.FailWithMessage("获取失败", c) } else { response.OkWithDetailed(gin.H{"dbs": dbs}, "获取成功", c) @@ -216,7 +216,7 @@ func (autoApi *AutoCodeApi) GetColumn(c *gin.Context) { dbName := c.DefaultQuery("dbName", global.GVA_CONFIG.Mysql.Dbname) tableName := c.Query("tableName") if err, columns := autoCodeService.GetColumn(tableName, dbName); err != nil { - global.GVA_LOG.Error("获取失败!", zap.Any("err", err)) + global.GVA_LOG.Error("获取失败!", zap.Error(err)) response.FailWithMessage("获取失败", c) } else { response.OkWithDetailed(gin.H{"columns": columns}, "获取成功", c) diff --git a/server/api/v1/system/sys_captcha.go b/server/api/v1/system/sys_captcha.go index 8ca800e9be44c22fa03fede11c56b544537d6f1d..8a69ac5106c03873ff231229b265aa8490a50350 100644 --- a/server/api/v1/system/sys_captcha.go +++ b/server/api/v1/system/sys_captcha.go @@ -30,7 +30,7 @@ func (b *BaseApi) Captcha(c *gin.Context) { //cp := base64Captcha.NewCaptcha(driver, store.UseWithCtx(c)) // v8下使用redis cp := base64Captcha.NewCaptcha(driver, store) if id, b64s, err := cp.Generate(); err != nil { - global.GVA_LOG.Error("验证码获取失败!", zap.Any("err", err)) + global.GVA_LOG.Error("验证码获取失败!", zap.Error(err)) response.FailWithMessage("验证码获取失败", c) } else { response.OkWithDetailed(systemRes.SysCaptchaResponse{ diff --git a/server/api/v1/system/sys_casbin.go b/server/api/v1/system/sys_casbin.go index ce2f1bcb1b92b8742c5151e854d27a5e02733aca..fab202d531f9869aa2c13a7aee92dc1b4f674a46 100644 --- a/server/api/v1/system/sys_casbin.go +++ b/server/api/v1/system/sys_casbin.go @@ -29,7 +29,7 @@ func (cas *CasbinApi) UpdateCasbin(c *gin.Context) { return } if err := casbinService.UpdateCasbin(cmr.AuthorityId, cmr.CasbinInfos); err != nil { - global.GVA_LOG.Error("更新失败!", zap.Any("err", err)) + global.GVA_LOG.Error("更新失败!", zap.Error(err)) response.FailWithMessage("更新失败", c) } else { response.OkWithMessage("更新成功", c) diff --git a/server/api/v1/system/sys_dictionary.go b/server/api/v1/system/sys_dictionary.go index 4b7b394464c3bca9a78569108672e73477e5111a..e71d711e4915d05ab45d2923d511d072b6013ffc 100644 --- a/server/api/v1/system/sys_dictionary.go +++ b/server/api/v1/system/sys_dictionary.go @@ -25,7 +25,7 @@ func (s *DictionaryApi) CreateSysDictionary(c *gin.Context) { var dictionary system.SysDictionary _ = c.ShouldBindJSON(&dictionary) if err := dictionaryService.CreateSysDictionary(dictionary); err != nil { - global.GVA_LOG.Error("创建失败!", zap.Any("err", err)) + global.GVA_LOG.Error("创建失败!", zap.Error(err)) response.FailWithMessage("创建失败", c) } else { response.OkWithMessage("创建成功", c) @@ -44,7 +44,7 @@ func (s *DictionaryApi) DeleteSysDictionary(c *gin.Context) { var dictionary system.SysDictionary _ = c.ShouldBindJSON(&dictionary) if err := dictionaryService.DeleteSysDictionary(dictionary); err != nil { - global.GVA_LOG.Error("删除失败!", zap.Any("err", err)) + global.GVA_LOG.Error("删除失败!", zap.Error(err)) response.FailWithMessage("删除失败", c) } else { response.OkWithMessage("删除成功", c) @@ -63,7 +63,7 @@ func (s *DictionaryApi) UpdateSysDictionary(c *gin.Context) { var dictionary system.SysDictionary _ = c.ShouldBindJSON(&dictionary) if err := dictionaryService.UpdateSysDictionary(&dictionary); err != nil { - global.GVA_LOG.Error("更新失败!", zap.Any("err", err)) + global.GVA_LOG.Error("更新失败!", zap.Error(err)) response.FailWithMessage("更新失败", c) } else { response.OkWithMessage("更新成功", c) @@ -82,7 +82,7 @@ func (s *DictionaryApi) FindSysDictionary(c *gin.Context) { var dictionary system.SysDictionary _ = c.ShouldBindQuery(&dictionary) if err, sysDictionary := dictionaryService.GetSysDictionary(dictionary.Type, dictionary.ID); err != nil { - global.GVA_LOG.Error("查询失败!", zap.Any("err", err)) + global.GVA_LOG.Error("查询失败!", zap.Error(err)) response.FailWithMessage("查询失败", c) } else { response.OkWithDetailed(gin.H{"resysDictionary": sysDictionary}, "查询成功", c) @@ -105,7 +105,7 @@ func (s *DictionaryApi) GetSysDictionaryList(c *gin.Context) { return } if err, list, total := dictionaryService.GetSysDictionaryInfoList(pageInfo); err != nil { - global.GVA_LOG.Error("获取失败!", zap.Any("err", err)) + global.GVA_LOG.Error("获取失败!", zap.Error(err)) response.FailWithMessage("获取失败", c) } else { response.OkWithDetailed(response.PageResult{ diff --git a/server/api/v1/system/sys_dictionary_detail.go b/server/api/v1/system/sys_dictionary_detail.go index 4984462426782201f5488bb429e7829decc37ac8..8b5c6edec4e10a2d7924fb233bb0d07610edb0b9 100644 --- a/server/api/v1/system/sys_dictionary_detail.go +++ b/server/api/v1/system/sys_dictionary_detail.go @@ -25,7 +25,7 @@ func (s *DictionaryDetailApi) CreateSysDictionaryDetail(c *gin.Context) { var detail system.SysDictionaryDetail _ = c.ShouldBindJSON(&detail) if err := dictionaryDetailService.CreateSysDictionaryDetail(detail); err != nil { - global.GVA_LOG.Error("创建失败!", zap.Any("err", err)) + global.GVA_LOG.Error("创建失败!", zap.Error(err)) response.FailWithMessage("创建失败", c) } else { response.OkWithMessage("创建成功", c) @@ -44,7 +44,7 @@ func (s *DictionaryDetailApi) DeleteSysDictionaryDetail(c *gin.Context) { var detail system.SysDictionaryDetail _ = c.ShouldBindJSON(&detail) if err := dictionaryDetailService.DeleteSysDictionaryDetail(detail); err != nil { - global.GVA_LOG.Error("删除失败!", zap.Any("err", err)) + global.GVA_LOG.Error("删除失败!", zap.Error(err)) response.FailWithMessage("删除失败", c) } else { response.OkWithMessage("删除成功", c) @@ -63,7 +63,7 @@ func (s *DictionaryDetailApi) UpdateSysDictionaryDetail(c *gin.Context) { var detail system.SysDictionaryDetail _ = c.ShouldBindJSON(&detail) if err := dictionaryDetailService.UpdateSysDictionaryDetail(&detail); err != nil { - global.GVA_LOG.Error("更新失败!", zap.Any("err", err)) + global.GVA_LOG.Error("更新失败!", zap.Error(err)) response.FailWithMessage("更新失败", c) } else { response.OkWithMessage("更新成功", c) @@ -86,7 +86,7 @@ func (s *DictionaryDetailApi) FindSysDictionaryDetail(c *gin.Context) { return } if err, resysDictionaryDetail := dictionaryDetailService.GetSysDictionaryDetail(detail.ID); err != nil { - global.GVA_LOG.Error("查询失败!", zap.Any("err", err)) + global.GVA_LOG.Error("查询失败!", zap.Error(err)) response.FailWithMessage("查询失败", c) } else { response.OkWithDetailed(gin.H{"resysDictionaryDetail": resysDictionaryDetail}, "查询成功", c) @@ -105,7 +105,7 @@ func (s *DictionaryDetailApi) GetSysDictionaryDetailList(c *gin.Context) { var pageInfo request.SysDictionaryDetailSearch _ = c.ShouldBindQuery(&pageInfo) if err, list, total := dictionaryDetailService.GetSysDictionaryDetailInfoList(pageInfo); err != nil { - global.GVA_LOG.Error("获取失败!", zap.Any("err", err)) + global.GVA_LOG.Error("获取失败!", zap.Error(err)) response.FailWithMessage("获取失败", c) } else { response.OkWithDetailed(response.PageResult{ diff --git a/server/api/v1/system/sys_initdb.go b/server/api/v1/system/sys_initdb.go index 0d062a99f75e4f9212d0ca4abaab682180eb418f..800a487cda1cab2a81aa4ba5ab50e85f8e76bd7e 100644 --- a/server/api/v1/system/sys_initdb.go +++ b/server/api/v1/system/sys_initdb.go @@ -26,12 +26,12 @@ func (i *DBApi) InitDB(c *gin.Context) { } var dbInfo request.InitDB if err := c.ShouldBindJSON(&dbInfo); err != nil { - global.GVA_LOG.Error("参数校验不通过!", zap.Any("err", err)) + global.GVA_LOG.Error("参数校验不通过!", zap.Error(err)) response.FailWithMessage("参数校验不通过", c) return } if err := initDBService.InitDB(dbInfo); err != nil { - global.GVA_LOG.Error("自动创建数据库失败!", zap.Any("err", err)) + global.GVA_LOG.Error("自动创建数据库失败!", zap.Error(err)) response.FailWithMessage("自动创建数据库失败,请查看后台日志,检查后在进行初始化", c) return } diff --git a/server/api/v1/system/sys_jwt_blacklist.go b/server/api/v1/system/sys_jwt_blacklist.go index a3ecb2dc7dc9a1e61dc65ee276e11d42e5a94c89..981167c7058b91aed0469cd5d3c7dbab6260f3df 100644 --- a/server/api/v1/system/sys_jwt_blacklist.go +++ b/server/api/v1/system/sys_jwt_blacklist.go @@ -22,7 +22,7 @@ func (j *JwtApi) JsonInBlacklist(c *gin.Context) { token := c.Request.Header.Get("x-token") jwt := system.JwtBlacklist{Jwt: token} if err := jwtService.JsonInBlacklist(jwt); err != nil { - global.GVA_LOG.Error("jwt作废失败!", zap.Any("err", err)) + global.GVA_LOG.Error("jwt作废失败!", zap.Error(err)) response.FailWithMessage("jwt作废失败", c) } else { response.OkWithMessage("jwt作废成功", c) diff --git a/server/api/v1/system/sys_menu.go b/server/api/v1/system/sys_menu.go index d01393669f37b81bb949c52bcbe73acb05f9cf5b..a747776358cd2f807f1e2a9b4662506ad148ac8f 100644 --- a/server/api/v1/system/sys_menu.go +++ b/server/api/v1/system/sys_menu.go @@ -25,7 +25,7 @@ type AuthorityMenuApi struct { // @Router /menu/getMenu [post] func (a *AuthorityMenuApi) GetMenu(c *gin.Context) { if err, menus := menuService.GetMenuTree(utils.GetUserAuthorityId(c)); err != nil { - global.GVA_LOG.Error("获取失败!", zap.Any("err", err)) + global.GVA_LOG.Error("获取失败!", zap.Error(err)) response.FailWithMessage("获取失败", c) } else { if menus == nil { @@ -44,7 +44,7 @@ func (a *AuthorityMenuApi) GetMenu(c *gin.Context) { // @Router /menu/getBaseMenuTree [post] func (a *AuthorityMenuApi) GetBaseMenuTree(c *gin.Context) { if err, menus := menuService.GetBaseMenuTree(); err != nil { - global.GVA_LOG.Error("获取失败!", zap.Any("err", err)) + global.GVA_LOG.Error("获取失败!", zap.Error(err)) response.FailWithMessage("获取失败", c) } else { response.OkWithDetailed(systemRes.SysBaseMenusResponse{Menus: menus}, "获取成功", c) @@ -67,7 +67,7 @@ func (a *AuthorityMenuApi) AddMenuAuthority(c *gin.Context) { return } if err := menuService.AddMenuAuthority(authorityMenu.Menus, authorityMenu.AuthorityId); err != nil { - global.GVA_LOG.Error("添加失败!", zap.Any("err", err)) + global.GVA_LOG.Error("添加失败!", zap.Error(err)) response.FailWithMessage("添加失败", c) } else { response.OkWithMessage("添加成功", c) @@ -90,7 +90,7 @@ func (a *AuthorityMenuApi) GetMenuAuthority(c *gin.Context) { return } if err, menus := menuService.GetMenuAuthority(¶m); err != nil { - global.GVA_LOG.Error("获取失败!", zap.Any("err", err)) + global.GVA_LOG.Error("获取失败!", zap.Error(err)) response.FailWithDetailed(systemRes.SysMenusResponse{Menus: menus}, "获取失败", c) } else { response.OkWithDetailed(gin.H{"menus": menus}, "获取成功", c) @@ -117,7 +117,7 @@ func (a *AuthorityMenuApi) AddBaseMenu(c *gin.Context) { return } if err := menuService.AddBaseMenu(menu); err != nil { - global.GVA_LOG.Error("添加失败!", zap.Any("err", err)) + global.GVA_LOG.Error("添加失败!", zap.Error(err)) response.FailWithMessage("添加失败", c) } else { @@ -141,7 +141,7 @@ func (a *AuthorityMenuApi) DeleteBaseMenu(c *gin.Context) { return } if err := baseMenuService.DeleteBaseMenu(menu.ID); err != nil { - global.GVA_LOG.Error("删除失败!", zap.Any("err", err)) + global.GVA_LOG.Error("删除失败!", zap.Error(err)) response.FailWithMessage("删除失败", c) } else { response.OkWithMessage("删除成功", c) @@ -168,7 +168,7 @@ func (a *AuthorityMenuApi) UpdateBaseMenu(c *gin.Context) { return } if err := baseMenuService.UpdateBaseMenu(menu); err != nil { - global.GVA_LOG.Error("更新失败!", zap.Any("err", err)) + global.GVA_LOG.Error("更新失败!", zap.Error(err)) response.FailWithMessage("更新失败", c) } else { response.OkWithMessage("更新成功", c) @@ -191,7 +191,7 @@ func (a *AuthorityMenuApi) GetBaseMenuById(c *gin.Context) { return } if err, menu := baseMenuService.GetBaseMenuById(idInfo.ID); err != nil { - global.GVA_LOG.Error("获取失败!", zap.Any("err", err)) + global.GVA_LOG.Error("获取失败!", zap.Error(err)) response.FailWithMessage("获取失败", c) } else { response.OkWithDetailed(systemRes.SysBaseMenuResponse{Menu: menu}, "获取成功", c) @@ -214,7 +214,7 @@ func (a *AuthorityMenuApi) GetMenuList(c *gin.Context) { return } if err, menuList, total := menuService.GetInfoList(); err != nil { - global.GVA_LOG.Error("获取失败!", zap.Any("err", err)) + global.GVA_LOG.Error("获取失败!", zap.Error(err)) response.FailWithMessage("获取失败", c) } else { response.OkWithDetailed(response.PageResult{ diff --git a/server/api/v1/system/sys_operation_record.go b/server/api/v1/system/sys_operation_record.go index 8bf165a6502888f7277eb45ce627728f3ec2b306..33d193c4b198bccf1444286abe87954f39ac32b0 100644 --- a/server/api/v1/system/sys_operation_record.go +++ b/server/api/v1/system/sys_operation_record.go @@ -26,7 +26,7 @@ func (s *OperationRecordApi) CreateSysOperationRecord(c *gin.Context) { var sysOperationRecord system.SysOperationRecord _ = c.ShouldBindJSON(&sysOperationRecord) if err := operationRecordService.CreateSysOperationRecord(sysOperationRecord); err != nil { - global.GVA_LOG.Error("创建失败!", zap.Any("err", err)) + global.GVA_LOG.Error("创建失败!", zap.Error(err)) response.FailWithMessage("创建失败", c) } else { response.OkWithMessage("创建成功", c) @@ -45,7 +45,7 @@ func (s *OperationRecordApi) DeleteSysOperationRecord(c *gin.Context) { var sysOperationRecord system.SysOperationRecord _ = c.ShouldBindJSON(&sysOperationRecord) if err := operationRecordService.DeleteSysOperationRecord(sysOperationRecord); err != nil { - global.GVA_LOG.Error("删除失败!", zap.Any("err", err)) + global.GVA_LOG.Error("删除失败!", zap.Error(err)) response.FailWithMessage("删除失败", c) } else { response.OkWithMessage("删除成功", c) @@ -64,7 +64,7 @@ func (s *OperationRecordApi) DeleteSysOperationRecordByIds(c *gin.Context) { var IDS request.IdsReq _ = c.ShouldBindJSON(&IDS) if err := operationRecordService.DeleteSysOperationRecordByIds(IDS); err != nil { - global.GVA_LOG.Error("批量删除失败!", zap.Any("err", err)) + global.GVA_LOG.Error("批量删除失败!", zap.Error(err)) response.FailWithMessage("批量删除失败", c) } else { response.OkWithMessage("批量删除成功", c) @@ -87,7 +87,7 @@ func (s *OperationRecordApi) FindSysOperationRecord(c *gin.Context) { return } if err, resysOperationRecord := operationRecordService.GetSysOperationRecord(sysOperationRecord.ID); err != nil { - global.GVA_LOG.Error("查询失败!", zap.Any("err", err)) + global.GVA_LOG.Error("查询失败!", zap.Error(err)) response.FailWithMessage("查询失败", c) } else { response.OkWithDetailed(gin.H{"resysOperationRecord": resysOperationRecord}, "查询成功", c) @@ -106,7 +106,7 @@ func (s *OperationRecordApi) GetSysOperationRecordList(c *gin.Context) { var pageInfo systemReq.SysOperationRecordSearch _ = c.ShouldBindQuery(&pageInfo) if err, list, total := operationRecordService.GetSysOperationRecordInfoList(pageInfo); err != nil { - global.GVA_LOG.Error("获取失败!", zap.Any("err", err)) + global.GVA_LOG.Error("获取失败!", zap.Error(err)) response.FailWithMessage("获取失败", c) } else { response.OkWithDetailed(response.PageResult{ diff --git a/server/api/v1/system/sys_system.go b/server/api/v1/system/sys_system.go index c344bac530f646f69ba0089b4b8e56380a44c0f0..bdc101197cf012e7772aa0b144cbbe6a643a0f0a 100644 --- a/server/api/v1/system/sys_system.go +++ b/server/api/v1/system/sys_system.go @@ -22,7 +22,7 @@ type SystemApi struct { // @Router /system/getSystemConfig [post] func (s *SystemApi) GetSystemConfig(c *gin.Context) { if err, config := systemConfigService.GetSystemConfig(); err != nil { - global.GVA_LOG.Error("获取失败!", zap.Any("err", err)) + global.GVA_LOG.Error("获取失败!", zap.Error(err)) response.FailWithMessage("获取失败", c) } else { response.OkWithDetailed(systemRes.SysConfigResponse{Config: config}, "获取成功", c) @@ -40,7 +40,7 @@ func (s *SystemApi) SetSystemConfig(c *gin.Context) { var sys system.System _ = c.ShouldBindJSON(&sys) if err := systemConfigService.SetSystemConfig(sys); err != nil { - global.GVA_LOG.Error("设置失败!", zap.Any("err", err)) + global.GVA_LOG.Error("设置失败!", zap.Error(err)) response.FailWithMessage("设置失败", c) } else { response.OkWithData("设置成功", c) @@ -56,7 +56,7 @@ func (s *SystemApi) SetSystemConfig(c *gin.Context) { func (s *SystemApi) ReloadSystem(c *gin.Context) { err := utils.Reload() if err != nil { - global.GVA_LOG.Error("重启系统失败!", zap.Any("err", err)) + global.GVA_LOG.Error("重启系统失败!", zap.Error(err)) response.FailWithMessage("重启系统失败", c) } else { response.OkWithMessage("重启系统成功", c) @@ -71,7 +71,7 @@ func (s *SystemApi) ReloadSystem(c *gin.Context) { // @Router /system/getServerInfo [post] func (s *SystemApi) GetServerInfo(c *gin.Context) { if server, err := systemConfigService.GetServerInfo(); err != nil { - global.GVA_LOG.Error("获取失败!", zap.Any("err", err)) + global.GVA_LOG.Error("获取失败!", zap.Error(err)) response.FailWithMessage("获取失败", c) } else { response.OkWithDetailed(gin.H{"server": server}, "获取成功", c) diff --git a/server/api/v1/system/sys_user.go b/server/api/v1/system/sys_user.go index c612ba66a199e8d6079d713a468a768977bf6549..a5a3a2f2154f619bbfe41cc8c6722a89d762449b 100644 --- a/server/api/v1/system/sys_user.go +++ b/server/api/v1/system/sys_user.go @@ -31,7 +31,7 @@ func (b *BaseApi) Login(c *gin.Context) { if store.Verify(l.CaptchaId, l.Captcha, true) { u := &system.SysUser{Username: l.Username, Password: l.Password} if err, user := userService.Login(u); err != nil { - global.GVA_LOG.Error("登陆失败! 用户名不存在或者密码错误!", zap.Any("err", err)) + global.GVA_LOG.Error("登陆失败! 用户名不存在或者密码错误!", zap.Error(err)) response.FailWithMessage("用户名不存在或者密码错误", c) } else { b.tokenNext(c, *user) @@ -53,7 +53,7 @@ func (b *BaseApi) tokenNext(c *gin.Context, user system.SysUser) { }) token, err := j.CreateToken(claims) if err != nil { - global.GVA_LOG.Error("获取token失败!", zap.Any("err", err)) + global.GVA_LOG.Error("获取token失败!", zap.Error(err)) response.FailWithMessage("获取token失败", c) return } @@ -68,7 +68,7 @@ func (b *BaseApi) tokenNext(c *gin.Context, user system.SysUser) { if err, jwtStr := jwtService.GetRedisJWT(user.Username); err == redis.Nil { if err := jwtService.SetRedisJWT(token, user.Username); err != nil { - global.GVA_LOG.Error("设置登录状态失败!", zap.Any("err", err)) + global.GVA_LOG.Error("设置登录状态失败!", zap.Error(err)) response.FailWithMessage("设置登录状态失败", c) return } @@ -78,7 +78,7 @@ func (b *BaseApi) tokenNext(c *gin.Context, user system.SysUser) { ExpiresAt: claims.StandardClaims.ExpiresAt * 1000, }, "登录成功", c) } else if err != nil { - global.GVA_LOG.Error("设置登录状态失败!", zap.Any("err", err)) + global.GVA_LOG.Error("设置登录状态失败!", zap.Error(err)) response.FailWithMessage("设置登录状态失败", c) } else { var blackJWT system.JwtBlacklist @@ -121,7 +121,7 @@ func (b *BaseApi) Register(c *gin.Context) { user := &system.SysUser{Username: r.Username, NickName: r.NickName, Password: r.Password, HeaderImg: r.HeaderImg, AuthorityId: r.AuthorityId, Authorities: authorities} err, userReturn := userService.Register(*user) if err != nil { - global.GVA_LOG.Error("注册失败!", zap.Any("err", err)) + global.GVA_LOG.Error("注册失败!", zap.Error(err)) response.FailWithDetailed(systemRes.SysUserResponse{User: userReturn}, "注册失败", c) } else { response.OkWithDetailed(systemRes.SysUserResponse{User: userReturn}, "注册成功", c) @@ -144,7 +144,7 @@ func (b *BaseApi) ChangePassword(c *gin.Context) { } u := &system.SysUser{Username: user.Username, Password: user.Password} if err, _ := userService.ChangePassword(u, user.NewPassword); err != nil { - global.GVA_LOG.Error("修改失败!", zap.Any("err", err)) + global.GVA_LOG.Error("修改失败!", zap.Error(err)) response.FailWithMessage("修改失败,原密码与当前账户不符", c) } else { response.OkWithMessage("修改成功", c) @@ -167,7 +167,7 @@ func (b *BaseApi) GetUserList(c *gin.Context) { return } if err, list, total := userService.GetUserInfoList(pageInfo); err != nil { - global.GVA_LOG.Error("获取失败!", zap.Any("err", err)) + global.GVA_LOG.Error("获取失败!", zap.Error(err)) response.FailWithMessage("获取失败", c) } else { response.OkWithDetailed(response.PageResult{ @@ -197,14 +197,14 @@ func (b *BaseApi) SetUserAuthority(c *gin.Context) { userID := utils.GetUserID(c) uuid := utils.GetUserUuid(c) if err := userService.SetUserAuthority(userID, uuid, sua.AuthorityId); err != nil { - global.GVA_LOG.Error("修改失败!", zap.Any("err", err)) + global.GVA_LOG.Error("修改失败!", zap.Error(err)) response.FailWithMessage(err.Error(), c) } else { claims := utils.GetUserInfo(c) j := &utils.JWT{SigningKey: []byte(global.GVA_CONFIG.JWT.SigningKey)} // 唯一签名 claims.AuthorityId = sua.AuthorityId if token, err := j.CreateToken(*claims); err != nil { - global.GVA_LOG.Error("修改失败!", zap.Any("err", err)) + global.GVA_LOG.Error("修改失败!", zap.Error(err)) response.FailWithMessage(err.Error(), c) } else { c.Header("new-token", token) @@ -227,7 +227,7 @@ func (b *BaseApi) SetUserAuthorities(c *gin.Context) { var sua systemReq.SetUserAuthorities _ = c.ShouldBindJSON(&sua) if err := userService.SetUserAuthorities(sua.ID, sua.AuthorityIds); err != nil { - global.GVA_LOG.Error("修改失败!", zap.Any("err", err)) + global.GVA_LOG.Error("修改失败!", zap.Error(err)) response.FailWithMessage("修改失败", c) } else { response.OkWithMessage("修改成功", c) @@ -255,7 +255,7 @@ func (b *BaseApi) DeleteUser(c *gin.Context) { return } if err := userService.DeleteUser(reqId.ID); err != nil { - global.GVA_LOG.Error("删除失败!", zap.Any("err", err)) + global.GVA_LOG.Error("删除失败!", zap.Error(err)) response.FailWithMessage("删除失败", c) } else { response.OkWithMessage("删除成功", c) @@ -278,7 +278,7 @@ func (b *BaseApi) SetUserInfo(c *gin.Context) { return } if err, ReqUser := userService.SetUserInfo(user); err != nil { - global.GVA_LOG.Error("设置失败!", zap.Any("err", err)) + global.GVA_LOG.Error("设置失败!", zap.Error(err)) response.FailWithMessage("设置失败", c) } else { response.OkWithDetailed(gin.H{"userInfo": ReqUser}, "设置成功", c) @@ -295,7 +295,7 @@ func (b *BaseApi) SetUserInfo(c *gin.Context) { func (b *BaseApi) GetUserInfo(c *gin.Context) { uuid := utils.GetUserUuid(c) if err, ReqUser := userService.GetUserInfo(uuid); err != nil { - global.GVA_LOG.Error("获取失败!", zap.Any("err", err)) + global.GVA_LOG.Error("获取失败!", zap.Error(err)) response.FailWithMessage("获取失败", c) } else { response.OkWithDetailed(gin.H{"userInfo": ReqUser}, "获取成功", c) diff --git a/server/initialize/redis.go b/server/initialize/redis.go index afc2868ee7836f90c6737fa7a350950c796dd744..f52829b37744d538992dc9ff82c31fddb6c49289 100644 --- a/server/initialize/redis.go +++ b/server/initialize/redis.go @@ -18,7 +18,7 @@ func Redis() { }) pong, err := client.Ping(context.Background()).Result() if err != nil { - global.GVA_LOG.Error("redis connect ping failed, err:", zap.Any("err", err)) + global.GVA_LOG.Error("redis connect ping failed, err:", zap.Error(err)) } else { global.GVA_LOG.Info("redis connect ping response:", zap.String("pong", pong)) global.GVA_REDIS = client diff --git a/server/middleware/email.go b/server/middleware/email.go index 3f10db627663abfdbf9298951b8aee124fbeefcf..17ff9138028953832565fdbba162e1b3cf8a98da 100644 --- a/server/middleware/email.go +++ b/server/middleware/email.go @@ -49,7 +49,7 @@ func ErrorToEmail() gin.HandlerFunc { if status != 200 { subject := username + "" + record.Ip + "调用了" + record.Path + "报错了" if err := utils.ErrorToEmail(subject, str); err != nil { - global.GVA_LOG.Error("ErrorToEmail Failed, err:", zap.Any("err", err)) + global.GVA_LOG.Error("ErrorToEmail Failed, err:", zap.Error(err)) } } } diff --git a/server/middleware/jwt.go b/server/middleware/jwt.go index 576a3da4be0a640f73b6748df21d006c6f2842fc..749723c440f0eda2b4fc1100bf3697be94599493 100644 --- a/server/middleware/jwt.go +++ b/server/middleware/jwt.go @@ -58,7 +58,7 @@ func JWTAuth() gin.HandlerFunc { if global.GVA_CONFIG.System.UseMultipoint { err, RedisJwtToken := jwtService.GetRedisJWT(newClaims.Username) if err != nil { - global.GVA_LOG.Error("get redis jwt failed", zap.Any("err", err)) + global.GVA_LOG.Error("get redis jwt failed", zap.Error(err)) } else { // 当之前的取成功时才进行拉黑操作 _ = jwtService.JsonInBlacklist(system.JwtBlacklist{Jwt: RedisJwtToken}) } diff --git a/server/middleware/operation.go b/server/middleware/operation.go index 9e4b6c1803b37cd7ed22db8855ea8b52d4d1b722..05c85e34885c7b51a3fe8fe0abbf6a8914c5d572 100644 --- a/server/middleware/operation.go +++ b/server/middleware/operation.go @@ -25,7 +25,7 @@ func OperationRecord() gin.HandlerFunc { var err error body, err = ioutil.ReadAll(c.Request.Body) if err != nil { - global.GVA_LOG.Error("read body from request error:", zap.Any("err", err)) + global.GVA_LOG.Error("read body from request error:", zap.Error(err)) } else { c.Request.Body = ioutil.NopCloser(bytes.NewBuffer(body)) } @@ -69,7 +69,7 @@ func OperationRecord() gin.HandlerFunc { record.Resp = writer.body.String() if err := operationRecordService.CreateSysOperationRecord(record); err != nil { - global.GVA_LOG.Error("create operation record error:", zap.Any("err", err)) + global.GVA_LOG.Error("create operation record error:", zap.Error(err)) } } } diff --git a/server/plugin/email/api/sys_email.go b/server/plugin/email/api/sys_email.go index 03e13afa84beb4beb7869acdd4bed7f1e6ed1fce..2e8560d6714a7bed600b14356eef40f0fce81395 100644 --- a/server/plugin/email/api/sys_email.go +++ b/server/plugin/email/api/sys_email.go @@ -20,7 +20,7 @@ type EmailApi struct { // @Router /email/emailTest [post] func (s *EmailApi) EmailTest(c *gin.Context) { if err := service.ServiceGroupApp.EmailTest(); err != nil { - global.GVA_LOG.Error("发送失败!", zap.Any("err", err)) + global.GVA_LOG.Error("发送失败!", zap.Error(err)) response.FailWithMessage("发送失败", c) } else { response.OkWithData("发送成功", c) @@ -38,7 +38,7 @@ func (s *EmailApi) SendEmail(c *gin.Context) { var email email_response.Email _ = c.ShouldBindJSON(&email) if err := service.ServiceGroupApp.SendEmail(email.To, email.Subject, email.Body); err != nil { - global.GVA_LOG.Error("发送失败!", zap.Any("err", err)) + global.GVA_LOG.Error("发送失败!", zap.Error(err)) response.FailWithMessage("发送失败", c) } else { response.OkWithData("发送成功", c) diff --git a/server/resource/template/server/api.go.tpl b/server/resource/template/server/api.go.tpl index 42dcad6f77e041990a17477d1d334388d0b27b3e..2fb0689cc0b1cbc5d941aacde4a51f8c40720e3a 100644 --- a/server/resource/template/server/api.go.tpl +++ b/server/resource/template/server/api.go.tpl @@ -30,7 +30,7 @@ func ({{.Abbreviation}}Api *{{.StructName}}Api) Create{{.StructName}}(c *gin.Con var {{.Abbreviation}} autocode.{{.StructName}} _ = c.ShouldBindJSON(&{{.Abbreviation}}) if err := {{.Abbreviation}}Service.Create{{.StructName}}({{.Abbreviation}}); err != nil { - global.GVA_LOG.Error("创建失败!", zap.Any("err", err)) + global.GVA_LOG.Error("创建失败!", zap.Error(err)) response.FailWithMessage("创建失败", c) } else { response.OkWithMessage("创建成功", c) @@ -50,7 +50,7 @@ func ({{.Abbreviation}}Api *{{.StructName}}Api) Delete{{.StructName}}(c *gin.Con var {{.Abbreviation}} autocode.{{.StructName}} _ = c.ShouldBindJSON(&{{.Abbreviation}}) if err := {{.Abbreviation}}Service.Delete{{.StructName}}({{.Abbreviation}}); err != nil { - global.GVA_LOG.Error("删除失败!", zap.Any("err", err)) + global.GVA_LOG.Error("删除失败!", zap.Error(err)) response.FailWithMessage("删除失败", c) } else { response.OkWithMessage("删除成功", c) @@ -70,7 +70,7 @@ func ({{.Abbreviation}}Api *{{.StructName}}Api) Delete{{.StructName}}ByIds(c *gi var IDS request.IdsReq _ = c.ShouldBindJSON(&IDS) if err := {{.Abbreviation}}Service.Delete{{.StructName}}ByIds(IDS); err != nil { - global.GVA_LOG.Error("批量删除失败!", zap.Any("err", err)) + global.GVA_LOG.Error("批量删除失败!", zap.Error(err)) response.FailWithMessage("批量删除失败", c) } else { response.OkWithMessage("批量删除成功", c) @@ -90,7 +90,7 @@ func ({{.Abbreviation}}Api *{{.StructName}}Api) Update{{.StructName}}(c *gin.Con var {{.Abbreviation}} autocode.{{.StructName}} _ = c.ShouldBindJSON(&{{.Abbreviation}}) if err := {{.Abbreviation}}Service.Update{{.StructName}}({{.Abbreviation}}); err != nil { - global.GVA_LOG.Error("更新失败!", zap.Any("err", err)) + global.GVA_LOG.Error("更新失败!", zap.Error(err)) response.FailWithMessage("更新失败", c) } else { response.OkWithMessage("更新成功", c) @@ -110,7 +110,7 @@ func ({{.Abbreviation}}Api *{{.StructName}}Api) Find{{.StructName}}(c *gin.Conte var {{.Abbreviation}} autocode.{{.StructName}} _ = c.ShouldBindQuery(&{{.Abbreviation}}) if err, re{{.Abbreviation}} := {{.Abbreviation}}Service.Get{{.StructName}}({{.Abbreviation}}.ID); err != nil { - global.GVA_LOG.Error("查询失败!", zap.Any("err", err)) + global.GVA_LOG.Error("查询失败!", zap.Error(err)) response.FailWithMessage("查询失败", c) } else { response.OkWithData(gin.H{"re{{.Abbreviation}}": re{{.Abbreviation}}}, c) @@ -130,7 +130,7 @@ func ({{.Abbreviation}}Api *{{.StructName}}Api) Get{{.StructName}}List(c *gin.Co var pageInfo autocodeReq.{{.StructName}}Search _ = c.ShouldBindQuery(&pageInfo) if err, list, total := {{.Abbreviation}}Service.Get{{.StructName}}InfoList(pageInfo); err != nil { - global.GVA_LOG.Error("获取失败!", zap.Any("err", err)) + global.GVA_LOG.Error("获取失败!", zap.Error(err)) response.FailWithMessage("获取失败", c) } else { response.OkWithDetailed(response.PageResult{