Exemplo n.º 1
0
        public HttpResponseMessage List4()
        {
            ReturnData result = new ReturnData();

            result.S = true;
            return(MyResponseMessage.SuccessJson <ReturnData>(result));
        }
Exemplo n.º 2
0
        public HttpResponseMessage Edit(Sys_Tables model)
        {
            ReturnData result = new ReturnData();

            try
            {
                if (model.UpdatedDate == null)
                {
                    model.UpdatedDate = DateTime.Now;
                }
                if (tableBLL.Edit(model))
                {
                    result.SetErrorMsg("修改失败!");
                }
                else
                {
                    result.SetSuccessMsg("修改成功!");
                }
            }
            catch (Exception ex)
            {
                LogHelper.Default.WriteError("修改表信息失败:" + ex.Message);
                result.SetErrorMsg("修改表信息失败:" + ex.Message);
            }
            return(MyResponseMessage.SuccessJson <ReturnData>(result));
        }
Exemplo n.º 3
0
        public HttpResponseMessage Add(Sys_Tables model)
        {
            ReturnData result = new ReturnData();

            try
            {
                //校验是否存在同名表
                result = tableBLL.ExistsTable(model.TableName, model.DBCon);
                if (result.S)
                {
                    if (model.CreatedDate == null)
                    {
                        model.CreatedDate = DateTime.Now;
                    }
                    //创建表
                    result = tableBLL.Add(model);
                }
            }
            catch (Exception ex)
            {
                result.S = false;
                result.SetErrorMsg(ex.Message);
            }
            return(MyResponseMessage.SuccessJson <ReturnData>(result));
        }
Exemplo n.º 4
0
        public HttpResponseMessage GetDividendResult([FromBody] Dictionary <string, object> dic)
        {
            int           apiID      = Convert.ToInt32(dic["apiID"]);
            APIInputParam inputParam = CreateInputStr(apiID, new Dictionary <string, string>());
            ReturnData    result     = new ReturnData();

            try
            {
                DataTable     dt = bll.GetTsCode(dic["ts_code"].ToString()).Tables[0];
                TuShareResult apiResultInsert = new TuShareResult();
                apiResultInsert.data       = new TuShareResultData();
                apiResultInsert.data.items = new List <List <string> >();
                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        HttpHelper hh = new HttpHelper();
                        inputParam.@params["ts_code"] = dr["ts_code"].ToString();
                        //postData.
                        TuShareResult apiResult = JSONUtil.ParseFromJson <TuShareResult>(hh.Post(apiUrl, inputParam.ToJson <APIInputParam>()));
                        if (apiResult.data == null)//API接口无返回数据
                        {
                            result.S = false;
                            result.M = "API接口无数据返回!";
                        }
                        else
                        {
                            if (apiResultInsert.data.items.Count > 3000)
                            {
                                //foreach (List<string> item in apiResult.data.items)
                                //{
                                //    apiResultInsert.data.items[0].AddRange(item);
                                //}
                                apiResultInsert.data.items.AddRange(apiResult.data.items);
                                result = bll.GetApiResult(apiResultInsert, apiID);
                                apiResultInsert.data.items = new List <List <string> >();
                            }
                            else
                            {
                                apiResultInsert.data.items.AddRange(apiResult.data.items);
                            }
                        }
                    }
                    if (apiResultInsert.data.items.Count > 0)
                    {
                        result = bll.GetApiResult(apiResultInsert, apiID);
                    }
                }
                else
                {
                    result.SetErrorMsg("找不到股票代码数据!");
                }
            }
            catch (Exception ex)
            {
                result.SetErrorMsg(ex.Message);
            }
            return(MyResponseMessage.SuccessJson(result));
        }
Exemplo n.º 5
0
        public HttpResponseMessage List(List <QueryParam> qd)
        {
            ReturnData result = new ReturnData();

            result.S = true;
            result.D = qd;
            return(MyResponseMessage.SuccessJson <ReturnData>(result));
        }
Exemplo n.º 6
0
        /// <summary>
        /// 删除列
        /// </summary>
        /// <param name="jsonStr">Json字符串格式:{DBName:"db1",TableName:"tb1",Columns["col1","col2","col3"]}</param>
        /// <returns></returns>
        public HttpResponseMessage DeleteColumns([FromBody] string jsonStr)
        {
            ReturnData result = new ReturnData();
            Dictionary <string, object> dic = new Dictionary <string, object>();

            dic = JSONUtil.ParseFromJson <Dictionary <string, object> >(jsonStr);

            return(MyResponseMessage.SuccessJson <ReturnData>(result));
        }
Exemplo n.º 7
0
        public HttpResponseMessage List2(JObject obj)
        {
            List <QueryParam> qd     = obj["qd"].ToObject <List <QueryParam> >();
            string            name   = obj["name"].ToString();
            ReturnData        result = new ReturnData();

            result.S = true;
            //result.D = qd;
            return(MyResponseMessage.SuccessJson <ReturnData>(result));
        }
Exemplo n.º 8
0
        public HttpResponseMessage List3(JObject obj)
        {
            ReturnData        result = new ReturnData();
            List <QueryParam> qd     = obj["qd"].ToObject <List <QueryParam> >();
            List <QueryParam> qd2    = obj["qd2"].ToObject <List <QueryParam> >();

            result.S = true;
            result.D = obj;
            return(MyResponseMessage.SuccessJson <ReturnData>(result));
        }
Exemplo n.º 9
0
        public HttpResponseMessage SendMail()
        {
            ReturnData result = new ReturnData();

            MyPlatform.Common.Mail.MailConfig mailConfig = new Common.Mail.MailConfig();
            MyPlatform.Common.Mail.MailHelper mailHelper = new Common.Mail.MailHelper();
            mailHelper.config = mailConfig;
            mailHelper.SendMail();
            result.M = "邮件发送成功!";
            result.S = true;
            return(MyResponseMessage.SuccessJson <ReturnData>(result));
        }
Exemplo n.º 10
0
        public HttpResponseMessage CreateApiTable([FromBody] int apiID)
        {
            ReturnData result = new ReturnData();

            try
            {
                result = bll.CreateApiTable(apiID);
            }
            catch (Exception ex)
            {
                result.SetErrorMsg(ex.Message);
            }
            return(MyResponseMessage.SuccessJson(result));
        }
Exemplo n.º 11
0
        public HttpResponseMessage Delete([FromBody] int tableID)
        {
            ReturnData result = new ReturnData();

            if (tableBLL.Delete(tableID))
            {
                result.S = true;
            }
            else
            {
                result.SetErrorMsg("删除表失败");
            }
            return(MyResponseMessage.SuccessJson <ReturnData>(result));
        }
Exemplo n.º 12
0
        public HttpResponseMessage GetDetail([FromBody] int apiID)
        {
            ReturnData result = new ReturnData();

            try
            {
                result.S = true;
                result.D = bll.GetDetail(apiID);
            }
            catch (Exception ex)
            {
                result.SetErrorMsg(ex.Message);
            }
            return(MyResponseMessage.SuccessJson(result));
        }
Exemplo n.º 13
0
        public HttpResponseMessage List([FromBody] int tableID)
        {
            ReturnData result = new ReturnData();

            try
            {
                result.S = true;
                result.D = colBLL.GetList(tableID).Tables[0];
            }
            catch (Exception ex)
            {
                result.S = false;
                result.SetErrorMsg("获取表字段失败:" + ex.Message);
            }
            return(MyResponseMessage.SuccessJson(result));
        }
Exemplo n.º 14
0
        public HttpResponseMessage GetHtml([FromBody] string url)
        {
            ReturnData result = new ReturnData();

            try
            {
                HttpHelper hh = new HttpHelper();
                result.D = hh.Get(url, "");
                result.S = true;
            }
            catch (Exception ex)
            {
                result.SetErrorMsg(ex.Message);
            }
            return(MyResponseMessage.SuccessJson(result));
        }
Exemplo n.º 15
0
        /// <summary>
        /// 新增列
        /// </summary>
        /// <param name="columns"></param>
        /// <returns></returns>
        public HttpResponseMessage AddColumn([FromBody] Sys_Columns columns)
        {
            ReturnData result = new ReturnData();

            try
            {
                //string s = "";
            }
            catch (Exception ex)
            {
                result.S = false;
                result.SetErrorMsg("新增列失败:" + ex.Message);
                //throw;
            }
            return(MyResponseMessage.SuccessJson <ReturnData>(result));
        }
Exemplo n.º 16
0
        public HttpResponseMessage Test(JObject postData)
        {
            ReturnData result = new ReturnData();

            try
            {
                HttpHelper hh = new HttpHelper();
                result.S = true;
                result.D = hh.Post(postData.GetValue("url").ToString(), postData.GetValue("postData").ToJson());
            }
            catch (Exception ex)
            {
                result.SetErrorMsg(ex.Message);
            }
            return(MyResponseMessage.SuccessJson(result));
        }
Exemplo n.º 17
0
        public HttpResponseMessage Add(Dictionary <object, object> dic)
        {
            ReturnData result = new ReturnData();

            try
            {
                dic["inputParam"]  = ((Newtonsoft.Json.Linq.JArray)dic["inputParam"]).ToObject <string[]>();
                dic["outputParam"] = ((Newtonsoft.Json.Linq.JArray)dic["outputParam"]).ToObject <string[]>();
                result             = bll.Add(dic);
            }
            catch (Exception ex)
            {
                result.SetErrorMsg(ex.Message);
            }
            return(MyResponseMessage.SuccessJson(result));
        }
Exemplo n.º 18
0
        public HttpResponseMessage List([FromBody] List <QueryParam> qp)
        {
            ReturnData result = new ReturnData();

            try
            {
                result.D = tableBLL.GetListByDBName("");
                result.S = true;
            }
            catch (Exception ex)
            {
                result.S = false;
                result.SetErrorMsg("获取数据失败:" + ex.Message);
                LogHelper.Default.WriteError("获取数据失败:" + ex.Message);
            }
            return(MyResponseMessage.SuccessJson <ReturnData>(result));
        }
Exemplo n.º 19
0
        public HttpResponseMessage GetDividendResultMultiple([FromBody] Dictionary <string, object> dic)
        {
            int           apiID      = Convert.ToInt32(dic["apiID"]);
            APIInputParam inputParam = CreateInputStr(apiID, new Dictionary <string, string>());
            ReturnData    result     = new ReturnData();

            try
            {
                DataTable     dt = bll.GetTsCode(dic["ts_code"].ToString()).Tables[0];
                TuShareResult apiResultInsert = new TuShareResult();
                apiResultInsert.data       = new TuShareResultData();
                apiResultInsert.data.items = new List <List <string> >();
                if (dt.Rows.Count > 0)
                {
                    int count      = dt.Rows.Count;
                    int thCount    = count % 2 == 0 ? 2 : 3;
                    int perThCount = count / 2;
                    for (int i = 1; i < thCount + 1; i++)
                    {
                        Dictionary <string, object> dicTh = new Dictionary <string, object>();
                        dicTh.Add("apiID", apiID);
                        DataTable dtNew = new DataTable();
                        dtNew = dt.Copy();
                        dtNew.Clear();
                        for (int j = perThCount * (i - 1); j < i * perThCount; j++)
                        {
                            dtNew.Rows.Add(dt.Rows[j].ItemArray);
                        }
                        dicTh.Add("dt", dtNew);
                        dicTh.Add("inputParam", inputParam);
                        Thread td = new Thread(new ParameterizedThreadStart(GetDividend));
                        td.Start(dicTh);
                    }
                }
                else
                {
                    result.SetErrorMsg("找不到股票代码数据!");
                }
            }
            catch (Exception ex)
            {
                result.SetErrorMsg(ex.Message);
            }
            return(MyResponseMessage.SuccessJson(result));
        }
Exemplo n.º 20
0
        public HttpResponseMessage GetDetail([FromBody] Dictionary <string, object> dic)
        {
            ReturnData result = new ReturnData();

            try
            {
                //Pagination page=JSONUtil.ParseFromJson<>
                int        tableID = Convert.ToInt32(dic["tableID"]);
                string     s       = dic["page"].ToJson();
                Pagination page    = JSONUtil.ParseFromJson <Pagination>(dic["page"].ToJson());
                result = tableBLL.GetDetail(Convert.ToInt32(dic["tableID"]), page);
            }
            catch (Exception ex)
            {
                result.S = false;
                result.SetErrorMsg("错误信息:" + ex.Message);
            }
            return(MyResponseMessage.SuccessJson <ReturnData>(result));
        }
Exemplo n.º 21
0
        //public HttpResponseMessage Register([FromBody]string json)
        public HttpResponseMessage Register(MyPlatform.Model.Sys_Users model)
        {
            //    MyPlatform.Model.Sys_Users model = MyPlatform.Common.JSONUtil.ParseFromJson<MyPlatform.Model.Sys_Users>(json);
            ReturnData returnData = new ReturnData();//返回数据

            #region 验证数据
            if (string.IsNullOrEmpty(model.Account))
            {
                returnData.SetErrorMsg("账号不能为空!");
            }
            if (string.IsNullOrEmpty(model.Password))
            {
                returnData.SetErrorMsg("密码不能为空!");
            }
            if (string.IsNullOrEmpty(model.CreatedBy))
            {
                model.CreatedBy = model.UserName;
            }
            if (!string.IsNullOrEmpty(returnData.M))//数据校验不通过,返回校验结果
            {
                return(MyResponseMessage.SuccessJson <ReturnData>(returnData));
            }
            #endregion
            model.CreatedDate = DateTime.Now;
            if (userBLL.Exists(model.Account))//判断账号是否已注册
            {
                returnData.SetErrorMsg("账号已被注册");
            }
            else//账号未被注册,进行新增操作
            {
                if (userBLL.Add(model) > 0)
                {
                    returnData.SetSuccessMsg("创建成功!");
                }
                else
                {
                    returnData.SetErrorMsg("创建失败!");
                }
            }

            return(MyResponseMessage.SuccessJson <ReturnData>(returnData));
        }
Exemplo n.º 22
0
        public HttpResponseMessage GetApiResult([FromBody] JObject postData)
        {
            ReturnData result = new ReturnData();

            try
            {
                HttpHelper    hh        = new HttpHelper();
                TuShareResult apiResult = JSONUtil.ParseFromJson <TuShareResult>(hh.Post(postData.GetValue("url").ToString(), postData.GetValue("postData").ToJson()));
                if (apiResult.data == null)//API接口无返回数据
                {
                    result.S = false;
                    result.M = "API接口无数据返回!";
                }
                else
                {
                    result = bll.GetApiResult(apiResult, int.Parse(postData.GetValue("apiID").ToString()));
                }
            }
            catch (Exception ex)
            {
                result.SetErrorMsg(ex.Message);
            }
            return(MyResponseMessage.SuccessJson(result));
        }