|
|
@ -78,15 +78,18 @@ func DelSuperGroupMsg(c *gin.Context) {
|
|
|
|
req api.DelSuperGroupMsgReq
|
|
|
|
req api.DelSuperGroupMsgReq
|
|
|
|
resp api.DelSuperGroupMsgResp
|
|
|
|
resp api.DelSuperGroupMsgResp
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
rpcReq := &rpc.DelSuperGroupMsgReq{}
|
|
|
|
|
|
|
|
utils.CopyStructFields(req, &req)
|
|
|
|
if err := c.BindJSON(&req); err != nil {
|
|
|
|
if err := c.BindJSON(&req); err != nil {
|
|
|
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
|
|
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req:", req)
|
|
|
|
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req:", req)
|
|
|
|
|
|
|
|
var ok bool
|
|
|
|
ok, opUserID, errInfo := token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
|
|
|
var errInfo string
|
|
|
|
|
|
|
|
ok, rpcReq.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
|
|
|
if !ok {
|
|
|
|
if !ok {
|
|
|
|
errMsg := req.OperationID + " " + opUserID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
|
|
|
errMsg := req.OperationID + " " + rpcReq.OpUserID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
|
|
|
log.NewError(req.OperationID, errMsg)
|
|
|
|
log.NewError(req.OperationID, errMsg)
|
|
|
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg})
|
|
|
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg})
|
|
|
|
return
|
|
|
|
return
|
|
|
@ -137,7 +140,19 @@ func DelSuperGroupMsg(c *gin.Context) {
|
|
|
|
client := rpc.NewMsgClient(etcdConn)
|
|
|
|
client := rpc.NewMsgClient(etcdConn)
|
|
|
|
|
|
|
|
|
|
|
|
log.Info(req.OperationID, "", "api DelSuperGroupMsg call, api call rpc...")
|
|
|
|
log.Info(req.OperationID, "", "api DelSuperGroupMsg call, api call rpc...")
|
|
|
|
|
|
|
|
if req.IsAllDelete {
|
|
|
|
|
|
|
|
RpcResp, err := client.DelSuperGroupMsg(context.Background(),rpcReq)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
log.NewError(req.OperationID, "call delete DelSuperGroupMsg rpc server failed", err.Error())
|
|
|
|
|
|
|
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call DelSuperGroupMsg rpc server failed"})
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
log.Info(req.OperationID, "", "api DelSuperGroupMsg call end..., [data: %s] [reply: %s]", pbData.String(), RpcResp.String())
|
|
|
|
|
|
|
|
resp.ErrCode = RpcResp.ErrCode
|
|
|
|
|
|
|
|
resp.ErrMsg = RpcResp.ErrMsg
|
|
|
|
|
|
|
|
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), resp)
|
|
|
|
|
|
|
|
c.JSON(http.StatusOK, resp)
|
|
|
|
|
|
|
|
}else{
|
|
|
|
RpcResp, err := client.SendMsg(context.Background(), &pbData)
|
|
|
|
RpcResp, err := client.SendMsg(context.Background(), &pbData)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
log.NewError(req.OperationID, "call delete UserSendMsg rpc server failed", err.Error())
|
|
|
|
log.NewError(req.OperationID, "call delete UserSendMsg rpc server failed", err.Error())
|
|
|
@ -151,6 +166,8 @@ func DelSuperGroupMsg(c *gin.Context) {
|
|
|
|
c.JSON(http.StatusOK, resp)
|
|
|
|
c.JSON(http.StatusOK, resp)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// @Summary 清空用户消息
|
|
|
|
// @Summary 清空用户消息
|
|
|
|
// @Description 清空用户消息
|
|
|
|
// @Description 清空用户消息
|
|
|
|
// @Tags 消息相关
|
|
|
|
// @Tags 消息相关
|
|
|
|