mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-14 05:56:00 +08:00
add swagger demo
This commit is contained in:
@@ -7,6 +7,7 @@ type Register struct {
|
||||
Password string `gorm:"column:password;type:varchar(255)" json:"password"`
|
||||
Ex string `gorm:"column:ex;size:1024" json:"ex"`
|
||||
UserID string `gorm:"column:user_id;type:varchar(255)" json:"userID"`
|
||||
AreaCode string `gorm:"column:area_code;type:varchar(255)"`
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -5,22 +5,23 @@ import (
|
||||
_ "github.com/jinzhu/gorm"
|
||||
)
|
||||
|
||||
func GetRegister(account string) (*db.Register, error) {
|
||||
func GetRegister(account, areaCode string) (*db.Register, error) {
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var r db.Register
|
||||
return &r, dbConn.Table("registers").Where("account = ?",
|
||||
account).Take(&r).Error
|
||||
return &r, dbConn.Table("registers").Where("account = ? or account =? and area_code=?",
|
||||
account, account, areaCode).Take(&r).Error
|
||||
}
|
||||
|
||||
func SetPassword(account, password, ex, userID string) error {
|
||||
func SetPassword(account, password, ex, userID, areaCode string) error {
|
||||
r := db.Register{
|
||||
Account: account,
|
||||
Password: password,
|
||||
Ex: ex,
|
||||
UserID: userID,
|
||||
AreaCode: areaCode,
|
||||
}
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user