// GET: api/ImageMessage/5
        /// <summary>
        /// 返回自己的图片名
        /// </summary>
        /// <param name="account"></param>
        /// <returns></returns>
        public ReturnImageNameModel Get(string account)
        {
            ReturnImageNameModel returnModel = new ReturnImageNameModel();

            try
            {
                List <string> imageNameList = myConnent.MySqlRead("SELECT * FROM 图片表 WHERE Account ='" + account + "' AND IsDelete = '0'  ORDER BY DateTime DESC", "imageName");
                if (imageNameList[0] != "error")
                {
                    returnModel.result    = "true";
                    returnModel.imageName = imageNameList;
                    return(returnModel);
                }
                else
                {
                    returnModel.result = "error";
                    return(returnModel);
                }
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.ToString());
                returnModel.result = "error";
                return(returnModel);
            }
        }
Exemple #2
0
        // GET: api/Road/5
        /// <summary>
        /// 通过RoadID获取图片名
        /// </summary>
        /// <param name="RoadID"></param>
        /// <returns></returns>
        public ReturnImageNameByRoadID GetImageName(string RoadID)
        {
            ReturnImageNameByRoadID tmpModel = new ReturnImageNameByRoadID();
            List <string>           tmpList  = new List <string>();

            try
            {
                tmpList = myConnent.MySqlRead("SELECT * FROM 图片表 WHERE RoadID = '" + RoadID + "'  AND IsDelete = '0' ORDER BY DateTime DESC", "ImageName");
                Debug.WriteLine(tmpList);
                tmpModel.returnImageName = tmpList;
                return(tmpModel);
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.ToString());
                tmpList.Add("error");
                tmpModel.returnImageName = tmpList;
                return(tmpModel);
            }
        }
Exemple #3
0
        /// <summary>
        /// 获取已关注的人的列表
        /// </summary>
        /// <param name="account"></param>
        /// <returns></returns>
        public ReturnMyFollow Get(string account)
        {
            MysqlConnent myConnent = new MysqlConnent();

            ReturnMyFollow returnModel = new ReturnMyFollow();

            try
            {
                List <User> tmpUserList = new List <Models.User>();
                //select * from info where name regexp 'ic'
                //like "%2%"

                List <string> accountList = myConnent.MySqlRead("SELECT * FROM 关注表 WHERE FollowerAccount ='" + account + "'", "WasFollowederAccount");

                if (accountList[0] != "error")
                {
                    foreach (string wasFollowederAccount in accountList)
                    {
                        User tmpUser = new User();
                        tmpUser.account      = wasFollowederAccount;
                        tmpUser.email        = myConnent.MySqlReadReturn("SELECT * FROM 账号表 WHERE Account ='" + wasFollowederAccount + "'", "email");
                        tmpUser.sex          = myConnent.MySqlReadReturn("SELECT * FROM 账号表 WHERE Account ='" + wasFollowederAccount + "'", "sex");
                        tmpUser.userName     = myConnent.MySqlReadReturn("SELECT * FROM 账号表 WHERE Account ='" + wasFollowederAccount + "'", "userName");
                        tmpUser.introduction = myConnent.MySqlReadReturn("SELECT * FROM 账号表 WHERE Account ='" + wasFollowederAccount + "'", "introduction");
                        tmpUserList.Add(tmpUser);
                    }

                    returnModel.result   = "true";
                    returnModel.userList = tmpUserList;
                    return(returnModel);
                }
                else
                {
                    returnModel.result = "error";
                    return(returnModel);
                }
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.ToString());
                returnModel.result = "error";
                return(returnModel);
            }
        }
        /// <summary>
        /// 通过图片id获取评论
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public CommentBackListModel Get(string imageName)
        {
            CommentBackListModel returnModel = new CommentBackListModel();

            try
            {
                List <CommentBackModel> tmpCommentList = new List <CommentBackModel>();
                //select * from info where name regexp 'ic'
                //like "%2%"

                List <string> commentIDList = myConnent.MySqlRead("SELECT * FROM 评论表 WHERE ImageName ='" + imageName + "'", "CommentID");

                if (commentIDList[0] != "error")
                {
                    foreach (string commentID in commentIDList)
                    {
                        CommentBackModel tmpComment = new CommentBackModel();
                        tmpComment.account   = myConnent.MySqlReadReturn("SELECT * FROM 评论表 WHERE CommentID ='" + commentID + "' AND (IsCheck = '1' OR IsCheck = '0')", "Account");
                        tmpComment.comment   = myConnent.MySqlReadReturn("SELECT * FROM 评论表 WHERE CommentID ='" + commentID + "' AND (IsCheck = '1' OR IsCheck = '0')", "Comment");
                        tmpComment.dateTime  = myConnent.MySqlReadReturn("SELECT * FROM 评论表 WHERE CommentID ='" + commentID + "' AND (IsCheck = '1' OR IsCheck = '0')", "DateTime");
                        tmpComment.imageName = imageName;
                        tmpComment.commentID = commentID;
                        tmpCommentList.Add(tmpComment);
                    }

                    returnModel.result          = "true";
                    returnModel.commentBackList = tmpCommentList;
                    return(returnModel);
                }
                else
                {
                    returnModel.result = "error";
                    return(returnModel);
                }
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.ToString());
                returnModel.result = "error";
                return(returnModel);
            }
        }
Exemple #5
0
        // POST: api/User_Find
        /// <summary>
        /// 查找用户
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public ReturnFindUser Post([FromBody] FindUser value)
        {
            ReturnFindUser returnModel = new ReturnFindUser();

            try
            {
                List <User> tmpUserList = new List <Models.User>();
                //select * from info where name regexp 'ic'
                //like "%2%"

                List <string> accountList = myConnent.MySqlRead("SELECT * FROM 账号表 WHERE Account Like '%" + value.account + "%' OR UserName Like '%" + value.account + "%'", "Account");

                if (accountList[0] != "error")
                {
                    foreach (string account in accountList)
                    {
                        User tmpUser = new User();
                        tmpUser.account      = account;
                        tmpUser.email        = myConnent.MySqlReadReturn("SELECT * FROM 账号表 WHERE Account ='" + account + "'", "email");
                        tmpUser.sex          = myConnent.MySqlReadReturn("SELECT * FROM 账号表 WHERE Account ='" + account + "'", "sex");
                        tmpUser.userName     = myConnent.MySqlReadReturn("SELECT * FROM 账号表 WHERE Account ='" + account + "'", "userName");
                        tmpUser.introduction = myConnent.MySqlReadReturn("SELECT * FROM 账号表 WHERE Account ='" + account + "'", "introduction");
                        tmpUserList.Add(tmpUser);
                    }

                    returnModel.result   = "true";
                    returnModel.userList = tmpUserList;
                    return(returnModel);
                }
                else
                {
                    returnModel.result = "error";
                    return(returnModel);
                }
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.ToString());
                returnModel.result = "error";
                return(returnModel);
            }
        }