예제 #1
0
        public ActionResult AuditSong(SongBookEntity song)
        {
            Admin admin  = SessionHelper.GetUser(Session);
            var   result = songAuditRepository.AuditSong(song, admin.UserName);

            return(Json(new { status = result }, JsonRequestBehavior.AllowGet));
        }
예제 #2
0
        /// <summary>
        /// 主要用于后台上传和修改歌曲
        /// </summary>
        /// <param name="songBookEntity"></param>
        /// <returns></returns>
        public Tuple <bool, SongBookEntity> AddOrUpdateSong(SongBookEntity songBookEntity)
        {
            SongBookEntity updateEntity = songBookEntity;
            int            result       = 0;

            if (songBookEntity.Id > 0)
            {
                result = helper.Execute($@"update SongBook set SongName='{songBookEntity.SongName}',
                    SingerName='{songBookEntity.SingerName}',SongMark='{songBookEntity.SongMark}',
                    SongPath='{songBookEntity.SongPath}',SongBPM='{songBookEntity.SongBPM}',
                    ExpirationTime='{songBookEntity.ExpirationTime}' where Id={songBookEntity.Id}");
            }
            else
            {
                var p = new DynamicParameters();
                p.Add("@Id", dbType: DbType.Int32, direction: ParameterDirection.Output);
                result = helper.Execute($@"insert into SongBook (SongName,SingerName,SongMark,SongPath,SongBPM,
ExpirationTime,AuditStatus,SongLength,UploadTime,Status) 
                    values ('{songBookEntity.SongName}','{songBookEntity.SingerName}','{songBookEntity.SongMark}',
'{songBookEntity.SongPath}','{songBookEntity.SongBPM}','{songBookEntity.ExpirationTime}',{2},
'{songBookEntity.SongLength}','{DateTime.Now}',{1});SELECT @Id=SCOPE_IDENTITY()", p);
                var id = p.Get <int>("@Id");
                songBookEntity.Id = id;
                helper.Execute($@"insert into SongOptDetail (SongId,Note,OptType,OptTime) values(
                {id},'上传歌曲',{1},'{DateTime.Now}')");
            }
            return(Tuple.Create(result > 0 ? true : false, updateEntity));
        }
예제 #3
0
        /// <summary>
        /// 审核歌曲
        /// </summary>
        /// <param name="song"></param>
        /// <returns></returns>
        public bool AuditSong(SongBookEntity song, string adminName)
        {
            if (song.AuditStatus == 3)//不通过 需要通知歌手
            {
                helper.Execute($@"insert into SysNotice (Title,Content,UserId,NoticeTime) 
values ('歌曲审核未通过','{song.Memo}',{song.SingerId},'{DateTime.Now}')");
            }
            else if (song.AuditStatus == 2) //审核通过
            {
                helper.Execute($@"insert into SysNotice (Title,Content,UserId,NoticeTime) 
values ('歌曲审核通过','{song.Memo}',{song.SingerId},'{DateTime.Now}')");
            }
            string sql = $@"update SongBook set AuditStatus={song.AuditStatus},SongMark='{song.SongMark}',SongBPM='{song.SongBPM}'
 where Id={song.Id};
insert into SongOptDetail (SongId,Note,AuditStatus,OptType,OptTime,SongName,AuditAdminName) values(
                {song.Id},'{song.Memo}',{song.AuditStatus},{4},'{DateTime.Now}','{song.SongName}','{adminName}')";

            return(helper.Execute(sql) > 0 ? true : false);
        }
예제 #4
0
        public ActionResult AddOrUpdateSong(SongBookEntity songBookEntity)
        {
            var result = songBookRepository.AddOrUpdateSong(songBookEntity);

            return(Json(new { status = result.Item1, data = result.Item2 }, JsonRequestBehavior.AllowGet));
        }