using System; using System.Web; using System.Collections.Generic; using System.Linq; using System.Data; using System.IO; using System.IO.Compression; using Infrastructure; using Customer.Source; using Common; namespace Util.MakeApp { public class MakeAppCodePub { public static Dictionary getAppFile(AppProjectVersion ver, List pages, List bottoms, string htmlPath) { foreach (AppProjectBottom bottominfo in bottoms) { string selectIcon = "/static/bottom/" + bottominfo.selectIcon.Substring(bottominfo.selectIcon.LastIndexOf("/") + 1); bottominfo.selectIcon = selectIcon; string normalIcon = "/static/bottom/" + bottominfo.normalIcon.Substring(bottominfo.normalIcon.LastIndexOf("/") + 1); bottominfo.normalIcon = normalIcon; string pagDefaultIcon = "/static/bottom/" + bottominfo.pagDefaultIcon.Substring(bottominfo.pagDefaultIcon.LastIndexOf("/") + 1); bottominfo.pagDefaultIcon = pagDefaultIcon; string pagLocalPath = "/static/bottom/" + bottominfo.pagLocalPath.Substring(bottominfo.pagLocalPath.LastIndexOf("/") + 1); bottominfo.pagLocalPath = pagLocalPath; } foreach(var page in pages) { if (page.leftBtn != null) { foreach (var btn in page.leftBtn) { if (!string.IsNullOrEmpty(btn.btnIcon)) { string btnIcon = "static/page/" + btn.btnIcon.Substring(btn.btnIcon.LastIndexOf("/") + 1); btn.btnIcon = btnIcon; } } } if (page.rightBtn != null) { foreach (var btn in page.rightBtn) { if(!string.IsNullOrEmpty(btn.btnIcon)) { string btnIcon = "static/page/" + btn.btnIcon.Substring(btn.btnIcon.LastIndexOf("/") + 1); btn.btnIcon = btnIcon; } } } } Dictionary dic = new Dictionary(); string str = Newtonsoft.Json.JsonConvert.SerializeObject(bottoms); str = Dbconn.Encrypt3DES(str, "*ga34|^7"); dic.Add("AppInfoList", str); string PageInfoList = "{"; string LibFile = "{"; foreach (AppProjectPage pageinfo in pages) { string FileName = pageinfo.modulePath.Split('.')[0]; pageinfo.dataId = Function.MD5_16(pageinfo.id.ToString() + "123890"); PageInfoList += "\"page" + FileName + "\":" + Newtonsoft.Json.JsonConvert.SerializeObject(pageinfo) + ","; // string PagePath = "/app/" + ver.appId + "/" + ver.version + "/" + pageinfo.modulePath; string pageContent = Function.ReadInstanceByFull(htmlPath + pageinfo.moduleFile); pageContent = Dbconn.Encrypt3DES(pageContent, "*ga34|^7"); LibFile += "\"page" + FileName + "\":\"" + pageContent + "\","; } PageInfoList = PageInfoList.TrimEnd(','); PageInfoList += "}"; LibFile = LibFile.TrimEnd(','); LibFile += "}"; str = Dbconn.Encrypt3DES(PageInfoList, "*ga34|^7"); dic.Add("PageInfoList", str); str = Dbconn.Encrypt3DES(LibFile, "*ga34|^7"); dic.Add("LibFile", str); return dic; } public static void ProcessSet(int projectId) { int step = RedisServer.Cache.Get("ProjectMakeProcess:" + projectId); step += 10; if (step > 100) { step = 100; } RedisServer.Cache.Set("ProjectMakeProcess:" + projectId, step, 60); } } }