56 lines
1.1 KiB
Go
56 lines
1.1 KiB
Go
package web
|
|
|
|
import (
|
|
"context"
|
|
"go_dreamfactory/comm"
|
|
"go_dreamfactory/lego/sys/gin/engine"
|
|
"go_dreamfactory/pb"
|
|
"net/http"
|
|
)
|
|
|
|
// 封号或禁言
|
|
type AccountBanReq struct {
|
|
Uid string `json:"uid"` // uid
|
|
iType int32 // 0 封号 1 禁言
|
|
iValue int32 // 类型对应的值
|
|
}
|
|
|
|
//禁封消息
|
|
func (this *Api_Comp) AccountBanNotify(c *engine.Context) {
|
|
|
|
req := &AccountBanReq{}
|
|
err := c.BindJSON(&req)
|
|
this.module.Debugf("AccountBanReq:%+v err:%v", req, err)
|
|
var (
|
|
errdata *pb.ErrorData
|
|
data interface{}
|
|
)
|
|
|
|
defer func() {
|
|
c.JSON(http.StatusOK, &Respond{Code: errdata.Code, Message: errdata.Message, Data: data})
|
|
}()
|
|
|
|
rpcMsg := &pb.RPCAccountBan{
|
|
Uid: req.Uid,
|
|
Key: req.iType,
|
|
Value: req.iValue,
|
|
}
|
|
if _, err = this.module.service.RpcGo(
|
|
context.Background(),
|
|
comm.Service_Worker,
|
|
string(comm.Rpc_AccountBan),
|
|
rpcMsg, nil); err != nil {
|
|
this.module.Errorln(err)
|
|
errdata = &pb.ErrorData{
|
|
Code: pb.ErrorCode_RpcFuncExecutionError,
|
|
Title: pb.ErrorCode_RpcFuncExecutionError.ToString(),
|
|
}
|
|
return
|
|
}
|
|
errdata = &pb.ErrorData{
|
|
Code: pb.ErrorCode_Success,
|
|
Title: pb.ErrorCode_Success.ToString(),
|
|
}
|
|
|
|
}
|