Exemple #1
0
        private string dealWithMsg(string ss, ref Data data)
        {
            try
            {
                var c = Newtonsoft.Json.JsonConvert.DeserializeObject <Model.Command>(ss);
                switch (c.Type)
                {
                case "GetCountOfFP":
                {
                    //获取商店的数量
                    var count           = data.Get61Fp();
                    var countOfFP       = new { Count = count };
                    var selectionResult = Newtonsoft.Json.JsonConvert.SerializeObject(countOfFP);
                    return(selectionResult);
                }; break;

                case "GetFPOnlyByIndex":
                {
                    var gi = Newtonsoft.Json.JsonConvert.DeserializeObject <Model.GetByIndex>(c.JsonValue);

                    var fp = data.GetFpByIndex(gi.IndexValule);
                    if (fp != null)
                    {
                        return(Newtonsoft.Json.JsonConvert.SerializeObject(new { fp = fp }));
                    }
                }; break;

                case "AToB":
                {
                    //4s  373209M
                    var fpID1 = Convert.ToString(c.JsonValue.Substring(0, 10));
                    var fpID2 = Convert.ToString(c.JsonValue.Substring(10, 10));
                    return(data.GetAFromB(fpID1, fpID2));
                }; break;

                case "FirstIndex":
                {
                    throw new Exception("");
                    // return data.FirstIndex();
                }

                case "Refresh":
                {
                    throw new Exception("");
                    //return data.Refresh();
                }; break;
                }
                return("");
            }
            catch
            {
                Console.WriteLine($"{ss}_执行没结果");
                return("");
            }
            //  throw new NotImplementedException();
        }