public ActionResult CancelVirtualCoinWithdraw(string withdrawUniqueID, string memo, CurrencyType currency) { try { var cmd = new CancelVirtualCoinWithdraw(withdrawUniqueID, this.CurrentUser.UserID, memo, currency); this.CommandBus.Send(cmd); return Json(JsonResult.Success); } catch (CommandExecutionException ex) { return Json(new JsonResult(ex.ErrorCode)); } }
private static void SendWithdrawFailOrAddressInvalidCommand(CurrencyType currency, string withdrawUniqueID, VirtualCoinWithdrawFailProcessType processType) { var cmdMessage = string.Empty; try { var mqname = currency.ToString() + "SendWithdrawFailOrAddressInvalidCommand"; var channel = _mqpool.GetMQChannel(mqname); var exchangeAndQueueName = Utilities.GenerateVirtualCoinWithdrawTranferFailOrAddressInvalidExchangeAndQueueName(); var nullUserID = 0; if (processType == VirtualCoinWithdrawFailProcessType.Cancel) { Log.Info("{0}提现{1}的发送到p2p失败,发送处理失败指令", currency, withdrawUniqueID); var cmd = new CancelVirtualCoinWithdraw(withdrawUniqueID, nullUserID, string.Empty, currency); cmdMessage = IoC.Resolve<IJsonSerializer>().Serialize(cmd); } else { Log.Info("{0}提现{1}的提现地址不合法,发送撤销提现指令", currency, withdrawUniqueID); var cmd = new VirtualCoinWithdrawFail(withdrawUniqueID, nullUserID, string.Empty, currency); cmdMessage = IoC.Resolve<IJsonSerializer>().Serialize(cmd); } var build = new BytesMessageBuilder(channel); build.WriteBytes(Encoding.UTF8.GetBytes(cmdMessage)); ((IBasicProperties)build.GetContentHeader()).DeliveryMode = 2; try { channel.BasicPublish(exchangeAndQueueName.Item1, string.Empty, ((IBasicProperties)build.GetContentHeader()), build.GetContentBody()); } catch (EndOfStreamException ex) { if (ex.Message.Equals("SharedQueue closed", StringComparison.OrdinalIgnoreCase)) { channel = _mqpool.GetMQChannel(mqname); channel.BasicPublish(exchangeAndQueueName.Item1, string.Empty, ((IBasicProperties)build.GetContentHeader()), build.GetContentBody()); } } catch (Exception ex) { Log.Error("发送提现失败处理消息时--失败了:" + cmdMessage, ex); } } catch (Exception ex) { Log.Error("发送提现失败处理消息时--失败了:" + cmdMessage, ex); } }