Example #1
0
        public string AddSongMenuToUser([FromBody] object json)
        {
            JObject  j = JObject.Parse(json.ToString());
            SongMenu s = new SongMenu()
            {
                M_Img          = "/Default/AddDafaultMenu.jpg",
                M_Info         = "暂无简介",
                M_Name         = j["name"].ToString(),
                M_Type         = 1,
                M_UserId       = int.Parse(j["uid"].ToString()),
                M_SongId       = "",
                M_CollectCount = 0,
                M_PlayCount    = 0,
                M_CreatTime    = DateTime.Now
            };

            try
            {
                int mid = SongMenuService.CreatInitSongMenu(s);
                // 将创建的歌单添加到用户表字段中
                if (SongMenuService.AddSongMenu(s.M_UserId, mid, 1) == "创建成功")
                {
                    return(mid + "");
                }
                else
                {
                    return("失败");
                }
            }
            catch (Exception)
            {
                return("失败");
            }
        }
Example #2
0
 public string AddPlayCount(int id)
 {
     if (SongMenuService.AddPlayCount(id))
     {
         return("成功");
     }
     else
     {
         return("失败");
     }
 }
Example #3
0
        public string Register()
        {
            HttpContextBase contextBase = (HttpContextBase)Request.Properties["MS_HttpContext"];
            HttpRequestBase requestBase = contextBase.Request;

            UserInfo u = new UserInfo()
            {
                U_Name             = requestBase.Form["email"].ToString(),
                U_Pwd              = requestBase.Form["pwd"].ToString(),
                U_Email            = requestBase.Form["email"].ToString(),
                U_Img              = "/Default/PhotoDefault.jpg",
                U_Fans             = "",              //粉丝
                U_CreatSongMenu    = "",              //创建的歌单
                U_CollectSongMenu  = "",              //收藏的歌单
                U_Hobby            = "",              //爱好
                U_Tell             = "",              //电话
                U_Info             = "这个人很懒 还没有填写哦~", //个人介绍
                U_Like             = "",
                U_Follow           = "",              //关注
                U_Gender           = "男",             //性别
                U_Birthday         = DateTime.Now,
                U_RegistrationTime = DateTime.Now
            };
            int uid = UserInfoService.AddUserInfo(u);

            if (uid != 0)
            {
                //初始化用户信息  --创建默认歌单 我的喜欢
                int sid = SongMenuService.CreatInitSongMenu(uid);
                //将创建的歌曲id 添加到用户创建列表
                if (sid != 0)
                {
                    try
                    {
                        if (SongMenuService.AddSongMenu(uid, sid, 1) == "创建成功")
                        {
                            return("注册成功");
                        }
                    }
                    catch (Exception e)
                    {
                        //用户不存在
                        return(e.Message);
                    }
                }
                return("注册成功,用户信息初始化失败");
            }
            else
            {
                return("注册失败,当前账号已存在或服务器错误");
            }
        }
Example #4
0
        public string AddSongMenuComment([FromBody] object json)
        {
            JObject j = JObject.Parse(json.ToString());
            //获取评论内容
            string      mid     = j["mid"].ToString();
            string      pid     = j["pid"].ToString();
            string      content = j["content"].ToString();
            string      from    = j["from"].ToString();
            string      to      = j["to"].ToString();
            MenuComment c       = new MenuComment();

            if (mid != "")
            {
                c.SM_Menu = int.Parse(mid);
            }
            else
            {
                return("参数不完整");
            }
            if (pid != "")
            {
                c.SM_Pid = int.Parse(pid);
            }
            if (content != "")
            {
                c.SM_Content = content;
            }
            else
            {
                return("参数不完整");
            }
            if (from != "")
            {
                c.SM_From_User = int.Parse(from);
            }
            else
            {
                return("参数不完整");
            }
            if (to != "")
            {
                c.SM_To_User = int.Parse(to);
            }
            else
            {
                c.SM_To_User = int.Parse(from);
            }
            c.SM_UpTime = DateTime.Now;
            return(SongMenuService.AddSongMenuComment(c));
        }
Example #5
0
        public string UpSongMenuInfo([FromBody] object json)
        {
            JObject  j = JObject.Parse(json.ToString());
            SongMenu s = new SongMenu()
            {
                M_Id = int.Parse(j["mid"].ToString()),
                //M_Img = j["img"].ToString(),
                M_Info = j["info"].ToString(),
                M_Name = j["name"].ToString(),
                M_Type = int.Parse(j["type"].ToString())
            };

            return(SongMenuService.UpSongMenuInfo(s));
        }
Example #6
0
        public Dictionary <string, object> SelSongMenuByID(int id)
        {
            Dictionary <string, object> dic = new Dictionary <string, object>();
            var m = SongMenuService.SelSongMenuByID(id);

            if (m != null)
            {
                string   songID      = m.GetType().GetProperty("M_SongId").GetValue(m).ToString();
                string[] songMenuNum = songID?.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                var      song        = SongListService.SelSongListByMenu(songMenuNum);
                dic.Add("songMenuInfo", m);
                dic.Add("songInfo", song);
            }
            return(dic);
        }
Example #7
0
        public Dictionary <string, object> SelUserInfoByID(int id)
        {
            Dictionary <string, object> dic = new Dictionary <string, object>();
            var u = UserInfoService.SelUserInfoByID(id);

            if (u != null)
            {
                string[] creatSongMenu   = u.U_CreatSongMenu?.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                string[] collectSongMenu = u.U_CollectSongMenu?.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                var      creatSong       = SongMenuService.SelSongMenuByUser(creatSongMenu);
                var      collectSong     = SongMenuService.SelSongMenuByUser(collectSongMenu);
                dic.Add("userInfo", u);
                dic.Add("creatSongMenu", creatSong);
                dic.Add("collectSongMenu", collectSong);
            }
            return(dic);
        }
Example #8
0
 public string IsCollect(int uid, int mid)
 {
     try
     {
         if (SongMenuService.IsCollect(uid, mid))
         {
             return("已收藏");
         }
         else
         {
             return("未收藏");
         }
     }
     catch (Exception e)
     {
         return(e.Message);
     }
 }
Example #9
0
        public Dictionary <string, object> SelSongMenuByTypeID(int id, int top = 30, int page = 0)
        {
            Dictionary <string, object> dic = new Dictionary <string, object>();
            int count;

            if (id == 0)
            {
                dic.Add("SongMenus", SongMenuService.GetSongMenus(out count, top, page));
            }
            else
            {
                dic.Add("SongMenus", SongMenuService.SelSongMenuByTypeID(out count, id, top, page));
            }
            int pageSize = count % top == 0 ? count / top : (count / top) + 1;

            dic.Add("count", count);
            dic.Add("pageSize", pageSize);
            return(dic);
        }
Example #10
0
        public string SongMenuImgUpLoad()
        {
            HttpContextBase context   = (HttpContextBase)Request.Properties["MS_HttpContext"]; //获取传统context
            HttpRequestBase request   = context.Request;                                       //定义传统request对象
            int             mid       = int.Parse(request.Form["id"].ToString());
            string          resultUrl = Upload(request.Files[0], "SongMenu");

            if (resultUrl == "")
            {
                resultUrl = "文件过大,将文件大小控制在25M内";
            }
            else
            {
                //更新用户头像
                SongMenuService.UpSongMenuImg(mid, resultUrl);
            }
            string ResultJson = JsonConvert.SerializeObject(resultUrl);

            return(ResultJson);
        }
Example #11
0
 public List <CommModel> GetSongMenuComm(int id)
 {
     //Dictionary<string,object>
     return(SongMenuService.GetSongMenuComm(id));
 }
Example #12
0
 public string AddCollectSongMenu(int uid, int mid)
 {
     return(SongMenuService.AddSongMenu(uid, mid, 2));
 }
Example #13
0
 public string RmCollectSongMenu(int uid, int mid)
 {
     return(SongMenuService.AddSongMenu(uid, mid, 2, true));
 }
Example #14
0
 public string RmCreateSongMenu(int uid, int mid)
 {
     return(SongMenuService.AddSongMenu(uid, mid, 1, true));
 }
Example #15
0
 public string RMCollecting(int uID, int songID, int muneID)
 {
     //取消收藏
     return(SongMenuService.AddSongToMenu(uID, songID, muneID, true));
 }
Example #16
0
 public string AddCollecting(int uID, int songID, int muneID)
 {
     //添加收藏
     return(SongMenuService.AddSongToMenu(uID, songID, muneID, false));
 }