Exemple #1
0
    ///// <summary>
    ///// 客户端请求账户信息
    ///// </summary>
    ///// <param name="token"></param>
    ///// <param name="msg"></param>
    //public void ReqRunTacticsMessage_CB(BaseToken token, BaseMessage msg)
    //{
    //    ReqRunTacticsMessage info = msg as ReqRunTacticsMessage;
    //    if (info != null) {
    //        int state = TaticsManager.GetIns().V_Model.F_ReqRunTactics(info.coin);
    //        string tip = state == 1 ? "成功" : "失败";
    //        NetCenter.Ins.SendTips(token, tip);
    //    }
    //}

    ///// <summary>
    ///// 客户端请求操作
    ///// </summary>
    ///// <param name="token"></param>
    ///// <param name="msg"></param>
    //public void ReqOrderTacticsMessage_CB(BaseToken token, BaseMessage msg)
    //{
    //    ReqOrderTacticsMessage info = msg as ReqOrderTacticsMessage;
    //    if (info != null)
    //    {
    //        int state = TaticsManager.GetIns().V_Model.F_ReqRunTactics(info.coin);
    //        string tip = state == 1 ? "成功" : "失败";
    //        NetCenter.Ins.SendTips(token, tip);
    //    }
    //}

    /// <summary>
    /// 客户端请求改变策略下单状态
    /// </summary>
    /// <param name="token"></param>
    /// <param name="msg"></param>
    public void ReqChangeOrderStateMessage_CB(BaseToken token, BaseMessage msg)
    {
        ReqChangeOrderStateMessage info = msg as ReqChangeOrderStateMessage;

        if (info != null)
        {
            int state = TaticsManager.GetIns().V_Model.F_ReqChangeOrderState(info.coin, info.state);
            Console.WriteLine("客户端请求改变策略下单状态 " + info.coin + "  " + info.state);
            Debugger.Warn("客户端请求改变策略下单状态 " + info.coin + "  " + info.state);
            string tip = state <= 0 ? "失败":"成功";
            NetCenter.Ins.SendTips(token, tip);
        }
    }
Exemple #2
0
    /// <summary>
    /// 客户端请求账户信息
    /// </summary>
    /// <param name="token"></param>
    /// <param name="msg"></param>
    public void ReqAccountInfoMessage_CB(BaseToken token, BaseMessage msg)
    {
        if (msg is ReqTacticsInfoMessage)
        {
            ResTacticsListMessage res = new ResTacticsListMessage();
            res.V_AccountInfoList = TaticsManager.GetIns().V_Model.GetTacticsInfo();

            if (token != null && token.socket != null)
            {
                Debugger.Log(string.Format("{0} 请求账号数据 数据为{1}", token.socket.RemoteEndPoint, res.V_AccountInfoList.Count));
            }

            NetCenter.Ins.Send(token, ResTacticsListMessage.V_Pid, res);
        }
    }