Skip to content

Commit

Permalink
修复报警配置删除不了的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
jc3wish committed Sep 25, 2020
1 parent f7cf63d commit 29a0bdc
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions xdb/xdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,20 +76,26 @@ func (This *Client) DelKeyVal(table,key string) error{
}

func (This *Client) GetListByKeyPrefix(table,key string,data interface{}) ([]driver.ListValue,error){
myKey := []byte(This.prefix+"-"+table+"-"+key)
prefix := This.prefix+"-"+table+"-"
prefixLen := len(prefix)
myKey := []byte(prefix+key)
s,err := This.client.GetListByKeyPrefix(myKey)
if err != nil{
return s,err
}
if data != nil {
val := ""
for _, v := range s {
var val = ""
for k, v := range s {
if data != nil {
if val == "" {
val = v.Value
} else {
val += "," + v.Value
}
}
s[k].Key = s[k].Key[prefixLen:]
}

if data != nil {
val = "[" + val + "]"
err = json.Unmarshal([]byte(val), &data)
}
Expand Down

0 comments on commit 29a0bdc

Please sign in to comment.