| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- using Attribute;
- using Common;
- using Dto;
- using Vo;
- using Enums;
- using Filters;
- using Infrastructure;
- using Infrastructure.Model;
- using Mapster;
- using Microsoft.AspNetCore.Mvc;
- using Middleware;
- using Model;
- using Services;
- using Model.Base;
- using System.IO.Compression;
- namespace Controllers
- {
- /// <summary>
- /// PageUpdateInfo)Controller
- /// </summary>
- // [Route("PageUpdateInfo")]
- // [ApiExplorerSettings(GroupName = "PageUpdateInfo")]
- public class PageUpdateInfoController : BaseController
- {
- private readonly IPageUpdateInfoService _PageUpdateInfoService;
- private readonly IAppBottomNavsService _AppBottomNavsService;
- private readonly IFileUpdateInfoService _FileUpdateInfoService;
- public PageUpdateInfoController(IPageUpdateInfoService PageUpdateInfoService, IAppBottomNavsService AppBottomNavsService, IFileUpdateInfoService FileUpdateInfoService)
- {
- _PageUpdateInfoService = PageUpdateInfoService;
- _AppBottomNavsService = AppBottomNavsService;
- _FileUpdateInfoService = FileUpdateInfoService;
- }
- /// <summary>
- /// 生成APP配置文件
- /// </summary>
- /// <param name="parm">请求参数</param>
- /// <returns>生成APP配置文件</returns>
- [HttpGet]
- [Route("/noauth/SystemSet/makeAppInitData")]
- public string makeAppInitData([FromQuery] MakeAppInitDataDto parm)
- {
- string AppInfoList = _AppBottomNavsService.makeAppInitData(parm.kind, parm.appVersion);
- // Function.WriteLog(AppInfoList);
- string FileInfoList = _FileUpdateInfoService.makeAppInitData(parm.kind, parm.appVersion);
- string PageInfoList = _PageUpdateInfoService.makeAppInitData(parm.kind, parm.appVersion);
- return AppInfoList + "#cut#" + FileInfoList + "#cut#" + PageInfoList;
- }
- [HttpGet]
- [Route("/noauth/reg")]
- public IActionResult Register(string v = "4.4.0", string k = "creater", string c = "")
- {
- string appini = makeAppInitData(new MakeAppInitDataDto()
- {
- kind = k,
- appVersion = v,
- }); //Function.GetWebRequest("http://" + url + "/noauth/SystemSet/makeAppInitData?kind=" + k + "&appVersion=" + v);
- if (!string.IsNullOrEmpty(appini))
- {
- if (appini.Contains("#cut#"))
- {
- string[] appinidata = appini.Split(new string[] { "#cut#" }, StringSplitOptions.None);
- string AppInfoList = appinidata[0];
- string SystemSet = appinidata[1];
- string PageInfoList = appinidata[2];
- string GotoPages = appinidata[3];
- string LibFile = appinidata[4];
- AppInfoList = System.Text.RegularExpressions.Regex.Unescape(AppInfoList);
- SystemSet = System.Text.RegularExpressions.Regex.Unescape(SystemSet);
- PageInfoList = System.Text.RegularExpressions.Regex.Unescape(PageInfoList);
- GotoPages = System.Text.RegularExpressions.Regex.Unescape(GotoPages);
- LibFile = System.Text.RegularExpressions.Regex.Unescape(LibFile);
- string startPath = "";
- string zipPath = "";
- if(c == "ios")
- {
- Function.WritePage("ini", "AppInfoList.ini", AppInfoList);
- Function.WritePage("ini", "SystemSet.ini", SystemSet);
- Function.WritePage("ini", "PageInfoList.ini", PageInfoList);
- Function.WritePage("ini", "GotoPages.ini", GotoPages);
- Function.WritePage("ini", "LibFile.ini", LibFile);
- startPath = Function.getPath("ini");
- zipPath = Function.getPath("ini.zip");
- }
- else
- {
- Function.WritePage("txt", "AppInfoList.txt", AppInfoList);
- Function.WritePage("txt", "SystemSet.txt", SystemSet);
- Function.WritePage("txt", "PageInfoList.txt", PageInfoList);
- Function.WritePage("txt", "GotoPages.txt", GotoPages);
- Function.WritePage("txt", "LibFile.txt", LibFile);
- startPath = Function.getPath(path_str: "txt");
- zipPath = Function.getPath("txt.zip");
- }
- if(System.IO.File.Exists(zipPath))
- {
- System.IO.File.Delete(zipPath);
- }
- ZipFile.CreateFromDirectory(startPath, zipPath);
- var stream = System.IO.File.OpenRead(zipPath);
- return File(stream, "text/plain", Path.GetFileName(zipPath));
- }
- }
- return Content("fail");
- }
- }
- }
|