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)
|
blockplayer := new(system.BlockPlayer)
|
||||||
db := f5.GetApp().GetOrmDb(constant.CONF_DB)
|
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) {
|
if !f5.IsOrmErrRecordNotFound(err) {
|
||||||
c.JSON(http.StatusOK, gin.H{
|
c.JSON(http.StatusOK, gin.H{
|
||||||
"code": 500,
|
"code": 500,
|
||||||
@ -178,7 +178,7 @@ func (bpa *BlockPlayerApi) Del(c *gin.Context) {
|
|||||||
|
|
||||||
blockplayer := new(system.BlockPlayer)
|
blockplayer := new(system.BlockPlayer)
|
||||||
db := f5.GetApp().GetOrmDb(constant.CONF_DB)
|
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) {
|
if !f5.IsOrmErrRecordNotFound(err) {
|
||||||
c.JSON(http.StatusOK, gin.H{
|
c.JSON(http.StatusOK, gin.H{
|
||||||
"code": 500,
|
"code": 500,
|
||||||
|
@ -207,8 +207,8 @@ func (bpa *WhiteListApi) Del(c *gin.Context) {
|
|||||||
} else {
|
} else {
|
||||||
if whiteListItem.Deleted == 1 {
|
if whiteListItem.Deleted == 1 {
|
||||||
c.JSON(http.StatusOK, gin.H{
|
c.JSON(http.StatusOK, gin.H{
|
||||||
"code": 0,
|
"code": 2,
|
||||||
"message": "",
|
"message": "无法查到记录",
|
||||||
})
|
})
|
||||||
|
|
||||||
return
|
return
|
||||||
|
@ -118,7 +118,7 @@ func (this *UserApi) Info(c *gin.Context) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
for ds.Next() {
|
if ds.Next() {
|
||||||
diamond += q5.ToFloat64(ds.GetByIndex(0))
|
diamond += q5.ToFloat64(ds.GetByIndex(0))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -1,22 +1,40 @@
|
|||||||
package service
|
package service
|
||||||
|
|
||||||
import (
|
import (
|
||||||
//"strings"
|
"f5"
|
||||||
|
"main/constant"
|
||||||
|
"q5"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
//"strings"
|
||||||
|
|
||||||
type user struct {
|
type user struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *user) init(){
|
func (this *user) init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *user) unInit(){
|
func (this *user) unInit() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *user) InBlackList(userIdentity string) (bool, error) {
|
func (this *user) InBlackList(userIdentity string) (bool, error) {
|
||||||
/*
|
if userIdentity == "" {
|
||||||
if strings.ToLower(userIdentity) == strings.ToLower("0x52f01e8791cb558c93ee0c59ea5ff5d79fc82044") {
|
|
||||||
return true, nil
|
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