using Vo; using Microsoft.AspNetCore.Mvc; using Model; using Services; using Model.Base; using Vo.Admin; using Mapster; using Infrastructure; using Common; using Dto; namespace Controllers.Admin { /// /// AppSourceVersion)Controller /// // [Route("${Router}$")] // [ApiExplorerSettings(GroupName = "AppSourceVersion")] public class AppSourceVersionController : BaseController { /// /// api分组接口 /// private readonly IAppSourceSetService _AppSourceSetService; private readonly IAppSourceVersionService _AppSourceVersionService; public AppSourceVersionController(IAppSourceVersionService AppSourceVersionService, IAppSourceSetService AppSourceSetService) { _AppSourceVersionService = AppSourceVersionService; _AppSourceSetService = AppSourceSetService; } /// 分页参数 /// /// 列表 /// /// 分页对象 /// 参数请求体 /// 列表 [HttpGet] [Route("/v1/api/AppSourceVersion/getAppSourceVersionList")] public IActionResult getAppSourceVersionList([FromQuery] PagerInfo page, [FromQuery] AppSourceVersion param) { var response = _AppSourceVersionService.getAppSourceVersionList(page, param.sourceId); return SUCCESS(response); } /// /// 详情 /// /// 参数请求体 /// 详情 [HttpGet] [Route("/v1/api/AppSourceVersion/getAppSourceVersionQuery")] public IActionResult getAppSourceVersionQuery([FromQuery] AppSourceVersion param) { var response = _AppSourceVersionService.GetFirst(m => m.id == param.id).Adapt(); return SUCCESS(response); } /// /// 添加 /// /// 参数请求体 /// 添加 [HttpPost] [Route("/v1/api/AppSourceVersion/addAppSourceVersion")] public IActionResult addAppSourceVersion([FromBody] AppSourceVersionDto param) { var modal = param.Adapt().ToCreate(HttpContext); var response = _AppSourceVersionService.InsertReturnIdentity(modal); return SUCCESS(response); } /// /// 修改 /// /// 参数请求体 /// 修改 [HttpPut] [Route("/v1/api/AppSourceVersion/updateAppSourceVersion")] public IActionResult updateAppSourceVersion([FromBody] AppSourceVersion param) { var modal = param.Adapt().ToCreate(HttpContext); var response = _AppSourceVersionService.Update(modal, true); return SUCCESS(response); } /// /// 删除 /// /// ID /// 删除 [HttpDelete] [Route("/v1/api/AppSourceVersion/deleteAppSourceVersion/{id}")] public IActionResult deleteAppSourceVersion(int id) { var response = _AppSourceVersionService.Delete(id); return SUCCESS(response); } /// /// 配置文件 /// /// 参数请求体 /// 配置文件 [HttpGet] [Route("/v1/api/AppSourceVersion/getAppSourceVersionSetFile")] public IActionResult getAppSourceVersionSetFile([FromQuery] AppSourceVersion param) { Dictionary obj = new Dictionary(); var version = _AppSourceVersionService.GetFirst(m => m.id == param.id); if(version != null) { var set = _AppSourceSetService.GetFirst(m => m.id == version.sourceId); if(set != null) { string androidUrl = Function.GetWebRequest("https://filemaker.kexiaoshuang.com/noauth/pageinfo?c=android&v=" + version.appVersion + "&k=" + set.kind + "&p=" + set.projectId); string appleUrl = Function.GetWebRequest("https://filemaker.kexiaoshuang.com/noauth/pageinfo?c=ios&v=" + version.appVersion + "&k=" + set.kind + "&p=" + set.projectId); obj.Add("androidUrl", androidUrl); obj.Add("appleUrl", appleUrl); } } return SUCCESS(obj); } /// /// 资源文件 /// /// 参数请求体 /// 资源文件 [HttpGet] [Route("/v1/api/AppSourceVersion/getAppSourceVersionSourceFile")] public IActionResult getAppSourceVersionSourceFile([FromQuery] AppSourceVersion param) { Dictionary obj = new Dictionary(); var version = _AppSourceVersionService.GetFirst(m => m.id == param.id); if(version != null) { var set = _AppSourceSetService.GetFirst(m => m.id == version.sourceId); if(set != null) { string staticUrl = Function.GetWebRequest("https://filemaker.kexiaoshuang.com/noauth/static?v=" + version.appVersion + "&k=" + set.kind + "&p=" + set.projectId); obj.Add("staticUrl", staticUrl); } } return SUCCESS(obj); } } }