/// <summary> /// 调整页面顺序 /// </summary> /// <param name="context"></param> public void pageSort(HttpContext context) { string pageid = HttpContext.Current.Request["pageid"]; string num = HttpContext.Current.Request["num"]; sceneBll bll = new sceneBll(); if (bll.UpdateSize(int.Parse(pageid), int.Parse(num))) { string sucStr = @" { 'success': true, 'code': '200', 'msg': '操作成功', 'obj': null, 'map': null, 'list': null }"; context.Response.Write(MentStr(sucStr)); } else { string failStr = @" { 'success': false, 'code': '403', 'msg': '页面顺序调整失败', 'obj': null, 'map': null, 'list': null }"; context.Response.Write(MentStr(failStr)); } }
/// <summary> /// 删除页面 /// </summary> /// <param name="context"></param> public void delPage(HttpContext context) { string id = HttpContext.Current.Request["id"]; sceneBll bll = new sceneBll(); string sceneCode = bll.DeletePage(id);//获取场景编码 if (sceneCode != "") { string msg = @"{ 'success': true, 'code': '200', 'msg': '删除成功', 'obj': null, 'map': null, 'list': null}"; context.Response.Write(MentStr(msg)); } else { string msg = @"{ 'success': false, 'code': '403', 'msg': '创建新页面失败', 'obj': null, 'map': null, 'list': null }"; context.Response.Write(MentStr(msg)); } }
/// <summary> /// 赠送场景 /// </summary> /// <param name="context"></param> public void GiveSence(HttpContext context) { if (HttpContext.Current.Session["userID"] != null) { sceneBll bll = new sceneBll(); string id = HttpContext.Current.Request.Form["id"]; string uName = HttpContext.Current.Request.Form["uName"]; show_userBll ubll = new show_userBll(); string uid = ubll.GetUidByuserName(uName); if (uid == "") { context.Response.Write("{\"status\":\"-1\"}"); return; } if (bll.CopeSence(id, uid)) { context.Response.Write("{\"status\":\"0\"}"); return; } else { context.Response.Write("{\"status\":\"-1\"}"); return; } } else { context.Response.Write("{\"status\":\"-1\"}"); return; } }
/// <summary> /// 获取此人的场景列表 /// </summary> /// <param name="context"></param> public void GetSence(HttpContext context) { if (HttpContext.Current.Session["userID"] != null) { string userId = HttpContext.Current.Session["userID"].ToString(); string selectStr = HttpContext.Current.Request.Form["selectStr"]; string hnagye = HttpContext.Current.Request.Form["hnagye"]; string PageInt = HttpContext.Current.Request.Form["PageInt"]; string CountRow = HttpContext.Current.Request.Form["CountRow"]; sceneBll bll = new sceneBll(); DataTable dt = bll.GetSenceByUserId(userId, selectStr, hnagye, int.Parse(PageInt), int.Parse(CountRow)); if (dt == null) { context.Response.Write("{\"status\":\"-1\"}"); return; } string json = f.ToJson(dt); json = json.Replace("\"", "\\\""); context.Response.Write("{\"status\":\"" + json + "\"}"); } else { context.Response.Write("{\"status\":\"-1\"}"); return; } }
/// <summary> /// 修改页面名称 /// </summary> /// <param name="context"></param> public void savePageName(HttpContext context) { sceneBll bll = new sceneBll(); string id = HttpContext.Current.Request["id"]; string name = HttpContext.Current.Request["name"]; if (bll.UpdatePageName(id, name)) { string sucStr = @"{ 'success': true, 'code': '200', 'msg': '操作成功', 'obj': null, 'map': null, 'list': null }"; context.Response.Write(MentStr(sucStr)); } else { string failStr = @"{ 'success': false, 'code': '403', 'msg': '页面名称保存失败', 'obj': null, 'map': null, 'list': null }"; context.Response.Write(MentStr(failStr)); } }
/// <summary> /// 获取文件列表 /// </summary> /// <param name="context"></param> /// <returns></returns> public void getFileList(HttpContext context) { string pageNo = HttpContext.Current.Request["pageNo"]; string pageSize = HttpContext.Current.Request["pageSize"]; string fileType = HttpContext.Current.Request["fileType"]; string userId = HttpContext.Current.Session["userID"].ToString(); sceneBll bll = new sceneBll(); try { List <Model.file> list = bll.GetFileList(int.Parse(pageNo), int.Parse(pageSize), int.Parse(fileType), userId); StringBuilder lstr = new StringBuilder(); foreach (Model.file m in list) { lstr.Append(@"{ 'id': '" + m.Fileid + @"', 'name': '" + m.fileUserName + @"', 'extName': '" + m.extName + @"', 'fileType': '" + m.fileType + @"', 'bizType': '101', 'path': '" + m.path + @"', 'tmbPath': '" + m.path + @"', 'createTime': '" + m.addtime + @"', 'createUser': '******', 'sort': '0', 'size': '26', 'status': '1' },"); } //count总数 string msg = @"{ 'success': true, 'code': '200', 'msg': 'success', 'obj': null, 'map': { 'count': '" + bll.GetFileCount(userId, int.Parse(fileType)).ToString() + @"', 'pageNo': '" + pageNo + @"', 'pageSize': '" + pageSize + @"' }, 'list': [ " + lstr.ToString().Trim(',') + @" ] }"; context.Response.Write(MentStr(msg)); } catch (Exception ex) { string msg = @"{ 'success': false, 'code': '403', 'msg': '获取文件失败', 'obj': null, 'map': null, 'list': null }"; context.Response.Write(MentStr(msg)); } }
/// <summary> /// 上传文件(没有完成,文件上传) /// </summary> public void uploadFile(HttpContext context) { string name = null; string userimgName = ""; if (context.Request.Files.Count > 0) { XiuXiuPostImage img = new XiuXiuPostImage(context); name = img.Save(); userimgName = img.FileUserName; } // /upload/User201653198236.png string fileType = HttpContext.Current.Request["fileType"];//文件类型 string[] strArr = name.Split('/'); string fileName = strArr[strArr.Length - 1]; string filePath = name; string userId = HttpContext.Current.Session["userID"].ToString(); sceneBll bll = new sceneBll(); string id = bll.AddFile(fileName, filePath, userId, fileType, userimgName); if (id != "") { string msg = @"{ 'success': true, 'code': 200, 'msg': 'success', 'obj': { 'id': '" + id + @"', 'name': '" + fileName + @"', 'extName': '" + fileName.Split('.')[1] + @"', 'fileType': " + fileType + @", 'path': '" + filePath + @"', 'tmbPath': '" + filePath + @"', 'createTime': '" + DateTime.Now.ToString() + @"', 'createUser': '******', 'bizType': 0, 'sort': 0, 'size': 2, 'status': 1 }, 'map': null, 'list': null}"; context.Response.Write(MentStr(msg)); } else { string msg = @"{ 'success': false, 'code': 403, 'msg': '上传文件失败', 'obj': null, 'map': null, 'list': null }"; context.Response.Write(msg); } }
/// <summary> /// 获取场景基本属性信息 /// </summary> /// <param name="context"></param> public void pageList(HttpContext context) { //场景id string sceneCode = HttpContext.Current.Request["sceneCode"]; sceneBll sbll = new sceneBll(); List <Model.scene_pag> list = sbll.GetPageListBySceneCode(sceneCode); if (list.Count > 0) { //页面 StringBuilder pagestr = new StringBuilder(); foreach (Model.scene_pag m in list) { pagestr.Append(@"{ 'id': '" + m.scene_pag_id + @"', 'sceneId': '" + sceneCode + @"', 'num': '" + m.num + @"', 'name': '" + m.pageName + @"', 'properties': null, 'elements': null, 'scene': null },"); } //成功 string sucStr = @"{ 'success': true, 'code': '200', 'msg': 'success', 'obj': null, 'map': null, 'list': [ " + pagestr.ToString().Trim(',') + @" ] } "; context.Response.Write(MentStr(sucStr)); } else { //失败 string failStr = @"{ 'success': false, 'code': '403', 'msg': '基础数据服务器获取失败', 'obj': null, 'map': null, 'list': null }"; context.Response.Write(MentStr(failStr)); } }
/// <summary> /// 获取用户拥有场景的数量 /// </summary> /// <param name="context"></param> public void GetCount(HttpContext context) { if (HttpContext.Current.Session["userID"] != null) { sceneBll bll = new sceneBll(); int count = bll.GetSenceCount(HttpContext.Current.Session["userID"].ToString()); context.Response.Write("{\"status\":\"" + count + "\"}"); } else { context.Response.Write("{\"status\":\"-1\"}"); return; } }
/// <summary> /// 设置封面 /// </summary> /// <param name="context"></param> public void uploadCoverImg(HttpContext context) { string src = HttpContext.Current.Request["src"]; string fileType = HttpContext.Current.Request["fileType"]; string x = HttpContext.Current.Request["x"]; string y = HttpContext.Current.Request["y"]; string w = HttpContext.Current.Request["w"]; string h = HttpContext.Current.Request["h"]; string id = HttpContext.Current.Request["id"]; sceneBll bll = new sceneBll(); if (bll.UpdateCover(src, fileType, int.Parse(x), int.Parse(y), int.Parse(w), int.Parse(h), id)) { string msg = @"{ 'success':true, 'code':200, 'msg':'操作成功', 'obj':'" + src + @"', 'map': { 'id':25467357, 'path':'" + src + @"', 'src':'" + src + @"', 'y':'" + y + @"', 'w':'" + w + @"', 'h':'" + h + @"', 'x':'" + x + @"', 'index':'', 'fileType':'" + fileType + @"' }, 'list':null } "; context.Response.Write(MentStr(msg)); } else { string msg = @"{ 'success': false, 'code': 403, 'msg': '上传缩略图失败', 'obj': null, 'map': null, 'list': null } "; context.Response.Write(MentStr(msg)); } }
/// <summary> /// 创建模板 /// </summary> /// <param name="context"></param> public void CreateTemp(HttpContext context) { if (HttpContext.Current.Session["userID"] == null) { context.Response.Write("{\"status\":\"-1\"}"); return; } sceneBll bll = new sceneBll(); string hyid = HttpContext.Current.Request.Form["hyid"]; string userId = HttpContext.Current.Session["userID"].ToString(); string sceneCode = Guid.NewGuid().ToString(); bll.DefaultScene(userId, hyid, sceneCode); bll.DefaultScenePage(sceneCode); context.Response.Write("{\"status\":\"" + sceneCode + "\"}"); }
/// <summary> /// 获取场景基本配置 /// </summary> /// <param name="context"></param> public void getSceneSetting(HttpContext context) { string sceneId = HttpContext.Current.Request["sceneId"]; sceneBll bll = new sceneBll(); Model.scene m = bll.GetModel(sceneId); if (m != null) { string msg = @"{ 'success': true, 'code': '200', 'msg': 'success', 'obj': {'id': '" + sceneId + @"', 'name': '" + m.scene_name + @"', 'createUser': '******', 'type': '" + m.scene_custom_id + @"', 'createTime': '" + m.addtime + @"', 'cover': '" + m.cover + @"', 'code': '" + m.qrCode + @"', 'description':'" + m.des + @"', 'isTpl': '0', 'isShow': '0', 'updateTime': '" + m.addtime + @"', 'publishTime': '" + m.addtime + @"' },'map': null, 'list': null }"; context.Response.Write(MentStr(msg)); } else { string msg = @"{ 'success': false, 'code': '403', 'msg': '获取场景基本配置失败', 'obj': null, 'map': null, 'list': null } "; context.Response.Write(MentStr(msg)); } }
/// <summary> /// 保存页面信息 /// </summary> /// <param name="context"></param> public void savePage(HttpContext context) { string msg = ""; string id = HttpContext.Current.Request["id"]; string content_text = HttpContext.Current.Request["elements"]; string scene_code = HttpContext.Current.Request["sceneId"]; string pageName = HttpContext.Current.Request["name"]; string num = HttpContext.Current.Request["num"]; string bgAudio = HttpContext.Current.Request["bgAudio"]; sceneBll bll = new sceneBll(); Model.scene_pag mp = new Model.scene_pag(); mp.scene_pag_id = id; mp.content_text = content_text; mp.scene_code = scene_code; mp.pageName = pageName; mp.num = num; mp.bgAudio = bgAudio; if (bll.SavePage(mp)) { msg = @" { 'success': true, 'code': '200', 'msg': 'success', 'obj': null, 'map': null, 'list': null}"; } else { msg = @"{ 'success': false, 'code': '403', 'msg': '保存失败', 'obj': null, 'map': null, 'list': null }"; } context.Response.Write(MentStr(msg)); }
/// <summary> /// 删除文件(没有完成,文件删除) /// </summary> /// <param name="context"></param> public void delFile(HttpContext context) { string delid = ""; string fileid = HttpContext.Current.Request["fileid"]; string[] fileidlist = fileid.Split(','); foreach (string str in fileidlist) { delid += "'" + str + "',"; } sceneBll bll = new sceneBll(); if (bll.DeleteFile(delid.Trim(',')) != "") { string msg = @"{ 'success': true, 'code': '200', 'msg': 'success', 'obj': null, 'map': null, 'list': null } "; context.Response.Write(MentStr(msg)); } else { string msg = @"{ 'success': false, 'code': '403', 'msg': '删除文件失败', 'obj': null, 'map': null, 'list': null }"; context.Response.Write(MentStr(msg)); } }
/// <summary> /// 复制场景 /// </summary> /// <param name="context"></param> public void CopeSence(HttpContext context) { if (HttpContext.Current.Session["userID"] != null) { sceneBll bll = new sceneBll(); string id = HttpContext.Current.Request.Form["id"]; if (bll.CopeSence(id, HttpContext.Current.Session["userID"].ToString())) { context.Response.Write("{\"status\":\"0\"}"); return; } else { context.Response.Write("{\"status\":\"-1\"}"); return; } } else { context.Response.Write("{\"status\":\"-1\"}"); return; } }
/// <summary> /// 发布场景 /// </summary> /// <param name="context"></param> public void publish(HttpContext context) { string id = HttpContext.Current.Request["id"]; string name = HttpContext.Current.Request["name"]; string createUser = HttpContext.Current.Request["createUser"]; string type = HttpContext.Current.Request["type"]; string createTime = HttpContext.Current.Request["createTime"]; string cover = HttpContext.Current.Request["cover"]; string code = HttpContext.Current.Request["code"]; string description = HttpContext.Current.Request["description"]; sceneBll bll = new sceneBll(); if (bll.publish(id, name, createUser, type, createTime, cover, code, description) != "") { string msg = @" { 'success': true, 'code': 200, 'msg': 'success', 'obj': null, 'map': null, 'list': null }"; context.Response.Write(MentStr(msg)); } else { string msg = @" { 'success': false, 'code': 403, 'msg': '发布失败', 'obj': null, 'map': null, 'list': null }"; context.Response.Write(MentStr(msg)); } }
/// <summary> /// 预览场景 /// </summary> /// <param name="context"></param> public void preview(HttpContext context) { string id = HttpContext.Current.Request["id"]; sceneBll bll = new sceneBll(); Model.scene sm = bll.GetModel(id);//场景信息 if (sm.author != null) { List <Model.scene_pag> mplist = bll.GetPageListBySceneCode(id);//场景页面 StringBuilder pStr = new StringBuilder(); foreach (Model.scene_pag m in mplist) { pStr.Append(@"{'id': " + m.scene_pag_id + @", 'sceneId': '" + id + @"', 'num': '" + m.num + @"', 'name': '" + m.pageName + @"', 'properties': null, 'elements': " + (m.content_text == "" ? "[]" : m.content_text) + @" , 'scene': null},"); } string msg = @"{ 'success': true, 'code': '200', 'msg': '操作成功', 'obj': { 'id': '" + id + @"', 'name': '" + sm.scene_name + @"', 'createUser': '******', 'type':'" + sm.scene_custom_id + @"', 'pageMode': '" + sm.movietype + @"', 'cover': '" + sm.cover + @"', 'bgAudio':'" + sm.musicUrl + @"', 'code': '" + id + @"', 'description': '" + sm.des + @"', 'updateTime': '" + sm.addtime + @"', 'createTime': '" + sm.addtime + @"', 'publishTime': '" + sm.addtime + @"', 'property':{'triggerLoop':true,'eqAdType':1,'hideEqAd':false} }, 'map': null, 'list': [ " + pStr.ToString().Trim(',') + @" ] }"; context.Response.Write(MentStr(msg)); } else { TempsBll tbll = new TempsBll(); Model.temp tmodel = tbll.GetModelTemp(id);//模板信息 if (tmodel.author == null) { string msg = @" { 'success': false, 'code': '403', 'msg': '预览失败', 'obj': null, 'map': null, 'list': null }"; context.Response.Write(MentStr(msg)); } else { ///////////////////////////////////////////////////////// List <Model.temp_pag> mplist = tbll.GetPageListByTempCode(id);//场景页面 StringBuilder pStr = new StringBuilder(); foreach (Model.temp_pag m in mplist) { pStr.Append(@"{'id': " + m.pag_id + @", 'sceneId': '" + id + @"', 'num': '" + m.num + @"', 'name': '" + m.pageName + @"', 'properties': null, 'elements': " + (m.content_text == "" ? "[]" : m.content_text) + @" , 'scene': null},"); } string msg = @"{ 'success': true, 'code': '200', 'msg': '操作成功', 'obj': { 'id': '" + id + @"', 'name': '" + tmodel.temp_name + @"', 'createUser': '******', 'type':'" + tmodel.scene_custom_id + @"', 'pageMode': '" + tmodel.movietype + @"', 'cover': '" + tmodel.cover + @"', 'bgAudio':'" + tmodel.musicUrl + @"', 'code': '" + id + @"', 'description': '" + tmodel.des + @"', 'updateTime': '" + tmodel.addtime + @"', 'createTime': '" + tmodel.addtime + @"', 'publishTime': '" + tmodel.addtime + @"', 'property':{'triggerLoop':true,'eqAdType':1,'hideEqAd':false} }, 'map': null, 'list': [ " + pStr.ToString().Trim(',') + @" ] }"; context.Response.Write(MentStr(msg)); ///////////////////////////////////////////////////////// } } }
/// <summary> /// 复制页面 /// </summary> /// <param name="context"></param> public void copyPage(HttpContext context) { string id = HttpContext.Current.Request["id"]; sceneBll bll = new sceneBll(); string sceneCode = bll.CopyPage(id); Model.scene sm = bll.GetModel(sceneCode.Split('|')[0]);//获取场景信息 if (sceneCode != "") { string msg = @"{ 'success': true, 'code': '200', 'msg': 'success', 'obj': { 'id': '" + id + @"', 'sceneId': '" + sceneCode.Split('|')[0] + @"', 'num': '" + sceneCode.Split('|')[1] + @"', 'name': '" + sceneCode.Split('|')[2] + @"', 'properties': null, 'elements': null, 'scene': { 'id': '" + sceneCode.Split('|')[0] + @"', 'name': '" + sm.scene_name + @"', 'createUser': '******', 'createTime': '" + sm.addtime + @"', 'type': '" + sm.scene_typeid + @"', 'pageMode': '" + sm.movietype + @"', 'isTpl': '0', 'isPromotion': '0', 'status': '1', 'openLimit': '0', 'submitLimit': '0', 'startDate': null, 'endDate': null, 'accessCode': null, 'thirdCode': null, 'updateTime': '1426039827000', 'publishTime': '1426039827000', 'applyTemplate': '0', 'applyPromotion': '0', 'sourceId': null, 'code': 'U705UCE43R', 'description': '', 'sort': '0', 'pageCount': '0', 'dataCount': '0', 'showCount': '0', 'userLoginName': null, 'userName': null } }, 'map': null, 'list': null, 'iscopy':'true' }"; context.Response.Write(MentStr(msg)); } else { string msg = @"{ 'success': false, 'code': '403', 'msg': '创建新页面失败', 'obj': null, 'map': null, 'list': null }"; context.Response.Write(MentStr(msg)); } }
/// <summary> /// 获取场景页面属性 /// </summary> /// <param name="context"></param> public void design(HttpContext context) { //页面id string pageID = HttpContext.Current.Request["pageID"]; sceneBll sbll = new sceneBll(); Model.scene_pag mp = sbll.GetpageModel(pageID); if (mp != null) { //获取场景信息 Model.scene mc = sbll.GetModel(mp.scene_code); string sucStr = @"{ 'success': true, 'code': '200', 'msg': 'success', 'obj': { 'id': '" + pageID + @"', 'sceneId': '" + mp.scene_code + @"', 'num': '" + mp.num + @"', 'name': '" + mp.pageName + @"', 'properties': null, 'elements': " + (mp.content_text == "" ? "[]" : mp.content_text) + @" , 'scene': { 'id': '" + mp.scene_code + @"', 'name': '" + mc.scene_name + @"', 'createUser': '******', 'createTime': '" + mc.addtime + @"', 'type': '" + mc.scene_typeid + @"', 'pageMode': '" + mc.movietype + @"', 'bgAudio':'" + mc.musicUrl + @"', 'isTpl': '0', 'isPromotion': '0', 'status': '1', 'openLimit': '0', 'submitLimit': '0', 'startDate': null, 'endDate': null, 'accessCode': null, 'thirdCode': null, 'updateTime': '1426038857000', 'publishTime': '1426038857000', 'applyTemplate': '0', 'applyPromotion': '0', 'sourceId': null, 'code': '" + mp.scene_code + @"', 'description': '" + mc.des + @"', 'sort': '0', 'pageCount': '0', 'dataCount': '0', 'showCount': '0', 'userLoginName': null, 'userName': null } }, 'map': null, 'list': null }"; context.Response.Write(MentStr(sucStr)); } else { string failStr = @"{ 'success': false, 'code': '403', 'msg': '页面基础数据服务器获取失败', 'obj': null, 'map': null, 'list': null }"; context.Response.Write(MentStr(failStr)); } }