Esempio n. 1
0
        public User LoginUser([FromBody]User user)
        {
            MysqlHelper mysqlhelper = new MysqlHelper();
            // return "Success";
            var status = mysqlhelper.SearchUser(user);

            return status;
        }
Esempio n. 2
0
        public Tree TreeData(string id)
        {
            UserHelper userhelper = new UserHelper();
            MysqlHelper mysqlhelper = new MysqlHelper();
            User one_user = new User();
            one_user.Id = id;
            one_user = mysqlhelper.CheckStatus(one_user);
            Seed final_tree = userhelper.HandleBaidu(one_user);
            string result = "";
            Tree tree = new Tree();
            tree.name = "初中数学上";
            tree.itemStyle.normal.label.show = false;

            foreach (Seed seed in final_tree.children)
            {
                Tree one_tree_2 = new Tree();
                one_tree_2.name = seed.name;
                if (seed.Degree_1 < 20)
                {
                    one_tree_2.itemStyle.normal.color = "#332B2B";
                }
                else
                {
                    one_tree_2.itemStyle.normal.color = "#19C9FF";
                }
                foreach (Seed seed_2 in seed.children)
                {
                    Tree tree_3 = new Tree();
                    tree_3.name = seed_2.name;
                    if (seed_2.Degree_2 < 20)
                    {
                        tree_3.itemStyle.normal.color = "#332B2B";
                    }
                    else
                    {
                        tree_3.itemStyle.normal.color = "#19C9FF";
                    }
                    one_tree_2.children.Add(tree_3);

                }
                tree.children.Add(one_tree_2);
            }

            return tree;
        }
        public IHttpActionResult Explain(string qno)
        {
            string[] string_list = qno.Split(';');
            string pre_sql = "";
            for (int i = 0; i < string_list.Count(); i++)
            {
                if (i != string_list.Count()-1)
                {
                    pre_sql += "questionID=" + string_list[i] + " or ";

                }
                else
                {
                    pre_sql += " questionID=" + string_list[i];
                }
            }
            string sql = string.Format("select id,content,answerExplain from question where {0}",pre_sql);
            MysqlHelper mysqlhelper = new MysqlHelper();
            return Ok(mysqlhelper.SelectExp(sql));
        }
Esempio n. 4
0
 public Explain Explain(string id)
 {
     MysqlHelper mysqlhelper = new MysqlHelper();
       return  mysqlhelper.GetExplainDetail(id);
 }
 public IHttpActionResult random()
 {
     MysqlHelper mysqlhelper = new MysqlHelper();
     return Ok(mysqlhelper.random());
 }
 public IHttpActionResult qslist(string id)
 {
     MysqlHelper mysqlhelper = new MysqlHelper();
     return Ok(mysqlhelper.getQuestion(id));
 }
 public Question ExplainQuestion(string id)
 {
     MysqlHelper mysqlhelper = new MysqlHelper();
       return  mysqlhelper.randomById(id);
 }
Esempio n. 8
0
 public User Register([FromBody]User user)
 {
     MysqlHelper mysqlhelper = new MysqlHelper();
     mysqlhelper.CreatUser(ref user);
     return user;
 }
Esempio n. 9
0
 public void ReceiveGoal([FromBody]User user)
 {
     MysqlHelper mysqlhelper = new MysqlHelper();
     mysqlhelper.InsertGoal(user);
 }
Esempio n. 10
0
 public bool NameSearch(string name)
 {
     MysqlHelper mysqlhelper = new MysqlHelper();
     return mysqlhelper.SearchName(name);
 }
Esempio n. 11
0
 /// <summary>
 /// 根据用户id获取用户最新的详细信息,用于实时刷新功能
 /// </summary>
 /// <param name="user"></param>
 /// <returns></returns>
 public User UserStatus([FromBody]User user)
 {
     MysqlHelper mysqlhelper = new MysqlHelper();
        return  mysqlhelper.CheckStatus(user);
 }
Esempio n. 12
0
 public string UpdatePower([FromBody]User user)
 {
     MysqlHelper mysqlhelper = new MysqlHelper();
       return   mysqlhelper.UpdatePower(user);
 }
Esempio n. 13
0
 public string UpdateCurrentLevel([FromBody]User user)
 {
     MysqlHelper mysqlhelper = new MysqlHelper();
     return mysqlhelper.UpdateCurrentLevel(user);
 }
Esempio n. 14
0
        public Baidu_Data Updatechapter(string id)
        {
            //string chapter = Regex.Match(data, @"\[(.*?)\]").Groups[1].ToString();
            UserHelper userhelper = new UserHelper();
            MysqlHelper mysqlhelper = new MysqlHelper();
            User one_user = new User();
            one_user.Id = id;
            one_user =mysqlhelper.CheckStatus(one_user);
               string old_result=  HandleU_Chapter(one_user);
            Seed final_tree =   userhelper.HandleBaidu(one_user);
            int change_status = 0;
            try
            {
                if ((DateTime.Now - DateTime.Parse(one_user.last_update)).Days > 7)
                {
                    change_status = 1;
                }
            }
            catch (Exception t)
            {
                change_status = 1;
            }
            string result = "";
            if (final_tree == null)
            {
                return null;
            }
            foreach (Seed seed in final_tree.children)
            {
                result += seed.Degree_1 + ",";
            }
            result = result.Substring(0, result.Length - 1);
            try
            {
                string old_date_string = Regex.Match(one_user.u_Chapter, "(.*?):").Groups[1].ToString();
                DateTime old_date = Convert.ToDateTime(old_date_string);
                if (change_status == 1)
                {
                    mysqlhelper.UpdateChapter(id, result);
                }
            }
            catch
            {

            }
            Baidu_Data baidudata = new Baidu_Data();
            baidudata.RadarNow = result;
            baidudata.RadarOld = old_result;
            return baidudata;
               // return mysqlhelper.UpdateChapter(id,chapter);
        }