/// <summary> /// 融云-消息撤回 /// </summary> public ReturnValueModel MessageRecall(RecallMessageInputDto inputDto, WorkUser workUser) { ReturnValueModel rvm = new ReturnValueModel(); string appKey = ConfigurationManager.AppSettings["RongCloudAppKey"]; string appSecret = ConfigurationManager.AppSettings["RongCloudAppSecret"]; string _host = ConfigurationManager.AppSettings["RongCloudUrl"]; string url = $"{_host}/message/recall.json"; StringBuilder sb = new StringBuilder(); sb.Append("&conversationType=").Append(HttpUtility.UrlEncode("1", Encoding.UTF8)); sb.Append("&fromUserId=").Append(HttpUtility.UrlEncode(inputDto.SenderId.ToString(), Encoding.UTF8)); sb.Append("&targetId=").Append(HttpUtility.UrlEncode(inputDto.TargetId.ToString(), Encoding.UTF8)); sb.Append("&messageUID=").Append(HttpUtility.UrlEncode(inputDto.UId.ToString(), Encoding.UTF8)); sb.Append("&sentTime=").Append(HttpUtility.UrlEncode(inputDto.SentTime.ToString(), Encoding.UTF8)); String body = sb.ToString(); if (body.IndexOf("&") == 0) { body = body.Substring(1, body.Length - 1); } string result = RongHttpClient.ExecutePost(appKey, appSecret, body, url, "application/x-www-form-urlencoded"); var res = (ResponseResult)RongJsonUtil.JsonStringToObj <ResponseResult>(result); if (res.Code == 200) { rvm.Msg = "success"; rvm.Success = true; rvm.Result = res; return(rvm); } else { rvm.Msg = "消息撤回失败"; rvm.Success = false; rvm.Result = result; return(rvm); } }
public IHttpActionResult MessageRecall(RecallMessageInputDto inputDto) { var ret = _rongCloudService.MessageRecall(inputDto, WorkUser); return(Ok(ret)); }