Compare commits

...

2 Commits

Author SHA1 Message Date
coward
b20bf61bf5 🐛fix a bug
All checks were successful
continuous-integration/drone/tag Build is passing
2024-06-04 15:13:59 +08:00
coward
60c4aeed75 🐛修复bug 2024-06-04 15:11:37 +08:00

View File

@ -3,6 +3,7 @@ package repository
import (
"encoding/json"
"errors"
"fmt"
"gitee.ltd/lxh/logger/log"
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
"gorm.io/gorm"
@ -194,7 +195,7 @@ func (r clientRepo) GetById(id string) (data entity.Client, err error) {
// @return data
// @return err
func (r clientRepo) GetByPublicKey(publicKey string) (data entity.Client, err error) {
err = r.Model(&entity.Client{}).Where("json_extract(keys, '.publicKey') = '?'", publicKey).Preload("Server").First(&data).Error
err = r.Model(&entity.Client{}).Where(fmt.Sprintf("json_extract(keys, '$.publicKey') = '%s'", publicKey)).Preload("Server").First(&data).Error
return
}