block player
This commit is contained in:
parent
6b3134779a
commit
dcdcd6f430
@ -132,7 +132,7 @@ func (bpa *BlockPlayerApi) Edit(c *gin.Context) {
|
||||
|
||||
blockplayer := new(system.BlockPlayer)
|
||||
db := f5.GetApp().GetOrmDb(constant.CONF_DB)
|
||||
if err := db.Take(blockplayer, "account_id =?", req.Account).Error; err != nil {
|
||||
if err := db.Take(blockplayer, "account_id = ? AND deleted = 0", req.Account).Error; err != nil {
|
||||
if !f5.IsOrmErrRecordNotFound(err) {
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"code": 500,
|
||||
@ -178,7 +178,7 @@ func (bpa *BlockPlayerApi) Del(c *gin.Context) {
|
||||
|
||||
blockplayer := new(system.BlockPlayer)
|
||||
db := f5.GetApp().GetOrmDb(constant.CONF_DB)
|
||||
if err := db.Take(blockplayer, "account_id =?", req.Account).Error; err != nil {
|
||||
if err := db.Take(blockplayer, "account_id = ? AND deleted = 0", req.Account).Error; err != nil {
|
||||
if !f5.IsOrmErrRecordNotFound(err) {
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"code": 500,
|
||||
|
@ -207,8 +207,8 @@ func (bpa *WhiteListApi) Del(c *gin.Context) {
|
||||
} else {
|
||||
if whiteListItem.Deleted == 1 {
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"code": 0,
|
||||
"message": "",
|
||||
"code": 2,
|
||||
"message": "无法查到记录",
|
||||
})
|
||||
|
||||
return
|
||||
|
@ -118,7 +118,7 @@ func (this *UserApi) Info(c *gin.Context) {
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
for ds.Next() {
|
||||
if ds.Next() {
|
||||
diamond += q5.ToFloat64(ds.GetByIndex(0))
|
||||
}
|
||||
})
|
||||
|
@ -1,9 +1,13 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
//"strings"
|
||||
"f5"
|
||||
"main/constant"
|
||||
"q5"
|
||||
)
|
||||
|
||||
//"strings"
|
||||
|
||||
type user struct {
|
||||
}
|
||||
|
||||
@ -14,9 +18,23 @@ func (this *user) unInit(){
|
||||
}
|
||||
|
||||
func (this *user) InBlackList(userIdentity string) (bool, error) {
|
||||
/*
|
||||
if strings.ToLower(userIdentity) == strings.ToLower("0x52f01e8791cb558c93ee0c59ea5ff5d79fc82044") {
|
||||
if userIdentity == "" {
|
||||
return true, nil
|
||||
}*/
|
||||
return false, nil
|
||||
}
|
||||
|
||||
var queryerr error
|
||||
blocked := false
|
||||
f5.GetGoStyleDb().RawQuery(
|
||||
constant.CONF_DB,
|
||||
"SELECT * FROM t_blockplayer WHERE 1=1 AND account_id = ?",
|
||||
[]string{userIdentity},
|
||||
func(err error, ds *f5.DataSet) {
|
||||
if err != nil {
|
||||
queryerr = err
|
||||
return
|
||||
}
|
||||
|
||||
blocked = ds.Next() && q5.SafeToInt32(ds.GetByName("blocked")) != 0 && q5.SafeToInt32(ds.GetByName("deleted")) == 0
|
||||
})
|
||||
return blocked, queryerr
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user