Compare commits

..

No commits in common. "b20bf61bf5f5cc81320663b250f8899c7bf9c972" and "197e035f0bc68930395725a53c2a7e11b82dd047" have entirely different histories.

View File

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