:new:完成客户端链接状态监控

This commit is contained in:
coward
2024-03-15 15:17:40 +08:00
parent d50f17ed12
commit 30cc35ae00
8 changed files with 115 additions and 3 deletions

View File

@@ -162,8 +162,16 @@ func (r clientRepo) Delete(id string) (err error) {
// @return err
func (r clientRepo) GetById(id string) (data entity.Client, err error) {
err = r.Model(&entity.Client{}).Where("id = ?", id).Preload("Server").First(&data).Error
if err != nil {
return
}
return
}
// GetByPublicKey
// @description: 根据公钥获取客户端信息
// @receiver r
// @param publicKey
// @return data
// @return err
func (r clientRepo) GetByPublicKey(publicKey string) (data entity.Client, err error) {
err = r.Model(&entity.Client{}).Where("keys->$.publicKey = ?", publicKey).Preload("Server").First(&data).Error
return
}