fix: 主键字段获取调整&其他小优化

This commit is contained in:
meilin.huang
2022-11-14 18:07:27 +08:00
parent 99ce3bd099
commit debc34f0fb
8 changed files with 31 additions and 19 deletions

View File

@@ -297,6 +297,7 @@ func (r *Redis) SetStringValue(rc *ctx.ReqCtx) {
g := rc.GinCtx
keyValue := new(form.StringValue)
ginx.BindJsonAndValid(g, keyValue)
rc.ReqParam = keyValue
ri := r.RedisApp.GetRedisInstance(uint64(ginx.PathParamInt(g, "id")), ginx.PathParamInt(g, "db"))
biz.ErrIsNilAppendErr(r.TagApp.CanAccess(rc.LoginAccount.Id, ri.TagPath), "%s")

View File

@@ -50,7 +50,7 @@ func InitRedisRouter(router *gin.RouterGroup) {
})
// 删除key
deleteKeyL := ctx.NewLogInfo("redis删除key").WithSave(true)
deleteKeyL := ctx.NewLogInfo("redis-删除key").WithSave(true)
redis.DELETE(":id/:db/key", func(c *gin.Context) {
ctx.NewReqCtxWithGin(c).WithLog(deleteKeyL).Handle(rs.DeleteKey)
})
@@ -61,8 +61,9 @@ func InitRedisRouter(router *gin.RouterGroup) {
})
// 设置string类型值
setStringL := ctx.NewLogInfo("redis-setString").WithSave(true)
redis.POST(":id/:db/string-value", func(c *gin.Context) {
ctx.NewReqCtxWithGin(c).Handle(rs.SetStringValue)
ctx.NewReqCtxWithGin(c).WithLog(setStringL).Handle(rs.SetStringValue)
})
// hscan
@@ -74,13 +75,15 @@ func InitRedisRouter(router *gin.RouterGroup) {
ctx.NewReqCtxWithGin(c).Handle(rs.Hget)
})
hdelL := ctx.NewLogInfo("redis-hdel").WithSave(true)
redis.DELETE(":id/:db/hdel", func(c *gin.Context) {
ctx.NewReqCtxWithGin(c).Handle(rs.Hdel)
ctx.NewReqCtxWithGin(c).WithLog(hdelL).Handle(rs.Hdel)
})
// 设置hash类型值
setHashValueL := ctx.NewLogInfo("redis-setHashValue").WithSave(true)
redis.POST(":id/:db/hash-value", func(c *gin.Context) {
ctx.NewReqCtxWithGin(c).Handle(rs.SetHashValue)
ctx.NewReqCtxWithGin(c).WithLog(setHashValueL).Handle(rs.SetHashValue)
})
// 获取set类型值