qq_bot/service/scoresaber/get_ssid.go
2025-07-05 15:46:36 +08:00

25 lines
576 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package scoresaber
import (
"errors"
"log"
"git.lxtend.com/lixiangwuxian/qqbot/service"
"git.lxtend.com/lixiangwuxian/qqbot/sqlite3"
"gorm.io/gorm"
)
func GetSSID(qqId string) (ssId string, err error) {
db := sqlite3.GetGormDB()
var bind service.SSBind
err = db.Where("qqid = ?", qqId).First(&bind).Error
if errors.Is(err, gorm.ErrRecordNotFound) {
return "", errors.New("未绑定ss账号输入\"绑定ss [ssId]\"绑定")
}
if err != nil {
log.Println("查询 ssId 出错:", err)
return "", errors.New("查询 ssId 失败")
}
return bind.SSID, nil
}