Exemplo n.º 1
0
        /// <summary>
        /// 自定义开场白添加
        /// </summary>
        /// <param name="description"></param>
        /// <returns></returns>
        public ActionResult AddPrologues(string description)
        {
            ResourceBll resourceBll = new ResourceBll();
            var         audio       = BaiduApiBll.GetAudio(description);
            var         response    = Upload(audio);

            if (response.State)
            {
                var id = resourceBll.AddMediaObject((int)MediaObjectTypeEnum.音频, response.FileUrl, 0, 0, description, CurrentUserID);
                return(Json(new JsonResponse <int>()
                {
                    State = true, Data = id, ErrorMsg = "操作成功"
                }));
            }
            return(Json(new JsonResponse <int>()
            {
                State = false, Data = 0, ErrorMsg = "操作失败"
            }));
        }
Exemplo n.º 2
0
        public ActionResult AddPrologueDo(int Id, string description)
        {
            ResourceBll resourceBll = new ResourceBll();

            if (Id > 0)
            {
                var audio    = BaiduApiBll.GetAudio(description);
                var response = Upload(audio);
                if (response.State)
                {
                    resourceBll.UpdatePropogue(Id, description, response.FileUrl);
                    return(Json(new JsonSimpleResponse()
                    {
                        State = true, ErrorMsg = "操作成功"
                    }));
                }
            }
            else
            {
                var audio    = BaiduApiBll.GetAudio(description);
                var response = Upload(audio);
                if (response.State)
                {
                    resourceBll.AddMediaResource(new DtoResourceRequest {
                        Description = description, Url = response.FileUrl, MediaType = MediaResourceTypeEnum.开场语, MediaObjectType = MediaObjectTypeEnum.音频, State = 1, IsStatus = true
                    });
                    return(Json(new JsonSimpleResponse()
                    {
                        State = true, ErrorMsg = "操作成功"
                    }));
                }
            }
            return(Json(new JsonSimpleResponse()
            {
                State = false, ErrorMsg = "操作失败"
            }));
        }