| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- 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<string, string> getAppFile(AppProjectVersion ver, List<AppProjectPage> pages, List<AppProjectBottom> 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<string, string> dic = new Dictionary<string, string>();
- 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<int>("ProjectMakeProcess:" + projectId);
- step += 10;
- if (step > 100)
- {
- step = 100;
- }
- RedisServer.Cache.Set("ProjectMakeProcess:" + projectId, step, 60);
- }
- }
- }
|