Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b512f3d680 | ||
|
|
d4e829e57c | ||
|
|
78798060e7 |
@@ -1,7 +1,7 @@
|
||||
package teaconst
|
||||
|
||||
const (
|
||||
Version = "0.6.1"
|
||||
Version = "0.6.3"
|
||||
|
||||
ProductName = "Edge API"
|
||||
ProcessName = "edge-api"
|
||||
@@ -18,7 +18,7 @@ const (
|
||||
|
||||
// 其他节点版本号,用来检测是否有需要升级的节点
|
||||
|
||||
NodeVersion = "0.6.1"
|
||||
NodeVersion = "0.6.3"
|
||||
|
||||
// SQLVersion SQL版本号
|
||||
SQLVersion = "9"
|
||||
|
||||
@@ -12,6 +12,7 @@ import (
|
||||
"github.com/iwind/TeaGo/Tea"
|
||||
"github.com/iwind/TeaGo/dbs"
|
||||
"github.com/iwind/TeaGo/lists"
|
||||
"github.com/iwind/TeaGo/rands"
|
||||
"github.com/iwind/TeaGo/types"
|
||||
stringutil "github.com/iwind/TeaGo/utils/string"
|
||||
timeutil "github.com/iwind/TeaGo/utils/time"
|
||||
@@ -66,7 +67,27 @@ func (this *UserDAO) DisableUser(tx *dbs.Tx, userId int64) error {
|
||||
return errors.New("invalid 'userId'")
|
||||
}
|
||||
|
||||
_, err := this.Query(tx).
|
||||
// 处理以往同用户名用户
|
||||
username, err := this.Query(tx).
|
||||
Pk(userId).
|
||||
Result("username").
|
||||
FindStringCol("")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if len(username) > 0 {
|
||||
err = this.Query(tx).
|
||||
Attr("username", username).
|
||||
Attr("state", UserStateDisabled).
|
||||
Set("username", username+"_"+rands.HexString(8)).
|
||||
UpdateQuickly()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// 禁止当前
|
||||
_, err = this.Query(tx).
|
||||
Pk(userId).
|
||||
Set("state", UserStateDisabled).
|
||||
Update()
|
||||
|
||||
Reference in New Issue
Block a user