早安,管理员, 请开始您一天的工作吧!
-- - 今日晴,0℃ - 10℃,天气寒冷,注意添加衣物。 -
-From fb4dba161619c043b8acd4971eac5433eb6630ab Mon Sep 17 00:00:00 2001
From: songzhibin97 <718428482@qq.com>
Date: Sun, 22 Nov 2020 18:05:51 +0800
Subject: [PATCH 1/6] pointChange
---
server/api/v1/exa_customer.go | 4 ++--
server/api/v1/exa_file_upload_download.go | 6 +++---
server/api/v1/exa_simple_uploader.go | 4 ++--
server/api/v1/sys_api.go | 8 ++++----
server/api/v1/sys_authority.go | 14 +++++++-------
server/api/v1/sys_auto_code.go | 2 +-
server/api/v1/sys_dictionary.go | 6 +++---
server/api/v1/sys_dictionary_detail.go | 6 +++---
server/api/v1/sys_jwt_blacklist.go | 2 +-
server/api/v1/sys_menu.go | 8 ++++----
server/api/v1/sys_operation_record.go | 8 ++++----
server/api/v1/sys_system.go | 4 ++--
server/api/v1/sys_user.go | 12 ++++++------
server/api/v1/sys_work_flow.go | 2 +-
server/middleware/jwt.go | 4 ++--
server/middleware/operation.go | 6 +++---
server/service/exa_customer.go | 10 +++++-----
server/service/exa_file_upload_download.go | 14 +++++++-------
server/service/exa_simple_uploader.go | 4 ++--
server/service/jwt_black_list.go | 4 ++--
server/service/sys_api.go | 14 +++++++-------
server/service/sys_authority.go | 12 ++++++------
server/service/sys_auto_code.go | 7 +++----
server/service/sys_base_menu.go | 2 +-
server/service/sys_dictionary.go | 10 +++++-----
server/service/sys_dictionary_detail.go | 10 +++++-----
server/service/sys_menu.go | 4 ++--
server/service/sys_operation_record.go | 12 ++++++------
server/service/sys_system.go | 9 ++++-----
server/service/sys_user.go | 13 ++++++-------
server/service/sys_workflow.go | 4 ++--
31 files changed, 111 insertions(+), 114 deletions(-)
diff --git a/server/api/v1/exa_customer.go b/server/api/v1/exa_customer.go
index c6721ba2..0e0272b0 100644
--- a/server/api/v1/exa_customer.go
+++ b/server/api/v1/exa_customer.go
@@ -29,7 +29,7 @@ func CreateExaCustomer(c *gin.Context) {
}
customer.SysUserID = getUserID(c)
customer.SysUserAuthorityID = getUserAuthorityId(c)
- if err := service.CreateExaCustomer(customer); err != nil {
+ if err := service.CreateExaCustomer(&customer); err != nil {
global.GVA_LOG.Error("创建失败!", zap.Any("err", err))
response.FailWithMessage("创建失败", c)
} else {
@@ -52,7 +52,7 @@ func DeleteExaCustomer(c *gin.Context) {
response.FailWithMessage(err.Error(), c)
return
}
- if err := service.DeleteExaCustomer(customer); err != nil {
+ if err := service.DeleteExaCustomer(&customer); err != nil {
global.GVA_LOG.Error("删除失败!", zap.Any("err", err))
response.FailWithMessage("删除失败", c)
} else {
diff --git a/server/api/v1/exa_file_upload_download.go b/server/api/v1/exa_file_upload_download.go
index 3e563e4c..b038ae9c 100644
--- a/server/api/v1/exa_file_upload_download.go
+++ b/server/api/v1/exa_file_upload_download.go
@@ -46,7 +46,7 @@ func UploadFile(c *gin.Context) {
func DeleteFile(c *gin.Context) {
var file model.ExaFileUploadAndDownload
_ = c.ShouldBindJSON(&file)
- if err := service.DeleteFile(file); err != nil {
+ if err := service.DeleteFile(&file); err != nil {
global.GVA_LOG.Error("删除失败!", zap.Any("err", err))
response.FailWithMessage("删除失败", c)
return
@@ -65,7 +65,7 @@ func DeleteFile(c *gin.Context) {
func GetFileList(c *gin.Context) {
var pageInfo request.PageInfo
_ = c.ShouldBindJSON(&pageInfo)
- err, list, total := service.GetFileRecordInfoList(pageInfo)
+ err, list, total := service.GetFileRecordInfoList(&pageInfo)
if err != nil {
global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
response.FailWithMessage("获取失败", c)
@@ -75,6 +75,6 @@ func GetFileList(c *gin.Context) {
Total: total,
Page: pageInfo.Page,
PageSize: pageInfo.PageSize,
- },"获取成功", c)
+ }, "获取成功", c)
}
}
diff --git a/server/api/v1/exa_simple_uploader.go b/server/api/v1/exa_simple_uploader.go
index 984d0b79..7120f619 100644
--- a/server/api/v1/exa_simple_uploader.go
+++ b/server/api/v1/exa_simple_uploader.go
@@ -42,7 +42,7 @@ func SimpleUploaderUpload(c *gin.Context) {
return
}
chunk.CurrentChunkPath = chunkPath
- err = service.SaveChunk(chunk)
+ err = service.SaveChunk(&chunk)
if err != nil {
global.GVA_LOG.Error("切片创建失败!", zap.Any("err", err))
response.FailWithMessage("切片创建失败", c)
@@ -69,7 +69,7 @@ func CheckFileMd5(c *gin.Context) {
response.OkWithDetailed(gin.H{
"chunks": chunks,
"isDone": isDone,
- },"查询成功", c)
+ }, "查询成功", c)
}
}
diff --git a/server/api/v1/sys_api.go b/server/api/v1/sys_api.go
index aa5d3bd3..b906d100 100644
--- a/server/api/v1/sys_api.go
+++ b/server/api/v1/sys_api.go
@@ -26,7 +26,7 @@ func CreateApi(c *gin.Context) {
response.FailWithMessage(err.Error(), c)
return
}
- if err := service.CreateApi(api); err != nil {
+ if err := service.CreateApi(&api); err != nil {
global.GVA_LOG.Error("创建失败!", zap.Any("err", err))
response.FailWithMessage("创建失败", c)
} else {
@@ -49,7 +49,7 @@ func DeleteApi(c *gin.Context) {
response.FailWithMessage(err.Error(), c)
return
}
- if err := service.DeleteApi(api); err != nil {
+ if err := service.DeleteApi(&api); err != nil {
global.GVA_LOG.Error("删除失败!", zap.Any("err", err))
response.FailWithMessage("删除失败", c)
} else {
@@ -72,7 +72,7 @@ func GetApiList(c *gin.Context) {
response.FailWithMessage(err.Error(), c)
return
}
- if err, list, total := service.GetAPIInfoList(pageInfo.SysApi, pageInfo.PageInfo, pageInfo.OrderKey, pageInfo.Desc); err != nil {
+ if err, list, total := service.GetAPIInfoList(&pageInfo.SysApi, &pageInfo.PageInfo, pageInfo.OrderKey, pageInfo.Desc); err != nil {
global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
response.FailWithMessage("获取失败", c)
} else {
@@ -124,7 +124,7 @@ func UpdateApi(c *gin.Context) {
response.FailWithMessage(err.Error(), c)
return
}
- if err := service.UpdateApi(api); err != nil {
+ if err := service.UpdateApi(&api); err != nil {
global.GVA_LOG.Error("修改失败!", zap.Any("err", err))
response.FailWithMessage("修改失败", c)
} else {
diff --git a/server/api/v1/sys_authority.go b/server/api/v1/sys_authority.go
index 4b3f7149..18fb25ce 100644
--- a/server/api/v1/sys_authority.go
+++ b/server/api/v1/sys_authority.go
@@ -26,11 +26,11 @@ func CreateAuthority(c *gin.Context) {
response.FailWithMessage(err.Error(), c)
return
}
- if err, authBack := service.CreateAuthority(authority); err != nil {
+ if err, authBack := service.CreateAuthority(&authority); err != nil {
global.GVA_LOG.Error("创建失败!", zap.Any("err", err))
response.FailWithMessage("创建失败"+err.Error(), c)
} else {
- response.OkWithDetailed(response.SysAuthorityResponse{Authority: authBack}, "创建成功", c)
+ response.OkWithDetailed(response.SysAuthorityResponse{Authority: *authBack}, "创建成功", c)
}
}
@@ -53,7 +53,7 @@ func CopyAuthority(c *gin.Context) {
response.FailWithMessage(err.Error(), c)
return
}
- if err, authBack := service.CopyAuthority(copyInfo); err != nil {
+ if err, authBack := service.CopyAuthority(©Info); err != nil {
global.GVA_LOG.Error("拷贝失败!", zap.Any("err", err))
response.FailWithMessage("拷贝失败"+err.Error(), c)
} else {
@@ -99,11 +99,11 @@ func UpdateAuthority(c *gin.Context) {
response.FailWithMessage(err.Error(), c)
return
}
- if err, authority := service.UpdateAuthority(auth); err != nil {
+ if err, authority := service.UpdateAuthority(&auth); err != nil {
global.GVA_LOG.Error("更新失败!", zap.Any("err", err))
response.FailWithMessage("更新失败"+err.Error(), c)
} else {
- response.OkWithDetailed(response.SysAuthorityResponse{Authority: authority}, "更新成功", c)
+ response.OkWithDetailed(response.SysAuthorityResponse{Authority: *authority}, "更新成功", c)
}
}
@@ -122,7 +122,7 @@ func GetAuthorityList(c *gin.Context) {
response.FailWithMessage(err.Error(), c)
return
}
- if err, list, total := service.GetAuthorityInfoList(pageInfo); err != nil {
+ if err, list, total := service.GetAuthorityInfoList(&pageInfo); err != nil {
global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
response.FailWithMessage("获取失败"+err.Error(), c)
} else {
@@ -150,7 +150,7 @@ func SetDataAuthority(c *gin.Context) {
response.FailWithMessage(err.Error(), c)
return
}
- if err := service.SetDataAuthority(auth); err != nil {
+ if err := service.SetDataAuthority(&auth); err != nil {
global.GVA_LOG.Error("设置失败!", zap.Any("err", err))
response.FailWithMessage("设置失败"+err.Error(), c)
} else {
diff --git a/server/api/v1/sys_auto_code.go b/server/api/v1/sys_auto_code.go
index 679f4be3..c831b890 100644
--- a/server/api/v1/sys_auto_code.go
+++ b/server/api/v1/sys_auto_code.go
@@ -37,7 +37,7 @@ func CreateTemp(c *gin.Context) {
return
}
}
- err := service.CreateTemp(a)
+ err := service.CreateTemp(&a)
if err != nil {
if errors.Is(err, model.AutoMoveErr) {
c.Writer.Header().Add("success", "false")
diff --git a/server/api/v1/sys_dictionary.go b/server/api/v1/sys_dictionary.go
index 23477de2..0b2c090a 100644
--- a/server/api/v1/sys_dictionary.go
+++ b/server/api/v1/sys_dictionary.go
@@ -22,7 +22,7 @@ import (
func CreateSysDictionary(c *gin.Context) {
var dictionary model.SysDictionary
_ = c.ShouldBindJSON(&dictionary)
- if err := service.CreateSysDictionary(dictionary); err != nil {
+ if err := service.CreateSysDictionary(&dictionary); err != nil {
global.GVA_LOG.Error("创建失败!", zap.Any("err", err))
response.FailWithMessage("创建失败", c)
} else {
@@ -41,7 +41,7 @@ func CreateSysDictionary(c *gin.Context) {
func DeleteSysDictionary(c *gin.Context) {
var dictionary model.SysDictionary
_ = c.ShouldBindJSON(&dictionary)
- if err := service.DeleteSysDictionary(dictionary); err != nil {
+ if err := service.DeleteSysDictionary(&dictionary); err != nil {
global.GVA_LOG.Error("删除失败!", zap.Any("err", err))
response.FailWithMessage("删除失败", c)
} else {
@@ -102,7 +102,7 @@ func GetSysDictionaryList(c *gin.Context) {
response.FailWithMessage(err.Error(), c)
return
}
- if err, list, total := service.GetSysDictionaryInfoList(pageInfo); err != nil {
+ if err, list, total := service.GetSysDictionaryInfoList(&pageInfo); err != nil {
global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
response.FailWithMessage("获取失败", c)
} else {
diff --git a/server/api/v1/sys_dictionary_detail.go b/server/api/v1/sys_dictionary_detail.go
index a1c2f3f7..b83b6bdc 100644
--- a/server/api/v1/sys_dictionary_detail.go
+++ b/server/api/v1/sys_dictionary_detail.go
@@ -22,7 +22,7 @@ import (
func CreateSysDictionaryDetail(c *gin.Context) {
var detail model.SysDictionaryDetail
_ = c.ShouldBindJSON(&detail)
- if err := service.CreateSysDictionaryDetail(detail); err != nil {
+ if err := service.CreateSysDictionaryDetail(&detail); err != nil {
global.GVA_LOG.Error("创建失败!", zap.Any("err", err))
response.FailWithMessage("创建失败", c)
} else {
@@ -41,7 +41,7 @@ func CreateSysDictionaryDetail(c *gin.Context) {
func DeleteSysDictionaryDetail(c *gin.Context) {
var detail model.SysDictionaryDetail
_ = c.ShouldBindJSON(&detail)
- if err := service.DeleteSysDictionaryDetail(detail); err != nil {
+ if err := service.DeleteSysDictionaryDetail(&detail); err != nil {
global.GVA_LOG.Error("删除失败!", zap.Any("err", err))
response.FailWithMessage("删除失败", c)
} else {
@@ -102,7 +102,7 @@ func FindSysDictionaryDetail(c *gin.Context) {
func GetSysDictionaryDetailList(c *gin.Context) {
var pageInfo request.SysDictionaryDetailSearch
_ = c.ShouldBindQuery(&pageInfo)
- if err, list, total := service.GetSysDictionaryDetailInfoList(pageInfo); err != nil {
+ if err, list, total := service.GetSysDictionaryDetailInfoList(&pageInfo); err != nil {
global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
response.FailWithMessage("获取失败", c)
} else {
diff --git a/server/api/v1/sys_jwt_blacklist.go b/server/api/v1/sys_jwt_blacklist.go
index 62d7ff94..86637164 100644
--- a/server/api/v1/sys_jwt_blacklist.go
+++ b/server/api/v1/sys_jwt_blacklist.go
@@ -19,7 +19,7 @@ import (
func JsonInBlacklist(c *gin.Context) {
token := c.Request.Header.Get("x-token")
jwt := model.JwtBlacklist{Jwt: token}
- if err := service.JsonInBlacklist(jwt); err != nil {
+ if err := service.JsonInBlacklist(&jwt); err != nil {
global.GVA_LOG.Error("jwt作废失败!", zap.Any("err", err))
response.FailWithMessage("jwt作废失败", c)
} else {
diff --git a/server/api/v1/sys_menu.go b/server/api/v1/sys_menu.go
index 765c61cd..a1409ffe 100644
--- a/server/api/v1/sys_menu.go
+++ b/server/api/v1/sys_menu.go
@@ -108,7 +108,7 @@ func AddBaseMenu(c *gin.Context) {
response.FailWithMessage(err.Error(), c)
return
}
- if err := service.AddBaseMenu(menu); err != nil {
+ if err := service.AddBaseMenu(&menu); err != nil {
global.GVA_LOG.Error("添加失败!", zap.Any("err", err))
response.FailWithMessage("添加失败", c)
@@ -159,7 +159,7 @@ func UpdateBaseMenu(c *gin.Context) {
response.FailWithMessage(err.Error(), c)
return
}
- if err := service.UpdateBaseMenu(menu); err != nil {
+ if err := service.UpdateBaseMenu(&menu); err != nil {
global.GVA_LOG.Error("更新失败!", zap.Any("err", err))
response.FailWithMessage("更新失败", c)
} else {
@@ -214,6 +214,6 @@ func GetMenuList(c *gin.Context) {
Total: total,
Page: pageInfo.Page,
PageSize: pageInfo.PageSize,
- },"获取成功", c)
+ }, "获取成功", c)
}
-}
\ No newline at end of file
+}
diff --git a/server/api/v1/sys_operation_record.go b/server/api/v1/sys_operation_record.go
index d3d5745e..9c1ba9b0 100644
--- a/server/api/v1/sys_operation_record.go
+++ b/server/api/v1/sys_operation_record.go
@@ -22,7 +22,7 @@ import (
func CreateSysOperationRecord(c *gin.Context) {
var sysOperationRecord model.SysOperationRecord
_ = c.ShouldBindJSON(&sysOperationRecord)
- if err := service.CreateSysOperationRecord(sysOperationRecord); err != nil {
+ if err := service.CreateSysOperationRecord(&sysOperationRecord); err != nil {
global.GVA_LOG.Error("创建失败!", zap.Any("err", err))
response.FailWithMessage("创建失败", c)
} else {
@@ -41,7 +41,7 @@ func CreateSysOperationRecord(c *gin.Context) {
func DeleteSysOperationRecord(c *gin.Context) {
var sysOperationRecord model.SysOperationRecord
_ = c.ShouldBindJSON(&sysOperationRecord)
- if err := service.DeleteSysOperationRecord(sysOperationRecord); err != nil {
+ if err := service.DeleteSysOperationRecord(&sysOperationRecord); err != nil {
global.GVA_LOG.Error("删除失败!", zap.Any("err", err))
response.FailWithMessage("删除失败", c)
} else {
@@ -60,7 +60,7 @@ func DeleteSysOperationRecord(c *gin.Context) {
func DeleteSysOperationRecordByIds(c *gin.Context) {
var IDS request.IdsReq
_ = c.ShouldBindJSON(&IDS)
- if err := service.DeleteSysOperationRecordByIds(IDS); err != nil {
+ if err := service.DeleteSysOperationRecordByIds(&IDS); err != nil {
global.GVA_LOG.Error("批量删除失败!", zap.Any("err", err))
response.FailWithMessage("批量删除失败", c)
} else {
@@ -102,7 +102,7 @@ func FindSysOperationRecord(c *gin.Context) {
func GetSysOperationRecordList(c *gin.Context) {
var pageInfo request.SysOperationRecordSearch
_ = c.ShouldBindQuery(&pageInfo)
- if err, list, total := service.GetSysOperationRecordInfoList(pageInfo); err != nil {
+ if err, list, total := service.GetSysOperationRecordInfoList(&pageInfo); err != nil {
global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
response.FailWithMessage("获取失败", c)
} else {
diff --git a/server/api/v1/sys_system.go b/server/api/v1/sys_system.go
index d6a0fe82..e5ec62a5 100644
--- a/server/api/v1/sys_system.go
+++ b/server/api/v1/sys_system.go
@@ -34,7 +34,7 @@ func GetSystemConfig(c *gin.Context) {
func SetSystemConfig(c *gin.Context) {
var sys model.System
_ = c.ShouldBindJSON(&sys)
- if err := service.SetSystemConfig(sys); err != nil {
+ if err := service.SetSystemConfig(&sys); err != nil {
global.GVA_LOG.Error("设置失败!", zap.Any("err", err))
response.FailWithMessage("设置失败", c)
} else {
@@ -53,7 +53,7 @@ func SetSystemConfig(c *gin.Context) {
func ReloadSystem(c *gin.Context) {
var sys model.System
_ = c.ShouldBindJSON(&sys)
- if err := service.SetSystemConfig(sys); err != nil {
+ if err := service.SetSystemConfig(&sys); err != nil {
global.GVA_LOG.Error("重启系统失败!", zap.Any("err", err))
response.FailWithMessage("重启系统失败", c)
} else {
diff --git a/server/api/v1/sys_user.go b/server/api/v1/sys_user.go
index c018af9e..c57d8369 100644
--- a/server/api/v1/sys_user.go
+++ b/server/api/v1/sys_user.go
@@ -88,7 +88,7 @@ func tokenNext(c *gin.Context, user model.SysUser) {
} else {
var blackJWT model.JwtBlacklist
blackJWT.Jwt = jwtStr
- if err := service.JsonInBlacklist(blackJWT); err != nil {
+ if err := service.JsonInBlacklist(&blackJWT); err != nil {
response.FailWithMessage("jwt作废失败", c)
return
}
@@ -118,12 +118,12 @@ func Register(c *gin.Context) {
return
}
user := &model.SysUser{Username: R.Username, NickName: R.NickName, Password: R.Password, HeaderImg: R.HeaderImg, AuthorityId: R.AuthorityId}
- err, userReturn := service.Register(*user)
+ err, userReturn := service.Register(user)
if err != nil {
global.GVA_LOG.Error("注册失败", zap.Any("err", err))
- response.FailWithDetailed(response.SysUserResponse{User: userReturn}, "注册失败", c)
+ response.FailWithDetailed(response.SysUserResponse{User: *userReturn}, "注册失败", c)
} else {
- response.OkWithDetailed(response.SysUserResponse{User: userReturn}, "注册成功", c)
+ response.OkWithDetailed(response.SysUserResponse{User: *userReturn}, "注册成功", c)
}
}
@@ -165,7 +165,7 @@ func GetUserList(c *gin.Context) {
response.FailWithMessage(err.Error(), c)
return
}
- if err, list, total := service.GetUserInfoList(pageInfo); err != nil {
+ if err, list, total := service.GetUserInfoList(&pageInfo); err != nil {
global.GVA_LOG.Error("获取失败", zap.Any("err", err))
response.FailWithMessage("获取失败", c)
} else {
@@ -244,7 +244,7 @@ func SetUserInfo(c *gin.Context) {
response.FailWithMessage(err.Error(), c)
return
}
- if err, ReqUser := service.SetUserInfo(user); err != nil {
+ if err, ReqUser := service.SetUserInfo(&user); err != nil {
global.GVA_LOG.Error("设置失败", zap.Any("err", err))
response.FailWithMessage("设置失败", c)
} else {
diff --git a/server/api/v1/sys_work_flow.go b/server/api/v1/sys_work_flow.go
index 7758b102..fd1aacc2 100644
--- a/server/api/v1/sys_work_flow.go
+++ b/server/api/v1/sys_work_flow.go
@@ -23,7 +23,7 @@ func CreateWorkFlow(c *gin.Context) {
response.FailWithMessage(err.Error(), c)
return
}
- if err := service.Create(wk); err != nil {
+ if err := service.Create(&wk); err != nil {
global.GVA_LOG.Error("注册失败!", zap.Any("err", err))
response.FailWithMessage("注册失败", c)
} else {
diff --git a/server/middleware/jwt.go b/server/middleware/jwt.go
index 5db9a9e2..b66a5341 100644
--- a/server/middleware/jwt.go
+++ b/server/middleware/jwt.go
@@ -42,7 +42,7 @@ func JWTAuth() gin.HandlerFunc {
return
}
if err, _ = service.FindUserByUuid(claims.UUID.String()); err != nil {
- _ = service.JsonInBlacklist(model.JwtBlacklist{Jwt: token})
+ _ = service.JsonInBlacklist(&model.JwtBlacklist{Jwt: token})
response.FailWithDetailed(gin.H{"reload": true}, err.Error(), c)
c.Abort()
}
@@ -57,7 +57,7 @@ func JWTAuth() gin.HandlerFunc {
if err != nil {
global.GVA_LOG.Error("get redis jwt failed", zap.Any("err", err))
} else { // 当之前的取成功时才进行拉黑操作
- _ = service.JsonInBlacklist(model.JwtBlacklist{Jwt: RedisJwtToken})
+ _ = service.JsonInBlacklist(&model.JwtBlacklist{Jwt: RedisJwtToken})
}
// 无论如何都要记录当前的活跃状态
_ = service.SetRedisJWT(newToken, newClaims.Username)
diff --git a/server/middleware/operation.go b/server/middleware/operation.go
index 41bcb883..c1a9775d 100644
--- a/server/middleware/operation.go
+++ b/server/middleware/operation.go
@@ -31,7 +31,7 @@ func OperationRecord() gin.HandlerFunc {
if claims, ok := c.Get("claims"); ok {
waitUse := claims.(*request.CustomClaims)
userId = int(waitUse.ID)
- }else {
+ } else {
id, err := strconv.Atoi(c.Request.Header.Get("x-user-id"))
if err != nil {
userId = 0
@@ -47,7 +47,7 @@ func OperationRecord() gin.HandlerFunc {
UserID: userId,
}
values := c.Request.Header.Values("content-type")
- if len(values) >0 && strings.Contains(values[0], "boundary") {
+ if len(values) > 0 && strings.Contains(values[0], "boundary") {
record.Body = "file"
}
writer := responseBodyWriter{
@@ -65,7 +65,7 @@ func OperationRecord() gin.HandlerFunc {
record.Latency = latency
record.Resp = writer.body.String()
- if err := service.CreateSysOperationRecord(record); err != nil {
+ if err := service.CreateSysOperationRecord(&record); err != nil {
global.GVA_LOG.Error("create operation record error:", zap.Any("err", err))
}
}
diff --git a/server/service/exa_customer.go b/server/service/exa_customer.go
index f9d1d68f..e7220efb 100644
--- a/server/service/exa_customer.go
+++ b/server/service/exa_customer.go
@@ -12,8 +12,8 @@ import (
//@param: e model.ExaCustomer
//@return: err error
-func CreateExaCustomer(e model.ExaCustomer) (err error) {
- err = global.GVA_DB.Create(&e).Error
+func CreateExaCustomer(e *model.ExaCustomer) (err error) {
+ err = global.GVA_DB.Create(e).Error
return err
}
@@ -23,8 +23,8 @@ func CreateExaCustomer(e model.ExaCustomer) (err error) {
//@param: e model.ExaCustomer
//@return: err error
-func DeleteExaCustomer(e model.ExaCustomer) (err error) {
- err = global.GVA_DB.Delete(e).Error
+func DeleteExaCustomer(e *model.ExaCustomer) (err error) {
+ err = global.GVA_DB.Delete(*e).Error
return err
}
@@ -62,7 +62,7 @@ func GetCustomerInfoList(sysUserAuthorityID string, info request.PageInfo) (err
db := global.GVA_DB.Model(&model.ExaCustomer{})
var a model.SysAuthority
a.AuthorityId = sysUserAuthorityID
- err, auth := GetAuthorityInfo(a)
+ err, auth := GetAuthorityInfo(&a)
var dataId []string
for _, v := range auth.DataAuthorityId {
dataId = append(dataId, v.AuthorityId)
diff --git a/server/service/exa_file_upload_download.go b/server/service/exa_file_upload_download.go
index 36b521b3..0c0daada 100644
--- a/server/service/exa_file_upload_download.go
+++ b/server/service/exa_file_upload_download.go
@@ -16,8 +16,8 @@ import (
//@param: file model.ExaFileUploadAndDownload
//@return: error
-func Upload(file model.ExaFileUploadAndDownload) error {
- return global.GVA_DB.Create(&file).Error
+func Upload(file *model.ExaFileUploadAndDownload) error {
+ return global.GVA_DB.Create(file).Error
}
//@author: [piexlmax](https://github.com/piexlmax)
@@ -38,14 +38,14 @@ func FindFile(id uint) (error, model.ExaFileUploadAndDownload) {
//@param: file model.ExaFileUploadAndDownload
//@return: err error
-func DeleteFile(file model.ExaFileUploadAndDownload) (err error) {
+func DeleteFile(file *model.ExaFileUploadAndDownload) (err error) {
var fileFromDb model.ExaFileUploadAndDownload
err, fileFromDb = FindFile(file.ID)
oss := upload.NewOss()
- if err = oss.DeleteFile(fileFromDb.Key); err != nil{
+ if err = oss.DeleteFile(fileFromDb.Key); err != nil {
return errors.New("文件删除失败")
}
- err = global.GVA_DB.Where("id = ?", file.ID).Unscoped().Delete(file).Error
+ err = global.GVA_DB.Where("id = ?", file.ID).Unscoped().Delete(*file).Error
return err
}
@@ -55,7 +55,7 @@ func DeleteFile(file model.ExaFileUploadAndDownload) (err error) {
//@param: info request.PageInfo
//@return: err error, list interface{}, total int64
-func GetFileRecordInfoList(info request.PageInfo) (err error, list interface{}, total int64) {
+func GetFileRecordInfoList(info *request.PageInfo) (err error, list interface{}, total int64) {
limit := info.PageSize
offset := info.PageSize * (info.Page - 1)
db := global.GVA_DB
@@ -85,7 +85,7 @@ func UploadFile(header *multipart.FileHeader, noSave string) (err error, file mo
Tag: s[len(s)-1],
Key: key,
}
- return Upload(f), f
+ return Upload(&f), f
}
return
}
diff --git a/server/service/exa_simple_uploader.go b/server/service/exa_simple_uploader.go
index 5ce57507..73405877 100644
--- a/server/service/exa_simple_uploader.go
+++ b/server/service/exa_simple_uploader.go
@@ -17,8 +17,8 @@ import (
//@param: uploader model.ExaSimpleUploader
//@return: err error
-func SaveChunk(uploader model.ExaSimpleUploader) (err error) {
- return global.GVA_DB.Create(uploader).Error
+func SaveChunk(uploader *model.ExaSimpleUploader) (err error) {
+ return global.GVA_DB.Create(*uploader).Error
}
//@author: [piexlmax](https://github.com/piexlmax)
diff --git a/server/service/jwt_black_list.go b/server/service/jwt_black_list.go
index 6704060d..3bac04ad 100644
--- a/server/service/jwt_black_list.go
+++ b/server/service/jwt_black_list.go
@@ -14,8 +14,8 @@ import (
//@param: jwtList model.JwtBlacklist
//@return: err error
-func JsonInBlacklist(jwtList model.JwtBlacklist) (err error) {
- err = global.GVA_DB.Create(&jwtList).Error
+func JsonInBlacklist(jwtList *model.JwtBlacklist) (err error) {
+ err = global.GVA_DB.Create(jwtList).Error
return
}
diff --git a/server/service/sys_api.go b/server/service/sys_api.go
index 40df486d..874471c4 100644
--- a/server/service/sys_api.go
+++ b/server/service/sys_api.go
@@ -14,11 +14,11 @@ import (
//@param: api model.SysApi
//@return: err error
-func CreateApi(api model.SysApi) (err error) {
+func CreateApi(api *model.SysApi) (err error) {
if !errors.Is(global.GVA_DB.Where("path = ? AND method = ?", api.Path, api.Method).First(&model.SysApi{}).Error, gorm.ErrRecordNotFound) {
return errors.New("存在相同api")
}
- return global.GVA_DB.Create(&api).Error
+ return global.GVA_DB.Create(api).Error
}
//@author: [piexlmax](https://github.com/piexlmax)
@@ -27,8 +27,8 @@ func CreateApi(api model.SysApi) (err error) {
//@param: api model.SysApi
//@return: err error
-func DeleteApi(api model.SysApi) (err error) {
- err = global.GVA_DB.Delete(api).Error
+func DeleteApi(api *model.SysApi) (err error) {
+ err = global.GVA_DB.Delete(*api).Error
ClearCasbin(1, api.Path, api.Method)
return err
}
@@ -39,7 +39,7 @@ func DeleteApi(api model.SysApi) (err error) {
//@param: api model.SysApi, info request.PageInfo, order string, desc bool
//@return: err error
-func GetAPIInfoList(api model.SysApi, info request.PageInfo, order string, desc bool) (err error, list interface{}, total int64) {
+func GetAPIInfoList(api *model.SysApi, info *request.PageInfo, order string, desc bool) (err error, list interface{}, total int64) {
limit := info.PageSize
offset := info.PageSize * (info.Page - 1)
db := global.GVA_DB.Model(&model.SysApi{})
@@ -109,7 +109,7 @@ func GetApiById(id float64) (err error, api model.SysApi) {
//@param: api model.SysApi
//@return: err error
-func UpdateApi(api model.SysApi) (err error) {
+func UpdateApi(api *model.SysApi) (err error) {
var oldA model.SysApi
err = global.GVA_DB.Where("id = ?", api.ID).First(&oldA).Error
if oldA.Path != api.Path || oldA.Method != api.Method {
@@ -124,7 +124,7 @@ func UpdateApi(api model.SysApi) (err error) {
if err != nil {
return err
} else {
- err = global.GVA_DB.Save(&api).Error
+ err = global.GVA_DB.Save(api).Error
}
}
return err
diff --git a/server/service/sys_authority.go b/server/service/sys_authority.go
index 8967c213..629e4f0c 100644
--- a/server/service/sys_authority.go
+++ b/server/service/sys_authority.go
@@ -16,7 +16,7 @@ import (
//@param: auth model.SysAuthority
//@return: err error, authority model.SysAuthority
-func CreateAuthority(auth model.SysAuthority) (err error, authority model.SysAuthority) {
+func CreateAuthority(auth *model.SysAuthority) (err error, authority *model.SysAuthority) {
var authorityBox model.SysAuthority
if !errors.Is(global.GVA_DB.Where("authority_id = ?", auth.AuthorityId).First(&authorityBox).Error, gorm.ErrRecordNotFound) {
return errors.New("存在相同角色id"), auth
@@ -31,7 +31,7 @@ func CreateAuthority(auth model.SysAuthority) (err error, authority model.SysAut
//@param: copyInfo response.SysAuthorityCopyResponse
//@return: err error, authority model.SysAuthority
-func CopyAuthority(copyInfo response.SysAuthorityCopyResponse) (err error, authority model.SysAuthority) {
+func CopyAuthority(copyInfo *response.SysAuthorityCopyResponse) (err error, authority model.SysAuthority) {
var authorityBox model.SysAuthority
if !errors.Is(global.GVA_DB.Where("authority_id = ?", copyInfo.Authority.AuthorityId).First(&authorityBox).Error, gorm.ErrRecordNotFound) {
return errors.New("存在相同角色id"), authority
@@ -61,7 +61,7 @@ func CopyAuthority(copyInfo response.SysAuthorityCopyResponse) (err error, autho
//@param: auth model.SysAuthority
//@return:err error, authority model.SysAuthority
-func UpdateAuthority(auth model.SysAuthority) (err error, authority model.SysAuthority) {
+func UpdateAuthority(auth *model.SysAuthority) (err error, authority *model.SysAuthority) {
err = global.GVA_DB.Where("authority_id = ?", auth.AuthorityId).First(&model.SysAuthority{}).Updates(&auth).Error
return err, auth
}
@@ -97,7 +97,7 @@ func DeleteAuthority(auth *model.SysAuthority) (err error) {
//@param: info request.PageInfo
//@return: err error, list interface{}, total int64
-func GetAuthorityInfoList(info request.PageInfo) (err error, list interface{}, total int64) {
+func GetAuthorityInfoList(info *request.PageInfo) (err error, list interface{}, total int64) {
limit := info.PageSize
offset := info.PageSize * (info.Page - 1)
db := global.GVA_DB
@@ -117,7 +117,7 @@ func GetAuthorityInfoList(info request.PageInfo) (err error, list interface{}, t
//@param: auth model.SysAuthority
//@return: err error, sa model.SysAuthority
-func GetAuthorityInfo(auth model.SysAuthority) (err error, sa model.SysAuthority) {
+func GetAuthorityInfo(auth *model.SysAuthority) (err error, sa model.SysAuthority) {
err = global.GVA_DB.Preload("DataAuthorityId").Where("authority_id = ?", auth.AuthorityId).First(&sa).Error
return err, sa
}
@@ -128,7 +128,7 @@ func GetAuthorityInfo(auth model.SysAuthority) (err error, sa model.SysAuthority
//@param: auth model.SysAuthority
//@return:error
-func SetDataAuthority(auth model.SysAuthority) error {
+func SetDataAuthority(auth *model.SysAuthority) error {
var s model.SysAuthority
global.GVA_DB.Preload("DataAuthorityId").First(&s, "authority_id = ?", auth.AuthorityId)
err := global.GVA_DB.Model(&s).Association("DataAuthorityId").Replace(&auth.DataAuthorityId)
diff --git a/server/service/sys_auto_code.go b/server/service/sys_auto_code.go
index afeca1eb..17701d42 100644
--- a/server/service/sys_auto_code.go
+++ b/server/service/sys_auto_code.go
@@ -28,7 +28,7 @@ type tplData struct {
//@param: model.AutoCodeStruct
//@return: error
-func CreateTemp(autoCode model.AutoCodeStruct) (err error) {
+func CreateTemp(autoCode *model.AutoCodeStruct) (err error) {
basePath := "resource/template"
// 获取 basePath 文件夹下所有tpl文件
tplFileList, err := GetAllTplFile(basePath, nil)
@@ -87,7 +87,7 @@ func CreateTemp(autoCode model.AutoCodeStruct) (err error) {
if err != nil {
return err
}
- if err = value.template.Execute(f, autoCode); err != nil {
+ if err = value.template.Execute(f, *autoCode); err != nil {
return err
}
_ = f.Close()
@@ -209,7 +209,6 @@ func addAutoMoveFile(data *tplData) {
}
}
-
//@author: [piexlmax](https://github.com/piexlmax)
//@author: [SliverHorn](https://github.com/SliverHorn)
//@function: CreateApi
@@ -269,4 +268,4 @@ func AutoCreateApi(a *model.AutoCodeStruct) (err error) {
return nil
})
return err
-}
\ No newline at end of file
+}
diff --git a/server/service/sys_base_menu.go b/server/service/sys_base_menu.go
index 2f7c1889..803ee94c 100644
--- a/server/service/sys_base_menu.go
+++ b/server/service/sys_base_menu.go
@@ -36,7 +36,7 @@ func DeleteBaseMenu(id float64) (err error) {
//@param: menu model.SysBaseMenu
//@return:err error
-func UpdateBaseMenu(menu model.SysBaseMenu) (err error) {
+func UpdateBaseMenu(menu *model.SysBaseMenu) (err error) {
var oldMenu model.SysBaseMenu
upDateMap := make(map[string]interface{})
upDateMap["keep_alive"] = menu.KeepAlive
diff --git a/server/service/sys_dictionary.go b/server/service/sys_dictionary.go
index 6a0dc0ce..5013c6b7 100644
--- a/server/service/sys_dictionary.go
+++ b/server/service/sys_dictionary.go
@@ -14,11 +14,11 @@ import (
//@param: sysDictionary model.SysDictionary
//@return: err error
-func CreateSysDictionary(sysDictionary model.SysDictionary) (err error) {
+func CreateSysDictionary(sysDictionary *model.SysDictionary) (err error) {
if (!errors.Is(global.GVA_DB.First(&model.SysDictionary{}, "type = ?", sysDictionary.Type).Error, gorm.ErrRecordNotFound)) {
return errors.New("存在相同的type,不允许创建")
}
- err = global.GVA_DB.Create(&sysDictionary).Error
+ err = global.GVA_DB.Create(sysDictionary).Error
return err
}
@@ -28,8 +28,8 @@ func CreateSysDictionary(sysDictionary model.SysDictionary) (err error) {
//@param: sysDictionary model.SysDictionary
//@return: err error
-func DeleteSysDictionary(sysDictionary model.SysDictionary) (err error) {
- err = global.GVA_DB.Delete(sysDictionary).Delete(&sysDictionary.SysDictionaryDetails).Error
+func DeleteSysDictionary(sysDictionary *model.SysDictionary) (err error) {
+ err = global.GVA_DB.Delete(*sysDictionary).Delete(sysDictionary.SysDictionaryDetails).Error
return err
}
@@ -78,7 +78,7 @@ func GetSysDictionary(Type string, Id uint) (err error, sysDictionary model.SysD
//@param: info request.SysDictionarySearch
//@return: err error, list interface{}, total int64
-func GetSysDictionaryInfoList(info request.SysDictionarySearch) (err error, list interface{}, total int64) {
+func GetSysDictionaryInfoList(info *request.SysDictionarySearch) (err error, list interface{}, total int64) {
limit := info.PageSize
offset := info.PageSize * (info.Page - 1)
// 创建db
diff --git a/server/service/sys_dictionary_detail.go b/server/service/sys_dictionary_detail.go
index 5d5cd7fd..2653fa51 100644
--- a/server/service/sys_dictionary_detail.go
+++ b/server/service/sys_dictionary_detail.go
@@ -12,8 +12,8 @@ import (
//@param: sysDictionaryDetail model.SysDictionaryDetail
//@return: err error
-func CreateSysDictionaryDetail(sysDictionaryDetail model.SysDictionaryDetail) (err error) {
- err = global.GVA_DB.Create(&sysDictionaryDetail).Error
+func CreateSysDictionaryDetail(sysDictionaryDetail *model.SysDictionaryDetail) (err error) {
+ err = global.GVA_DB.Create(sysDictionaryDetail).Error
return err
}
@@ -23,8 +23,8 @@ func CreateSysDictionaryDetail(sysDictionaryDetail model.SysDictionaryDetail) (e
//@param: sysDictionaryDetail model.SysDictionaryDetail
//@return: err error
-func DeleteSysDictionaryDetail(sysDictionaryDetail model.SysDictionaryDetail) (err error) {
- err = global.GVA_DB.Delete(sysDictionaryDetail).Error
+func DeleteSysDictionaryDetail(sysDictionaryDetail *model.SysDictionaryDetail) (err error) {
+ err = global.GVA_DB.Delete(*sysDictionaryDetail).Error
return err
}
@@ -56,7 +56,7 @@ func GetSysDictionaryDetail(id uint) (err error, sysDictionaryDetail model.SysDi
//@param: info request.SysDictionaryDetailSearch
//@return: err error
-func GetSysDictionaryDetailInfoList(info request.SysDictionaryDetailSearch) (err error, list interface{}, total int64) {
+func GetSysDictionaryDetailInfoList(info *request.SysDictionaryDetailSearch) (err error, list interface{}, total int64) {
limit := info.PageSize
offset := info.PageSize * (info.Page - 1)
// 创建db
diff --git a/server/service/sys_menu.go b/server/service/sys_menu.go
index d83ce6e4..d7b5b882 100644
--- a/server/service/sys_menu.go
+++ b/server/service/sys_menu.go
@@ -89,11 +89,11 @@ func getBaseChildrenList(menu *model.SysBaseMenu, treeMap map[string][]model.Sys
//@param: menu model.SysBaseMenu
//@return: err error
-func AddBaseMenu(menu model.SysBaseMenu) (err error) {
+func AddBaseMenu(menu *model.SysBaseMenu) (err error) {
if !errors.Is(global.GVA_DB.Where("name = ?", menu.Name).First(&model.SysBaseMenu{}).Error, gorm.ErrRecordNotFound) {
err = errors.New("存在重复name,请修改name")
}
- err = global.GVA_DB.Create(&menu).Error
+ err = global.GVA_DB.Create(menu).Error
return err
}
diff --git a/server/service/sys_operation_record.go b/server/service/sys_operation_record.go
index 2e3b53da..73a5a556 100644
--- a/server/service/sys_operation_record.go
+++ b/server/service/sys_operation_record.go
@@ -12,8 +12,8 @@ import (
//@param: sysOperationRecord model.SysOperationRecord
//@return: err error
-func CreateSysOperationRecord(sysOperationRecord model.SysOperationRecord) (err error) {
- err = global.GVA_DB.Create(&sysOperationRecord).Error
+func CreateSysOperationRecord(sysOperationRecord *model.SysOperationRecord) (err error) {
+ err = global.GVA_DB.Create(sysOperationRecord).Error
return err
}
@@ -24,7 +24,7 @@ func CreateSysOperationRecord(sysOperationRecord model.SysOperationRecord) (err
//@param: ids request.IdsReq
//@return: err error
-func DeleteSysOperationRecordByIds(ids request.IdsReq) (err error) {
+func DeleteSysOperationRecordByIds(ids *request.IdsReq) (err error) {
err = global.GVA_DB.Delete(&[]model.SysOperationRecord{}, "id in (?)", ids.Ids).Error
return err
}
@@ -35,8 +35,8 @@ func DeleteSysOperationRecordByIds(ids request.IdsReq) (err error) {
//@param: sysOperationRecord model.SysOperationRecord
//@return: err error
-func DeleteSysOperationRecord(sysOperationRecord model.SysOperationRecord) (err error) {
- err = global.GVA_DB.Delete(sysOperationRecord).Error
+func DeleteSysOperationRecord(sysOperationRecord *model.SysOperationRecord) (err error) {
+ err = global.GVA_DB.Delete(*sysOperationRecord).Error
return err
}
@@ -58,7 +58,7 @@ func GetSysOperationRecord(id uint) (err error, sysOperationRecord model.SysOper
//@param: info request.SysOperationRecordSearch
//@return: err error, list interface{}, total int64
-func GetSysOperationRecordInfoList(info request.SysOperationRecordSearch) (err error, list interface{}, total int64) {
+func GetSysOperationRecordInfoList(info *request.SysOperationRecordSearch) (err error, list interface{}, total int64) {
limit := info.PageSize
offset := info.PageSize * (info.Page - 1)
// 创建db
diff --git a/server/service/sys_system.go b/server/service/sys_system.go
index 239a6b25..0f8b0adf 100644
--- a/server/service/sys_system.go
+++ b/server/service/sys_system.go
@@ -24,7 +24,7 @@ func GetSystemConfig() (err error, conf config.Server) {
//@param: system model.System
//@return: err error
-func SetSystemConfig(system model.System) (err error) {
+func SetSystemConfig(system *model.System) (err error) {
cs := utils.StructToMap(system.Config)
for k, v := range cs {
global.GVA_VP.Set(k, v)
@@ -41,19 +41,18 @@ func SetSystemConfig(system model.System) (err error) {
func GetServerInfo() (server *utils.Server, err error) {
var s utils.Server
s.Os = utils.InitOS()
- if s.Cpu, err = utils.InitCPU(); err != nil{
+ if s.Cpu, err = utils.InitCPU(); err != nil {
global.GVA_LOG.Error("func utils.InitCPU() Failed!", zap.String("err", err.Error()))
return &s, err
}
- if s.Rrm, err = utils.InitRAM(); err != nil{
+ if s.Rrm, err = utils.InitRAM(); err != nil {
global.GVA_LOG.Error("func utils.InitRAM() Failed!", zap.String("err", err.Error()))
return &s, err
}
- if s.Disk, err = utils.InitDisk(); err != nil{
+ if s.Disk, err = utils.InitDisk(); err != nil {
global.GVA_LOG.Error("func utils.InitDisk() Failed!", zap.String("err", err.Error()))
return &s, err
}
return &s, nil
}
-
diff --git a/server/service/sys_user.go b/server/service/sys_user.go
index d6a0477c..c8cfd038 100644
--- a/server/service/sys_user.go
+++ b/server/service/sys_user.go
@@ -10,14 +10,13 @@ import (
"gorm.io/gorm"
)
-
//@author: [piexlmax](https://github.com/piexlmax)
//@function: Register
//@description: 用户注册
//@param: u model.SysUser
//@return: err error, userInter model.SysUser
-func Register(u model.SysUser) (err error, userInter model.SysUser) {
+func Register(u *model.SysUser) (err error, userInter *model.SysUser) {
var user model.SysUser
if !errors.Is(global.GVA_DB.Where("username = ?", u.Username).First(&user).Error, gorm.ErrRecordNotFound) { // 判断用户名是否注册
return errors.New("用户名已注册"), userInter
@@ -25,7 +24,7 @@ func Register(u model.SysUser) (err error, userInter model.SysUser) {
// 否则 附加uuid 密码md5简单加密 注册
u.Password = utils.MD5V([]byte(u.Password))
u.UUID = uuid.NewV4()
- err = global.GVA_DB.Create(&u).Error
+ err = global.GVA_DB.Create(u).Error
return err, u
}
@@ -61,7 +60,7 @@ func ChangePassword(u *model.SysUser, newPassword string) (err error, userInter
//@param: info request.PageInfo
//@return: err error, list interface{}, total int64
-func GetUserInfoList(info request.PageInfo) (err error, list interface{}, total int64) {
+func GetUserInfoList(info *request.PageInfo) (err error, list interface{}, total int64) {
limit := info.PageSize
offset := info.PageSize * (info.Page - 1)
db := global.GVA_DB.Model(&model.SysUser{})
@@ -100,7 +99,7 @@ func DeleteUser(id float64) (err error) {
//@param: reqUser model.SysUser
//@return: err error, user model.SysUser
-func SetUserInfo(reqUser model.SysUser) (err error, user model.SysUser) {
+func SetUserInfo(reqUser *model.SysUser) (err error, user *model.SysUser) {
err = global.GVA_DB.Updates(&reqUser).Error
return err, reqUser
}
@@ -125,8 +124,8 @@ func FindUserById(id int) (err error, user *model.SysUser) {
func FindUserByUuid(uuid string) (err error, user *model.SysUser) {
var u model.SysUser
- if err = global.GVA_DB.Where("`uuid` = ?", uuid).First(&u).Error; err != nil{
+ if err = global.GVA_DB.Where("`uuid` = ?", uuid).First(&u).Error; err != nil {
return errors.New("用户不存在"), &u
}
return nil, &u
-}
\ No newline at end of file
+}
diff --git a/server/service/sys_workflow.go b/server/service/sys_workflow.go
index 03c7f71d..8d4f88ac 100644
--- a/server/service/sys_workflow.go
+++ b/server/service/sys_workflow.go
@@ -11,7 +11,7 @@ import (
//@param: wk model.SysWorkflow
//@return: error
-func Create(wk model.SysWorkflow) error {
- err := global.GVA_DB.Create(&wk).Error
+func Create(wk *model.SysWorkflow) error {
+ err := global.GVA_DB.Create(wk).Error
return err
}
From bf975af6762263fed9ea3eb12f35e9bd6697db69 Mon Sep 17 00:00:00 2001
From: songzhibin97 <718428482@qq.com>
Date: Mon, 23 Nov 2020 12:02:18 +0800
Subject: [PATCH 2/6] Revert "pointChange"
This reverts commit fb4dba161619c043b8acd4971eac5433eb6630ab.
---
server/api/v1/exa_customer.go | 4 ++--
server/api/v1/exa_file_upload_download.go | 6 +++---
server/api/v1/exa_simple_uploader.go | 4 ++--
server/api/v1/sys_api.go | 8 ++++----
server/api/v1/sys_authority.go | 14 +++++++-------
server/api/v1/sys_auto_code.go | 2 +-
server/api/v1/sys_dictionary.go | 6 +++---
server/api/v1/sys_dictionary_detail.go | 6 +++---
server/api/v1/sys_jwt_blacklist.go | 2 +-
server/api/v1/sys_menu.go | 8 ++++----
server/api/v1/sys_operation_record.go | 8 ++++----
server/api/v1/sys_system.go | 4 ++--
server/api/v1/sys_user.go | 12 ++++++------
server/api/v1/sys_work_flow.go | 2 +-
server/middleware/jwt.go | 4 ++--
server/middleware/operation.go | 6 +++---
server/service/exa_customer.go | 10 +++++-----
server/service/exa_file_upload_download.go | 14 +++++++-------
server/service/exa_simple_uploader.go | 4 ++--
server/service/jwt_black_list.go | 4 ++--
server/service/sys_api.go | 14 +++++++-------
server/service/sys_authority.go | 12 ++++++------
server/service/sys_auto_code.go | 7 ++++---
server/service/sys_base_menu.go | 2 +-
server/service/sys_dictionary.go | 10 +++++-----
server/service/sys_dictionary_detail.go | 10 +++++-----
server/service/sys_menu.go | 4 ++--
server/service/sys_operation_record.go | 12 ++++++------
server/service/sys_system.go | 9 +++++----
server/service/sys_user.go | 13 +++++++------
server/service/sys_workflow.go | 4 ++--
31 files changed, 114 insertions(+), 111 deletions(-)
diff --git a/server/api/v1/exa_customer.go b/server/api/v1/exa_customer.go
index 0e0272b0..c6721ba2 100644
--- a/server/api/v1/exa_customer.go
+++ b/server/api/v1/exa_customer.go
@@ -29,7 +29,7 @@ func CreateExaCustomer(c *gin.Context) {
}
customer.SysUserID = getUserID(c)
customer.SysUserAuthorityID = getUserAuthorityId(c)
- if err := service.CreateExaCustomer(&customer); err != nil {
+ if err := service.CreateExaCustomer(customer); err != nil {
global.GVA_LOG.Error("创建失败!", zap.Any("err", err))
response.FailWithMessage("创建失败", c)
} else {
@@ -52,7 +52,7 @@ func DeleteExaCustomer(c *gin.Context) {
response.FailWithMessage(err.Error(), c)
return
}
- if err := service.DeleteExaCustomer(&customer); err != nil {
+ if err := service.DeleteExaCustomer(customer); err != nil {
global.GVA_LOG.Error("删除失败!", zap.Any("err", err))
response.FailWithMessage("删除失败", c)
} else {
diff --git a/server/api/v1/exa_file_upload_download.go b/server/api/v1/exa_file_upload_download.go
index b038ae9c..3e563e4c 100644
--- a/server/api/v1/exa_file_upload_download.go
+++ b/server/api/v1/exa_file_upload_download.go
@@ -46,7 +46,7 @@ func UploadFile(c *gin.Context) {
func DeleteFile(c *gin.Context) {
var file model.ExaFileUploadAndDownload
_ = c.ShouldBindJSON(&file)
- if err := service.DeleteFile(&file); err != nil {
+ if err := service.DeleteFile(file); err != nil {
global.GVA_LOG.Error("删除失败!", zap.Any("err", err))
response.FailWithMessage("删除失败", c)
return
@@ -65,7 +65,7 @@ func DeleteFile(c *gin.Context) {
func GetFileList(c *gin.Context) {
var pageInfo request.PageInfo
_ = c.ShouldBindJSON(&pageInfo)
- err, list, total := service.GetFileRecordInfoList(&pageInfo)
+ err, list, total := service.GetFileRecordInfoList(pageInfo)
if err != nil {
global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
response.FailWithMessage("获取失败", c)
@@ -75,6 +75,6 @@ func GetFileList(c *gin.Context) {
Total: total,
Page: pageInfo.Page,
PageSize: pageInfo.PageSize,
- }, "获取成功", c)
+ },"获取成功", c)
}
}
diff --git a/server/api/v1/exa_simple_uploader.go b/server/api/v1/exa_simple_uploader.go
index 7120f619..984d0b79 100644
--- a/server/api/v1/exa_simple_uploader.go
+++ b/server/api/v1/exa_simple_uploader.go
@@ -42,7 +42,7 @@ func SimpleUploaderUpload(c *gin.Context) {
return
}
chunk.CurrentChunkPath = chunkPath
- err = service.SaveChunk(&chunk)
+ err = service.SaveChunk(chunk)
if err != nil {
global.GVA_LOG.Error("切片创建失败!", zap.Any("err", err))
response.FailWithMessage("切片创建失败", c)
@@ -69,7 +69,7 @@ func CheckFileMd5(c *gin.Context) {
response.OkWithDetailed(gin.H{
"chunks": chunks,
"isDone": isDone,
- }, "查询成功", c)
+ },"查询成功", c)
}
}
diff --git a/server/api/v1/sys_api.go b/server/api/v1/sys_api.go
index b906d100..aa5d3bd3 100644
--- a/server/api/v1/sys_api.go
+++ b/server/api/v1/sys_api.go
@@ -26,7 +26,7 @@ func CreateApi(c *gin.Context) {
response.FailWithMessage(err.Error(), c)
return
}
- if err := service.CreateApi(&api); err != nil {
+ if err := service.CreateApi(api); err != nil {
global.GVA_LOG.Error("创建失败!", zap.Any("err", err))
response.FailWithMessage("创建失败", c)
} else {
@@ -49,7 +49,7 @@ func DeleteApi(c *gin.Context) {
response.FailWithMessage(err.Error(), c)
return
}
- if err := service.DeleteApi(&api); err != nil {
+ if err := service.DeleteApi(api); err != nil {
global.GVA_LOG.Error("删除失败!", zap.Any("err", err))
response.FailWithMessage("删除失败", c)
} else {
@@ -72,7 +72,7 @@ func GetApiList(c *gin.Context) {
response.FailWithMessage(err.Error(), c)
return
}
- if err, list, total := service.GetAPIInfoList(&pageInfo.SysApi, &pageInfo.PageInfo, pageInfo.OrderKey, pageInfo.Desc); err != nil {
+ if err, list, total := service.GetAPIInfoList(pageInfo.SysApi, pageInfo.PageInfo, pageInfo.OrderKey, pageInfo.Desc); err != nil {
global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
response.FailWithMessage("获取失败", c)
} else {
@@ -124,7 +124,7 @@ func UpdateApi(c *gin.Context) {
response.FailWithMessage(err.Error(), c)
return
}
- if err := service.UpdateApi(&api); err != nil {
+ if err := service.UpdateApi(api); err != nil {
global.GVA_LOG.Error("修改失败!", zap.Any("err", err))
response.FailWithMessage("修改失败", c)
} else {
diff --git a/server/api/v1/sys_authority.go b/server/api/v1/sys_authority.go
index 18fb25ce..4b3f7149 100644
--- a/server/api/v1/sys_authority.go
+++ b/server/api/v1/sys_authority.go
@@ -26,11 +26,11 @@ func CreateAuthority(c *gin.Context) {
response.FailWithMessage(err.Error(), c)
return
}
- if err, authBack := service.CreateAuthority(&authority); err != nil {
+ if err, authBack := service.CreateAuthority(authority); err != nil {
global.GVA_LOG.Error("创建失败!", zap.Any("err", err))
response.FailWithMessage("创建失败"+err.Error(), c)
} else {
- response.OkWithDetailed(response.SysAuthorityResponse{Authority: *authBack}, "创建成功", c)
+ response.OkWithDetailed(response.SysAuthorityResponse{Authority: authBack}, "创建成功", c)
}
}
@@ -53,7 +53,7 @@ func CopyAuthority(c *gin.Context) {
response.FailWithMessage(err.Error(), c)
return
}
- if err, authBack := service.CopyAuthority(©Info); err != nil {
+ if err, authBack := service.CopyAuthority(copyInfo); err != nil {
global.GVA_LOG.Error("拷贝失败!", zap.Any("err", err))
response.FailWithMessage("拷贝失败"+err.Error(), c)
} else {
@@ -99,11 +99,11 @@ func UpdateAuthority(c *gin.Context) {
response.FailWithMessage(err.Error(), c)
return
}
- if err, authority := service.UpdateAuthority(&auth); err != nil {
+ if err, authority := service.UpdateAuthority(auth); err != nil {
global.GVA_LOG.Error("更新失败!", zap.Any("err", err))
response.FailWithMessage("更新失败"+err.Error(), c)
} else {
- response.OkWithDetailed(response.SysAuthorityResponse{Authority: *authority}, "更新成功", c)
+ response.OkWithDetailed(response.SysAuthorityResponse{Authority: authority}, "更新成功", c)
}
}
@@ -122,7 +122,7 @@ func GetAuthorityList(c *gin.Context) {
response.FailWithMessage(err.Error(), c)
return
}
- if err, list, total := service.GetAuthorityInfoList(&pageInfo); err != nil {
+ if err, list, total := service.GetAuthorityInfoList(pageInfo); err != nil {
global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
response.FailWithMessage("获取失败"+err.Error(), c)
} else {
@@ -150,7 +150,7 @@ func SetDataAuthority(c *gin.Context) {
response.FailWithMessage(err.Error(), c)
return
}
- if err := service.SetDataAuthority(&auth); err != nil {
+ if err := service.SetDataAuthority(auth); err != nil {
global.GVA_LOG.Error("设置失败!", zap.Any("err", err))
response.FailWithMessage("设置失败"+err.Error(), c)
} else {
diff --git a/server/api/v1/sys_auto_code.go b/server/api/v1/sys_auto_code.go
index c831b890..679f4be3 100644
--- a/server/api/v1/sys_auto_code.go
+++ b/server/api/v1/sys_auto_code.go
@@ -37,7 +37,7 @@ func CreateTemp(c *gin.Context) {
return
}
}
- err := service.CreateTemp(&a)
+ err := service.CreateTemp(a)
if err != nil {
if errors.Is(err, model.AutoMoveErr) {
c.Writer.Header().Add("success", "false")
diff --git a/server/api/v1/sys_dictionary.go b/server/api/v1/sys_dictionary.go
index 0b2c090a..23477de2 100644
--- a/server/api/v1/sys_dictionary.go
+++ b/server/api/v1/sys_dictionary.go
@@ -22,7 +22,7 @@ import (
func CreateSysDictionary(c *gin.Context) {
var dictionary model.SysDictionary
_ = c.ShouldBindJSON(&dictionary)
- if err := service.CreateSysDictionary(&dictionary); err != nil {
+ if err := service.CreateSysDictionary(dictionary); err != nil {
global.GVA_LOG.Error("创建失败!", zap.Any("err", err))
response.FailWithMessage("创建失败", c)
} else {
@@ -41,7 +41,7 @@ func CreateSysDictionary(c *gin.Context) {
func DeleteSysDictionary(c *gin.Context) {
var dictionary model.SysDictionary
_ = c.ShouldBindJSON(&dictionary)
- if err := service.DeleteSysDictionary(&dictionary); err != nil {
+ if err := service.DeleteSysDictionary(dictionary); err != nil {
global.GVA_LOG.Error("删除失败!", zap.Any("err", err))
response.FailWithMessage("删除失败", c)
} else {
@@ -102,7 +102,7 @@ func GetSysDictionaryList(c *gin.Context) {
response.FailWithMessage(err.Error(), c)
return
}
- if err, list, total := service.GetSysDictionaryInfoList(&pageInfo); err != nil {
+ if err, list, total := service.GetSysDictionaryInfoList(pageInfo); err != nil {
global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
response.FailWithMessage("获取失败", c)
} else {
diff --git a/server/api/v1/sys_dictionary_detail.go b/server/api/v1/sys_dictionary_detail.go
index b83b6bdc..a1c2f3f7 100644
--- a/server/api/v1/sys_dictionary_detail.go
+++ b/server/api/v1/sys_dictionary_detail.go
@@ -22,7 +22,7 @@ import (
func CreateSysDictionaryDetail(c *gin.Context) {
var detail model.SysDictionaryDetail
_ = c.ShouldBindJSON(&detail)
- if err := service.CreateSysDictionaryDetail(&detail); err != nil {
+ if err := service.CreateSysDictionaryDetail(detail); err != nil {
global.GVA_LOG.Error("创建失败!", zap.Any("err", err))
response.FailWithMessage("创建失败", c)
} else {
@@ -41,7 +41,7 @@ func CreateSysDictionaryDetail(c *gin.Context) {
func DeleteSysDictionaryDetail(c *gin.Context) {
var detail model.SysDictionaryDetail
_ = c.ShouldBindJSON(&detail)
- if err := service.DeleteSysDictionaryDetail(&detail); err != nil {
+ if err := service.DeleteSysDictionaryDetail(detail); err != nil {
global.GVA_LOG.Error("删除失败!", zap.Any("err", err))
response.FailWithMessage("删除失败", c)
} else {
@@ -102,7 +102,7 @@ func FindSysDictionaryDetail(c *gin.Context) {
func GetSysDictionaryDetailList(c *gin.Context) {
var pageInfo request.SysDictionaryDetailSearch
_ = c.ShouldBindQuery(&pageInfo)
- if err, list, total := service.GetSysDictionaryDetailInfoList(&pageInfo); err != nil {
+ if err, list, total := service.GetSysDictionaryDetailInfoList(pageInfo); err != nil {
global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
response.FailWithMessage("获取失败", c)
} else {
diff --git a/server/api/v1/sys_jwt_blacklist.go b/server/api/v1/sys_jwt_blacklist.go
index 86637164..62d7ff94 100644
--- a/server/api/v1/sys_jwt_blacklist.go
+++ b/server/api/v1/sys_jwt_blacklist.go
@@ -19,7 +19,7 @@ import (
func JsonInBlacklist(c *gin.Context) {
token := c.Request.Header.Get("x-token")
jwt := model.JwtBlacklist{Jwt: token}
- if err := service.JsonInBlacklist(&jwt); err != nil {
+ if err := service.JsonInBlacklist(jwt); err != nil {
global.GVA_LOG.Error("jwt作废失败!", zap.Any("err", err))
response.FailWithMessage("jwt作废失败", c)
} else {
diff --git a/server/api/v1/sys_menu.go b/server/api/v1/sys_menu.go
index a1409ffe..765c61cd 100644
--- a/server/api/v1/sys_menu.go
+++ b/server/api/v1/sys_menu.go
@@ -108,7 +108,7 @@ func AddBaseMenu(c *gin.Context) {
response.FailWithMessage(err.Error(), c)
return
}
- if err := service.AddBaseMenu(&menu); err != nil {
+ if err := service.AddBaseMenu(menu); err != nil {
global.GVA_LOG.Error("添加失败!", zap.Any("err", err))
response.FailWithMessage("添加失败", c)
@@ -159,7 +159,7 @@ func UpdateBaseMenu(c *gin.Context) {
response.FailWithMessage(err.Error(), c)
return
}
- if err := service.UpdateBaseMenu(&menu); err != nil {
+ if err := service.UpdateBaseMenu(menu); err != nil {
global.GVA_LOG.Error("更新失败!", zap.Any("err", err))
response.FailWithMessage("更新失败", c)
} else {
@@ -214,6 +214,6 @@ func GetMenuList(c *gin.Context) {
Total: total,
Page: pageInfo.Page,
PageSize: pageInfo.PageSize,
- }, "获取成功", c)
+ },"获取成功", c)
}
-}
+}
\ No newline at end of file
diff --git a/server/api/v1/sys_operation_record.go b/server/api/v1/sys_operation_record.go
index 9c1ba9b0..d3d5745e 100644
--- a/server/api/v1/sys_operation_record.go
+++ b/server/api/v1/sys_operation_record.go
@@ -22,7 +22,7 @@ import (
func CreateSysOperationRecord(c *gin.Context) {
var sysOperationRecord model.SysOperationRecord
_ = c.ShouldBindJSON(&sysOperationRecord)
- if err := service.CreateSysOperationRecord(&sysOperationRecord); err != nil {
+ if err := service.CreateSysOperationRecord(sysOperationRecord); err != nil {
global.GVA_LOG.Error("创建失败!", zap.Any("err", err))
response.FailWithMessage("创建失败", c)
} else {
@@ -41,7 +41,7 @@ func CreateSysOperationRecord(c *gin.Context) {
func DeleteSysOperationRecord(c *gin.Context) {
var sysOperationRecord model.SysOperationRecord
_ = c.ShouldBindJSON(&sysOperationRecord)
- if err := service.DeleteSysOperationRecord(&sysOperationRecord); err != nil {
+ if err := service.DeleteSysOperationRecord(sysOperationRecord); err != nil {
global.GVA_LOG.Error("删除失败!", zap.Any("err", err))
response.FailWithMessage("删除失败", c)
} else {
@@ -60,7 +60,7 @@ func DeleteSysOperationRecord(c *gin.Context) {
func DeleteSysOperationRecordByIds(c *gin.Context) {
var IDS request.IdsReq
_ = c.ShouldBindJSON(&IDS)
- if err := service.DeleteSysOperationRecordByIds(&IDS); err != nil {
+ if err := service.DeleteSysOperationRecordByIds(IDS); err != nil {
global.GVA_LOG.Error("批量删除失败!", zap.Any("err", err))
response.FailWithMessage("批量删除失败", c)
} else {
@@ -102,7 +102,7 @@ func FindSysOperationRecord(c *gin.Context) {
func GetSysOperationRecordList(c *gin.Context) {
var pageInfo request.SysOperationRecordSearch
_ = c.ShouldBindQuery(&pageInfo)
- if err, list, total := service.GetSysOperationRecordInfoList(&pageInfo); err != nil {
+ if err, list, total := service.GetSysOperationRecordInfoList(pageInfo); err != nil {
global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
response.FailWithMessage("获取失败", c)
} else {
diff --git a/server/api/v1/sys_system.go b/server/api/v1/sys_system.go
index e5ec62a5..d6a0fe82 100644
--- a/server/api/v1/sys_system.go
+++ b/server/api/v1/sys_system.go
@@ -34,7 +34,7 @@ func GetSystemConfig(c *gin.Context) {
func SetSystemConfig(c *gin.Context) {
var sys model.System
_ = c.ShouldBindJSON(&sys)
- if err := service.SetSystemConfig(&sys); err != nil {
+ if err := service.SetSystemConfig(sys); err != nil {
global.GVA_LOG.Error("设置失败!", zap.Any("err", err))
response.FailWithMessage("设置失败", c)
} else {
@@ -53,7 +53,7 @@ func SetSystemConfig(c *gin.Context) {
func ReloadSystem(c *gin.Context) {
var sys model.System
_ = c.ShouldBindJSON(&sys)
- if err := service.SetSystemConfig(&sys); err != nil {
+ if err := service.SetSystemConfig(sys); err != nil {
global.GVA_LOG.Error("重启系统失败!", zap.Any("err", err))
response.FailWithMessage("重启系统失败", c)
} else {
diff --git a/server/api/v1/sys_user.go b/server/api/v1/sys_user.go
index c57d8369..c018af9e 100644
--- a/server/api/v1/sys_user.go
+++ b/server/api/v1/sys_user.go
@@ -88,7 +88,7 @@ func tokenNext(c *gin.Context, user model.SysUser) {
} else {
var blackJWT model.JwtBlacklist
blackJWT.Jwt = jwtStr
- if err := service.JsonInBlacklist(&blackJWT); err != nil {
+ if err := service.JsonInBlacklist(blackJWT); err != nil {
response.FailWithMessage("jwt作废失败", c)
return
}
@@ -118,12 +118,12 @@ func Register(c *gin.Context) {
return
}
user := &model.SysUser{Username: R.Username, NickName: R.NickName, Password: R.Password, HeaderImg: R.HeaderImg, AuthorityId: R.AuthorityId}
- err, userReturn := service.Register(user)
+ err, userReturn := service.Register(*user)
if err != nil {
global.GVA_LOG.Error("注册失败", zap.Any("err", err))
- response.FailWithDetailed(response.SysUserResponse{User: *userReturn}, "注册失败", c)
+ response.FailWithDetailed(response.SysUserResponse{User: userReturn}, "注册失败", c)
} else {
- response.OkWithDetailed(response.SysUserResponse{User: *userReturn}, "注册成功", c)
+ response.OkWithDetailed(response.SysUserResponse{User: userReturn}, "注册成功", c)
}
}
@@ -165,7 +165,7 @@ func GetUserList(c *gin.Context) {
response.FailWithMessage(err.Error(), c)
return
}
- if err, list, total := service.GetUserInfoList(&pageInfo); err != nil {
+ if err, list, total := service.GetUserInfoList(pageInfo); err != nil {
global.GVA_LOG.Error("获取失败", zap.Any("err", err))
response.FailWithMessage("获取失败", c)
} else {
@@ -244,7 +244,7 @@ func SetUserInfo(c *gin.Context) {
response.FailWithMessage(err.Error(), c)
return
}
- if err, ReqUser := service.SetUserInfo(&user); err != nil {
+ if err, ReqUser := service.SetUserInfo(user); err != nil {
global.GVA_LOG.Error("设置失败", zap.Any("err", err))
response.FailWithMessage("设置失败", c)
} else {
diff --git a/server/api/v1/sys_work_flow.go b/server/api/v1/sys_work_flow.go
index fd1aacc2..7758b102 100644
--- a/server/api/v1/sys_work_flow.go
+++ b/server/api/v1/sys_work_flow.go
@@ -23,7 +23,7 @@ func CreateWorkFlow(c *gin.Context) {
response.FailWithMessage(err.Error(), c)
return
}
- if err := service.Create(&wk); err != nil {
+ if err := service.Create(wk); err != nil {
global.GVA_LOG.Error("注册失败!", zap.Any("err", err))
response.FailWithMessage("注册失败", c)
} else {
diff --git a/server/middleware/jwt.go b/server/middleware/jwt.go
index b66a5341..5db9a9e2 100644
--- a/server/middleware/jwt.go
+++ b/server/middleware/jwt.go
@@ -42,7 +42,7 @@ func JWTAuth() gin.HandlerFunc {
return
}
if err, _ = service.FindUserByUuid(claims.UUID.String()); err != nil {
- _ = service.JsonInBlacklist(&model.JwtBlacklist{Jwt: token})
+ _ = service.JsonInBlacklist(model.JwtBlacklist{Jwt: token})
response.FailWithDetailed(gin.H{"reload": true}, err.Error(), c)
c.Abort()
}
@@ -57,7 +57,7 @@ func JWTAuth() gin.HandlerFunc {
if err != nil {
global.GVA_LOG.Error("get redis jwt failed", zap.Any("err", err))
} else { // 当之前的取成功时才进行拉黑操作
- _ = service.JsonInBlacklist(&model.JwtBlacklist{Jwt: RedisJwtToken})
+ _ = service.JsonInBlacklist(model.JwtBlacklist{Jwt: RedisJwtToken})
}
// 无论如何都要记录当前的活跃状态
_ = service.SetRedisJWT(newToken, newClaims.Username)
diff --git a/server/middleware/operation.go b/server/middleware/operation.go
index c1a9775d..41bcb883 100644
--- a/server/middleware/operation.go
+++ b/server/middleware/operation.go
@@ -31,7 +31,7 @@ func OperationRecord() gin.HandlerFunc {
if claims, ok := c.Get("claims"); ok {
waitUse := claims.(*request.CustomClaims)
userId = int(waitUse.ID)
- } else {
+ }else {
id, err := strconv.Atoi(c.Request.Header.Get("x-user-id"))
if err != nil {
userId = 0
@@ -47,7 +47,7 @@ func OperationRecord() gin.HandlerFunc {
UserID: userId,
}
values := c.Request.Header.Values("content-type")
- if len(values) > 0 && strings.Contains(values[0], "boundary") {
+ if len(values) >0 && strings.Contains(values[0], "boundary") {
record.Body = "file"
}
writer := responseBodyWriter{
@@ -65,7 +65,7 @@ func OperationRecord() gin.HandlerFunc {
record.Latency = latency
record.Resp = writer.body.String()
- if err := service.CreateSysOperationRecord(&record); err != nil {
+ if err := service.CreateSysOperationRecord(record); err != nil {
global.GVA_LOG.Error("create operation record error:", zap.Any("err", err))
}
}
diff --git a/server/service/exa_customer.go b/server/service/exa_customer.go
index e7220efb..f9d1d68f 100644
--- a/server/service/exa_customer.go
+++ b/server/service/exa_customer.go
@@ -12,8 +12,8 @@ import (
//@param: e model.ExaCustomer
//@return: err error
-func CreateExaCustomer(e *model.ExaCustomer) (err error) {
- err = global.GVA_DB.Create(e).Error
+func CreateExaCustomer(e model.ExaCustomer) (err error) {
+ err = global.GVA_DB.Create(&e).Error
return err
}
@@ -23,8 +23,8 @@ func CreateExaCustomer(e *model.ExaCustomer) (err error) {
//@param: e model.ExaCustomer
//@return: err error
-func DeleteExaCustomer(e *model.ExaCustomer) (err error) {
- err = global.GVA_DB.Delete(*e).Error
+func DeleteExaCustomer(e model.ExaCustomer) (err error) {
+ err = global.GVA_DB.Delete(e).Error
return err
}
@@ -62,7 +62,7 @@ func GetCustomerInfoList(sysUserAuthorityID string, info request.PageInfo) (err
db := global.GVA_DB.Model(&model.ExaCustomer{})
var a model.SysAuthority
a.AuthorityId = sysUserAuthorityID
- err, auth := GetAuthorityInfo(&a)
+ err, auth := GetAuthorityInfo(a)
var dataId []string
for _, v := range auth.DataAuthorityId {
dataId = append(dataId, v.AuthorityId)
diff --git a/server/service/exa_file_upload_download.go b/server/service/exa_file_upload_download.go
index 0c0daada..36b521b3 100644
--- a/server/service/exa_file_upload_download.go
+++ b/server/service/exa_file_upload_download.go
@@ -16,8 +16,8 @@ import (
//@param: file model.ExaFileUploadAndDownload
//@return: error
-func Upload(file *model.ExaFileUploadAndDownload) error {
- return global.GVA_DB.Create(file).Error
+func Upload(file model.ExaFileUploadAndDownload) error {
+ return global.GVA_DB.Create(&file).Error
}
//@author: [piexlmax](https://github.com/piexlmax)
@@ -38,14 +38,14 @@ func FindFile(id uint) (error, model.ExaFileUploadAndDownload) {
//@param: file model.ExaFileUploadAndDownload
//@return: err error
-func DeleteFile(file *model.ExaFileUploadAndDownload) (err error) {
+func DeleteFile(file model.ExaFileUploadAndDownload) (err error) {
var fileFromDb model.ExaFileUploadAndDownload
err, fileFromDb = FindFile(file.ID)
oss := upload.NewOss()
- if err = oss.DeleteFile(fileFromDb.Key); err != nil {
+ if err = oss.DeleteFile(fileFromDb.Key); err != nil{
return errors.New("文件删除失败")
}
- err = global.GVA_DB.Where("id = ?", file.ID).Unscoped().Delete(*file).Error
+ err = global.GVA_DB.Where("id = ?", file.ID).Unscoped().Delete(file).Error
return err
}
@@ -55,7 +55,7 @@ func DeleteFile(file *model.ExaFileUploadAndDownload) (err error) {
//@param: info request.PageInfo
//@return: err error, list interface{}, total int64
-func GetFileRecordInfoList(info *request.PageInfo) (err error, list interface{}, total int64) {
+func GetFileRecordInfoList(info request.PageInfo) (err error, list interface{}, total int64) {
limit := info.PageSize
offset := info.PageSize * (info.Page - 1)
db := global.GVA_DB
@@ -85,7 +85,7 @@ func UploadFile(header *multipart.FileHeader, noSave string) (err error, file mo
Tag: s[len(s)-1],
Key: key,
}
- return Upload(&f), f
+ return Upload(f), f
}
return
}
diff --git a/server/service/exa_simple_uploader.go b/server/service/exa_simple_uploader.go
index 73405877..5ce57507 100644
--- a/server/service/exa_simple_uploader.go
+++ b/server/service/exa_simple_uploader.go
@@ -17,8 +17,8 @@ import (
//@param: uploader model.ExaSimpleUploader
//@return: err error
-func SaveChunk(uploader *model.ExaSimpleUploader) (err error) {
- return global.GVA_DB.Create(*uploader).Error
+func SaveChunk(uploader model.ExaSimpleUploader) (err error) {
+ return global.GVA_DB.Create(uploader).Error
}
//@author: [piexlmax](https://github.com/piexlmax)
diff --git a/server/service/jwt_black_list.go b/server/service/jwt_black_list.go
index 3bac04ad..6704060d 100644
--- a/server/service/jwt_black_list.go
+++ b/server/service/jwt_black_list.go
@@ -14,8 +14,8 @@ import (
//@param: jwtList model.JwtBlacklist
//@return: err error
-func JsonInBlacklist(jwtList *model.JwtBlacklist) (err error) {
- err = global.GVA_DB.Create(jwtList).Error
+func JsonInBlacklist(jwtList model.JwtBlacklist) (err error) {
+ err = global.GVA_DB.Create(&jwtList).Error
return
}
diff --git a/server/service/sys_api.go b/server/service/sys_api.go
index 874471c4..40df486d 100644
--- a/server/service/sys_api.go
+++ b/server/service/sys_api.go
@@ -14,11 +14,11 @@ import (
//@param: api model.SysApi
//@return: err error
-func CreateApi(api *model.SysApi) (err error) {
+func CreateApi(api model.SysApi) (err error) {
if !errors.Is(global.GVA_DB.Where("path = ? AND method = ?", api.Path, api.Method).First(&model.SysApi{}).Error, gorm.ErrRecordNotFound) {
return errors.New("存在相同api")
}
- return global.GVA_DB.Create(api).Error
+ return global.GVA_DB.Create(&api).Error
}
//@author: [piexlmax](https://github.com/piexlmax)
@@ -27,8 +27,8 @@ func CreateApi(api *model.SysApi) (err error) {
//@param: api model.SysApi
//@return: err error
-func DeleteApi(api *model.SysApi) (err error) {
- err = global.GVA_DB.Delete(*api).Error
+func DeleteApi(api model.SysApi) (err error) {
+ err = global.GVA_DB.Delete(api).Error
ClearCasbin(1, api.Path, api.Method)
return err
}
@@ -39,7 +39,7 @@ func DeleteApi(api *model.SysApi) (err error) {
//@param: api model.SysApi, info request.PageInfo, order string, desc bool
//@return: err error
-func GetAPIInfoList(api *model.SysApi, info *request.PageInfo, order string, desc bool) (err error, list interface{}, total int64) {
+func GetAPIInfoList(api model.SysApi, info request.PageInfo, order string, desc bool) (err error, list interface{}, total int64) {
limit := info.PageSize
offset := info.PageSize * (info.Page - 1)
db := global.GVA_DB.Model(&model.SysApi{})
@@ -109,7 +109,7 @@ func GetApiById(id float64) (err error, api model.SysApi) {
//@param: api model.SysApi
//@return: err error
-func UpdateApi(api *model.SysApi) (err error) {
+func UpdateApi(api model.SysApi) (err error) {
var oldA model.SysApi
err = global.GVA_DB.Where("id = ?", api.ID).First(&oldA).Error
if oldA.Path != api.Path || oldA.Method != api.Method {
@@ -124,7 +124,7 @@ func UpdateApi(api *model.SysApi) (err error) {
if err != nil {
return err
} else {
- err = global.GVA_DB.Save(api).Error
+ err = global.GVA_DB.Save(&api).Error
}
}
return err
diff --git a/server/service/sys_authority.go b/server/service/sys_authority.go
index 629e4f0c..8967c213 100644
--- a/server/service/sys_authority.go
+++ b/server/service/sys_authority.go
@@ -16,7 +16,7 @@ import (
//@param: auth model.SysAuthority
//@return: err error, authority model.SysAuthority
-func CreateAuthority(auth *model.SysAuthority) (err error, authority *model.SysAuthority) {
+func CreateAuthority(auth model.SysAuthority) (err error, authority model.SysAuthority) {
var authorityBox model.SysAuthority
if !errors.Is(global.GVA_DB.Where("authority_id = ?", auth.AuthorityId).First(&authorityBox).Error, gorm.ErrRecordNotFound) {
return errors.New("存在相同角色id"), auth
@@ -31,7 +31,7 @@ func CreateAuthority(auth *model.SysAuthority) (err error, authority *model.SysA
//@param: copyInfo response.SysAuthorityCopyResponse
//@return: err error, authority model.SysAuthority
-func CopyAuthority(copyInfo *response.SysAuthorityCopyResponse) (err error, authority model.SysAuthority) {
+func CopyAuthority(copyInfo response.SysAuthorityCopyResponse) (err error, authority model.SysAuthority) {
var authorityBox model.SysAuthority
if !errors.Is(global.GVA_DB.Where("authority_id = ?", copyInfo.Authority.AuthorityId).First(&authorityBox).Error, gorm.ErrRecordNotFound) {
return errors.New("存在相同角色id"), authority
@@ -61,7 +61,7 @@ func CopyAuthority(copyInfo *response.SysAuthorityCopyResponse) (err error, auth
//@param: auth model.SysAuthority
//@return:err error, authority model.SysAuthority
-func UpdateAuthority(auth *model.SysAuthority) (err error, authority *model.SysAuthority) {
+func UpdateAuthority(auth model.SysAuthority) (err error, authority model.SysAuthority) {
err = global.GVA_DB.Where("authority_id = ?", auth.AuthorityId).First(&model.SysAuthority{}).Updates(&auth).Error
return err, auth
}
@@ -97,7 +97,7 @@ func DeleteAuthority(auth *model.SysAuthority) (err error) {
//@param: info request.PageInfo
//@return: err error, list interface{}, total int64
-func GetAuthorityInfoList(info *request.PageInfo) (err error, list interface{}, total int64) {
+func GetAuthorityInfoList(info request.PageInfo) (err error, list interface{}, total int64) {
limit := info.PageSize
offset := info.PageSize * (info.Page - 1)
db := global.GVA_DB
@@ -117,7 +117,7 @@ func GetAuthorityInfoList(info *request.PageInfo) (err error, list interface{},
//@param: auth model.SysAuthority
//@return: err error, sa model.SysAuthority
-func GetAuthorityInfo(auth *model.SysAuthority) (err error, sa model.SysAuthority) {
+func GetAuthorityInfo(auth model.SysAuthority) (err error, sa model.SysAuthority) {
err = global.GVA_DB.Preload("DataAuthorityId").Where("authority_id = ?", auth.AuthorityId).First(&sa).Error
return err, sa
}
@@ -128,7 +128,7 @@ func GetAuthorityInfo(auth *model.SysAuthority) (err error, sa model.SysAuthorit
//@param: auth model.SysAuthority
//@return:error
-func SetDataAuthority(auth *model.SysAuthority) error {
+func SetDataAuthority(auth model.SysAuthority) error {
var s model.SysAuthority
global.GVA_DB.Preload("DataAuthorityId").First(&s, "authority_id = ?", auth.AuthorityId)
err := global.GVA_DB.Model(&s).Association("DataAuthorityId").Replace(&auth.DataAuthorityId)
diff --git a/server/service/sys_auto_code.go b/server/service/sys_auto_code.go
index 17701d42..afeca1eb 100644
--- a/server/service/sys_auto_code.go
+++ b/server/service/sys_auto_code.go
@@ -28,7 +28,7 @@ type tplData struct {
//@param: model.AutoCodeStruct
//@return: error
-func CreateTemp(autoCode *model.AutoCodeStruct) (err error) {
+func CreateTemp(autoCode model.AutoCodeStruct) (err error) {
basePath := "resource/template"
// 获取 basePath 文件夹下所有tpl文件
tplFileList, err := GetAllTplFile(basePath, nil)
@@ -87,7 +87,7 @@ func CreateTemp(autoCode *model.AutoCodeStruct) (err error) {
if err != nil {
return err
}
- if err = value.template.Execute(f, *autoCode); err != nil {
+ if err = value.template.Execute(f, autoCode); err != nil {
return err
}
_ = f.Close()
@@ -209,6 +209,7 @@ func addAutoMoveFile(data *tplData) {
}
}
+
//@author: [piexlmax](https://github.com/piexlmax)
//@author: [SliverHorn](https://github.com/SliverHorn)
//@function: CreateApi
@@ -268,4 +269,4 @@ func AutoCreateApi(a *model.AutoCodeStruct) (err error) {
return nil
})
return err
-}
+}
\ No newline at end of file
diff --git a/server/service/sys_base_menu.go b/server/service/sys_base_menu.go
index 803ee94c..2f7c1889 100644
--- a/server/service/sys_base_menu.go
+++ b/server/service/sys_base_menu.go
@@ -36,7 +36,7 @@ func DeleteBaseMenu(id float64) (err error) {
//@param: menu model.SysBaseMenu
//@return:err error
-func UpdateBaseMenu(menu *model.SysBaseMenu) (err error) {
+func UpdateBaseMenu(menu model.SysBaseMenu) (err error) {
var oldMenu model.SysBaseMenu
upDateMap := make(map[string]interface{})
upDateMap["keep_alive"] = menu.KeepAlive
diff --git a/server/service/sys_dictionary.go b/server/service/sys_dictionary.go
index 5013c6b7..6a0dc0ce 100644
--- a/server/service/sys_dictionary.go
+++ b/server/service/sys_dictionary.go
@@ -14,11 +14,11 @@ import (
//@param: sysDictionary model.SysDictionary
//@return: err error
-func CreateSysDictionary(sysDictionary *model.SysDictionary) (err error) {
+func CreateSysDictionary(sysDictionary model.SysDictionary) (err error) {
if (!errors.Is(global.GVA_DB.First(&model.SysDictionary{}, "type = ?", sysDictionary.Type).Error, gorm.ErrRecordNotFound)) {
return errors.New("存在相同的type,不允许创建")
}
- err = global.GVA_DB.Create(sysDictionary).Error
+ err = global.GVA_DB.Create(&sysDictionary).Error
return err
}
@@ -28,8 +28,8 @@ func CreateSysDictionary(sysDictionary *model.SysDictionary) (err error) {
//@param: sysDictionary model.SysDictionary
//@return: err error
-func DeleteSysDictionary(sysDictionary *model.SysDictionary) (err error) {
- err = global.GVA_DB.Delete(*sysDictionary).Delete(sysDictionary.SysDictionaryDetails).Error
+func DeleteSysDictionary(sysDictionary model.SysDictionary) (err error) {
+ err = global.GVA_DB.Delete(sysDictionary).Delete(&sysDictionary.SysDictionaryDetails).Error
return err
}
@@ -78,7 +78,7 @@ func GetSysDictionary(Type string, Id uint) (err error, sysDictionary model.SysD
//@param: info request.SysDictionarySearch
//@return: err error, list interface{}, total int64
-func GetSysDictionaryInfoList(info *request.SysDictionarySearch) (err error, list interface{}, total int64) {
+func GetSysDictionaryInfoList(info request.SysDictionarySearch) (err error, list interface{}, total int64) {
limit := info.PageSize
offset := info.PageSize * (info.Page - 1)
// 创建db
diff --git a/server/service/sys_dictionary_detail.go b/server/service/sys_dictionary_detail.go
index 2653fa51..5d5cd7fd 100644
--- a/server/service/sys_dictionary_detail.go
+++ b/server/service/sys_dictionary_detail.go
@@ -12,8 +12,8 @@ import (
//@param: sysDictionaryDetail model.SysDictionaryDetail
//@return: err error
-func CreateSysDictionaryDetail(sysDictionaryDetail *model.SysDictionaryDetail) (err error) {
- err = global.GVA_DB.Create(sysDictionaryDetail).Error
+func CreateSysDictionaryDetail(sysDictionaryDetail model.SysDictionaryDetail) (err error) {
+ err = global.GVA_DB.Create(&sysDictionaryDetail).Error
return err
}
@@ -23,8 +23,8 @@ func CreateSysDictionaryDetail(sysDictionaryDetail *model.SysDictionaryDetail) (
//@param: sysDictionaryDetail model.SysDictionaryDetail
//@return: err error
-func DeleteSysDictionaryDetail(sysDictionaryDetail *model.SysDictionaryDetail) (err error) {
- err = global.GVA_DB.Delete(*sysDictionaryDetail).Error
+func DeleteSysDictionaryDetail(sysDictionaryDetail model.SysDictionaryDetail) (err error) {
+ err = global.GVA_DB.Delete(sysDictionaryDetail).Error
return err
}
@@ -56,7 +56,7 @@ func GetSysDictionaryDetail(id uint) (err error, sysDictionaryDetail model.SysDi
//@param: info request.SysDictionaryDetailSearch
//@return: err error
-func GetSysDictionaryDetailInfoList(info *request.SysDictionaryDetailSearch) (err error, list interface{}, total int64) {
+func GetSysDictionaryDetailInfoList(info request.SysDictionaryDetailSearch) (err error, list interface{}, total int64) {
limit := info.PageSize
offset := info.PageSize * (info.Page - 1)
// 创建db
diff --git a/server/service/sys_menu.go b/server/service/sys_menu.go
index d7b5b882..d83ce6e4 100644
--- a/server/service/sys_menu.go
+++ b/server/service/sys_menu.go
@@ -89,11 +89,11 @@ func getBaseChildrenList(menu *model.SysBaseMenu, treeMap map[string][]model.Sys
//@param: menu model.SysBaseMenu
//@return: err error
-func AddBaseMenu(menu *model.SysBaseMenu) (err error) {
+func AddBaseMenu(menu model.SysBaseMenu) (err error) {
if !errors.Is(global.GVA_DB.Where("name = ?", menu.Name).First(&model.SysBaseMenu{}).Error, gorm.ErrRecordNotFound) {
err = errors.New("存在重复name,请修改name")
}
- err = global.GVA_DB.Create(menu).Error
+ err = global.GVA_DB.Create(&menu).Error
return err
}
diff --git a/server/service/sys_operation_record.go b/server/service/sys_operation_record.go
index 73a5a556..2e3b53da 100644
--- a/server/service/sys_operation_record.go
+++ b/server/service/sys_operation_record.go
@@ -12,8 +12,8 @@ import (
//@param: sysOperationRecord model.SysOperationRecord
//@return: err error
-func CreateSysOperationRecord(sysOperationRecord *model.SysOperationRecord) (err error) {
- err = global.GVA_DB.Create(sysOperationRecord).Error
+func CreateSysOperationRecord(sysOperationRecord model.SysOperationRecord) (err error) {
+ err = global.GVA_DB.Create(&sysOperationRecord).Error
return err
}
@@ -24,7 +24,7 @@ func CreateSysOperationRecord(sysOperationRecord *model.SysOperationRecord) (err
//@param: ids request.IdsReq
//@return: err error
-func DeleteSysOperationRecordByIds(ids *request.IdsReq) (err error) {
+func DeleteSysOperationRecordByIds(ids request.IdsReq) (err error) {
err = global.GVA_DB.Delete(&[]model.SysOperationRecord{}, "id in (?)", ids.Ids).Error
return err
}
@@ -35,8 +35,8 @@ func DeleteSysOperationRecordByIds(ids *request.IdsReq) (err error) {
//@param: sysOperationRecord model.SysOperationRecord
//@return: err error
-func DeleteSysOperationRecord(sysOperationRecord *model.SysOperationRecord) (err error) {
- err = global.GVA_DB.Delete(*sysOperationRecord).Error
+func DeleteSysOperationRecord(sysOperationRecord model.SysOperationRecord) (err error) {
+ err = global.GVA_DB.Delete(sysOperationRecord).Error
return err
}
@@ -58,7 +58,7 @@ func GetSysOperationRecord(id uint) (err error, sysOperationRecord model.SysOper
//@param: info request.SysOperationRecordSearch
//@return: err error, list interface{}, total int64
-func GetSysOperationRecordInfoList(info *request.SysOperationRecordSearch) (err error, list interface{}, total int64) {
+func GetSysOperationRecordInfoList(info request.SysOperationRecordSearch) (err error, list interface{}, total int64) {
limit := info.PageSize
offset := info.PageSize * (info.Page - 1)
// 创建db
diff --git a/server/service/sys_system.go b/server/service/sys_system.go
index 0f8b0adf..239a6b25 100644
--- a/server/service/sys_system.go
+++ b/server/service/sys_system.go
@@ -24,7 +24,7 @@ func GetSystemConfig() (err error, conf config.Server) {
//@param: system model.System
//@return: err error
-func SetSystemConfig(system *model.System) (err error) {
+func SetSystemConfig(system model.System) (err error) {
cs := utils.StructToMap(system.Config)
for k, v := range cs {
global.GVA_VP.Set(k, v)
@@ -41,18 +41,19 @@ func SetSystemConfig(system *model.System) (err error) {
func GetServerInfo() (server *utils.Server, err error) {
var s utils.Server
s.Os = utils.InitOS()
- if s.Cpu, err = utils.InitCPU(); err != nil {
+ if s.Cpu, err = utils.InitCPU(); err != nil{
global.GVA_LOG.Error("func utils.InitCPU() Failed!", zap.String("err", err.Error()))
return &s, err
}
- if s.Rrm, err = utils.InitRAM(); err != nil {
+ if s.Rrm, err = utils.InitRAM(); err != nil{
global.GVA_LOG.Error("func utils.InitRAM() Failed!", zap.String("err", err.Error()))
return &s, err
}
- if s.Disk, err = utils.InitDisk(); err != nil {
+ if s.Disk, err = utils.InitDisk(); err != nil{
global.GVA_LOG.Error("func utils.InitDisk() Failed!", zap.String("err", err.Error()))
return &s, err
}
return &s, nil
}
+
diff --git a/server/service/sys_user.go b/server/service/sys_user.go
index c8cfd038..d6a0477c 100644
--- a/server/service/sys_user.go
+++ b/server/service/sys_user.go
@@ -10,13 +10,14 @@ import (
"gorm.io/gorm"
)
+
//@author: [piexlmax](https://github.com/piexlmax)
//@function: Register
//@description: 用户注册
//@param: u model.SysUser
//@return: err error, userInter model.SysUser
-func Register(u *model.SysUser) (err error, userInter *model.SysUser) {
+func Register(u model.SysUser) (err error, userInter model.SysUser) {
var user model.SysUser
if !errors.Is(global.GVA_DB.Where("username = ?", u.Username).First(&user).Error, gorm.ErrRecordNotFound) { // 判断用户名是否注册
return errors.New("用户名已注册"), userInter
@@ -24,7 +25,7 @@ func Register(u *model.SysUser) (err error, userInter *model.SysUser) {
// 否则 附加uuid 密码md5简单加密 注册
u.Password = utils.MD5V([]byte(u.Password))
u.UUID = uuid.NewV4()
- err = global.GVA_DB.Create(u).Error
+ err = global.GVA_DB.Create(&u).Error
return err, u
}
@@ -60,7 +61,7 @@ func ChangePassword(u *model.SysUser, newPassword string) (err error, userInter
//@param: info request.PageInfo
//@return: err error, list interface{}, total int64
-func GetUserInfoList(info *request.PageInfo) (err error, list interface{}, total int64) {
+func GetUserInfoList(info request.PageInfo) (err error, list interface{}, total int64) {
limit := info.PageSize
offset := info.PageSize * (info.Page - 1)
db := global.GVA_DB.Model(&model.SysUser{})
@@ -99,7 +100,7 @@ func DeleteUser(id float64) (err error) {
//@param: reqUser model.SysUser
//@return: err error, user model.SysUser
-func SetUserInfo(reqUser *model.SysUser) (err error, user *model.SysUser) {
+func SetUserInfo(reqUser model.SysUser) (err error, user model.SysUser) {
err = global.GVA_DB.Updates(&reqUser).Error
return err, reqUser
}
@@ -124,8 +125,8 @@ func FindUserById(id int) (err error, user *model.SysUser) {
func FindUserByUuid(uuid string) (err error, user *model.SysUser) {
var u model.SysUser
- if err = global.GVA_DB.Where("`uuid` = ?", uuid).First(&u).Error; err != nil {
+ if err = global.GVA_DB.Where("`uuid` = ?", uuid).First(&u).Error; err != nil{
return errors.New("用户不存在"), &u
}
return nil, &u
-}
+}
\ No newline at end of file
diff --git a/server/service/sys_workflow.go b/server/service/sys_workflow.go
index 8d4f88ac..03c7f71d 100644
--- a/server/service/sys_workflow.go
+++ b/server/service/sys_workflow.go
@@ -11,7 +11,7 @@ import (
//@param: wk model.SysWorkflow
//@return: error
-func Create(wk *model.SysWorkflow) error {
- err := global.GVA_DB.Create(wk).Error
+func Create(wk model.SysWorkflow) error {
+ err := global.GVA_DB.Create(&wk).Error
return err
}
From 0438ab16c146ae1f9b6823bb36f5490e0036f5bb Mon Sep 17 00:00:00 2001
From: 1319612909 <1319612909@qq.com>
Date: Tue, 24 Nov 2020 17:20:12 +0800
Subject: [PATCH 3/6] =?UTF-8?q?=E6=89=8B=E6=9C=BA=E7=AB=AFui?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
web/src/App.vue | 1 +
web/src/style/basics.scss | 3 +
web/src/style/main.scss | 16 +-
web/src/style/mobile.scss | 89 ++++++++
web/src/view/dashboard/index.vue | 349 ++++++++++++++++-------------
web/src/view/example/form/form.vue | 34 +--
web/src/view/layout/index.vue | 35 ++-
7 files changed, 332 insertions(+), 195 deletions(-)
create mode 100644 web/src/style/mobile.scss
diff --git a/web/src/App.vue b/web/src/App.vue
index b79771fe..4564d38a 100644
--- a/web/src/App.vue
+++ b/web/src/App.vue
@@ -15,6 +15,7 @@ export default {
// 引入初始化样式
@import '@/style/main.scss';
@import '@/style/base.scss';
+@import '@/style/mobile.scss';
#app {
background: #eee;
height: 100vh;
diff --git a/web/src/style/basics.scss b/web/src/style/basics.scss
index 1280dfee..767a99e5 100644
--- a/web/src/style/basics.scss
+++ b/web/src/style/basics.scss
@@ -32,3 +32,6 @@ $color-table-tbody:#595959;
$color-table-thead:#262626;
// dashboard
$height-car:68px;
+// mobile
+$padding-xs: 5px;
+$margin-xs: 5px;
diff --git a/web/src/style/main.scss b/web/src/style/main.scss
index b849814e..432b1cb6 100644
--- a/web/src/style/main.scss
+++ b/web/src/style/main.scss
@@ -1204,6 +1204,14 @@ $mainHight: 100vh;
top: 0;
box-sizing: border-box;
z-index: 999;
+ >.el-row{
+ padding: 0;
+ .el-col-lg-14{
+ height: 60px;
+ }
+ }
+
+
}
@@ -1387,14 +1395,14 @@ $mainHight: 100vh;
.car-left {
height: $height-car;
- width: 70%;
- float: left;
+ // width: 70%;
+ // float: left;
}
.car-right {
height: $height-car;
- width: 29%;
- float: left;
+ // width: 29%;
+ // float: left;
.flow,
.user-number,
diff --git a/web/src/style/mobile.scss b/web/src/style/mobile.scss
new file mode 100644
index 00000000..4bc840b4
--- /dev/null
+++ b/web/src/style/mobile.scss
@@ -0,0 +1,89 @@
+
+@import '@/style/basics.scss';
+@media screen and (min-width: 320px)and (max-width: 750px){
+ .el-header{
+ padding: 0 $padding-xs;
+ }
+ .layout-cont {
+ .main-cont{
+ .breadcrumb{
+ padding: 0 $padding-xs;
+ }
+ }
+ }
+ .layout-cont{
+ .right-box{
+ margin-right: $margin-xs;
+ }
+ }
+ .search-component{
+ width: 30px;
+ }
+ .screenfull{
+ width: 26px;
+ text-align: center;
+ }
+ .el-main{
+ .admin-box{
+ margin-left: 0;
+ margin-right: 0;
+ }
+ .big.admin-box{
+ padding: 0 0 15px 0;
+ }
+ .big {
+ .bottom {
+ .chart-player{
+ height: auto!important;
+ margin-bottom: 15px;
+ }
+ .todoapp{
+ background-color: #fff;
+ padding-bottom: 10px;
+ }
+ }
+ }
+ }
+
+ .card .car-left,
+ .card .car-right{
+ width: 100%;
+ height: 100%;
+ }
+ .card{
+ padding-left: $padding-xs;
+ padding-right: $padding-xs;
+
+ }
+ .card {
+ .text{
+ width: 100%;
+ h4{
+ white-space: break-spaces;
+ }
+ }
+ }
+ .shadow{
+ margin-left: 5px;
+ margin-right: 5px;
+ .grid-content{
+ margin-bottom: 10px;
+ padding: 0;
+ }
+ }
+ .el-dialog{
+ width: 90%;
+ }
+ .el-transfer{
+ .el-transfer-panel{
+ width: 40%;
+ display: inline-block;
+ }
+ .el-transfer__buttons{
+ padding: 0 5px;
+ display: inline-block;
+ }
+
+ }
+
+}
\ No newline at end of file
diff --git a/web/src/view/dashboard/index.vue b/web/src/view/dashboard/index.vue
index 3f93b575..4b7b45b2 100644
--- a/web/src/view/dashboard/index.vue
+++ b/web/src/view/dashboard/index.vue
@@ -1,179 +1,204 @@
-
-
- 今日晴,0℃ - 10℃,天气寒冷,注意添加衣物。
- {{card.label}}
+
+ 今日晴,0℃ - 10℃,天气寒冷,注意添加衣物。
+ {{ card.label }}早安,管理员, 请开始您一天的工作吧!
- 早安,管理员, 请开始您一天的工作吧!
+