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 `json:"itype"` // 0 封号 1 禁言 Value int32 `json:"value"` // 类型对应的值 } //禁封消息 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.Value, } 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(), } }