This commit is contained in:
wangchuxiao
2022-07-05 11:01:10 +08:00
parent b0669b7eea
commit d0e7147911
4 changed files with 10 additions and 7 deletions
@@ -5,14 +5,14 @@ import (
_ "github.com/jinzhu/gorm"
)
func GetRegister(account, areaCode string) (*db.Register, error) {
func GetRegister(account, areaCode, userID 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 = ? or account =? and area_code=?",
account, account, areaCode).Take(&r).Error
return &r, dbConn.Table("registers").Where("user_id = ? and user_id != ? or account = ? or account =? and area_code=?",
userID, "", account, account, areaCode).Take(&r).Error
}
func SetPassword(account, password, ex, userID, areaCode string) error {