2025-11-18 17:43:12 +08:00
|
|
|
|
using Gatedge.K3Cloud.Utils;
|
|
|
|
|
|
using Gatedge.K3Cloud.Utils.Common;
|
|
|
|
|
|
using Gatedge.K3Cloud.Utils.Model.K3Request;
|
|
|
|
|
|
using Gatedge.ScanCode.Common;
|
|
|
|
|
|
using Gatedge.ScanCode.Extension;
|
|
|
|
|
|
using Gatedge.ScanCode.Services;
|
|
|
|
|
|
using Gatedge.ScanCode.Services.IServices;
|
|
|
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Gatedge.ScanCode.Controllers
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 版本控制
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[Route("api/[controller]")]
|
|
|
|
|
|
[Authorize]
|
|
|
|
|
|
[ApiController]
|
|
|
|
|
|
public class VsersionController : ControllerBase
|
|
|
|
|
|
{
|
|
|
|
|
|
private readonly string _FormName = "扫码APP版本";
|
|
|
|
|
|
private readonly string _FormId = "k25663a1521d147669932af94b9146d86";
|
|
|
|
|
|
private readonly K3CloudApiUtils _utils;
|
|
|
|
|
|
private readonly IK3FileService _k3FileService;
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 构造方法
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="utils"></param>
|
|
|
|
|
|
/// <param name="k3FileService"></param>
|
|
|
|
|
|
public VsersionController(K3CloudApiUtils utils, IK3FileService k3FileService)
|
|
|
|
|
|
{
|
|
|
|
|
|
_utils = utils;
|
|
|
|
|
|
_k3FileService = k3FileService;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 获取最后的版本
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpGet("LastVersion")]
|
|
|
|
|
|
public AjaxResult LastVersion()
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
Query queryParam = new Query()
|
|
|
|
|
|
{
|
|
|
|
|
|
FormId = this._FormId,
|
|
|
|
|
|
FieldKeys = "FID",
|
|
|
|
|
|
OrderString = "FID desc"
|
|
|
|
|
|
};
|
2025-11-21 10:19:46 +08:00
|
|
|
|
//// 已审核
|
|
|
|
|
|
//FilterList filterString = new FilterList().AddAuditedItems();
|
|
|
|
|
|
//queryParam.FilterString = filterString.GetFilterString();
|
2025-11-18 17:43:12 +08:00
|
|
|
|
var loginInfo = User.GetLoginInfoByClaimsPrincipal();
|
|
|
|
|
|
// 需要获取具有BOS权限的用户
|
|
|
|
|
|
var k3Apiutil = _utils.GetDefaultK3CloudApiUtil(loginInfo);
|
|
|
|
|
|
IVsersionService service = new VsersionService(k3Apiutil);
|
|
|
|
|
|
var data = service.List(queryParam);
|
|
|
|
|
|
if (data.List.Count == 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
return AjaxResult.Error("没有找到App版本信息,请联系管理员!");
|
|
|
|
|
|
}
|
|
|
|
|
|
var lastVersion = data.List.First();
|
|
|
|
|
|
var dyobj = lastVersion;
|
|
|
|
|
|
var id = dyobj["FID"];
|
|
|
|
|
|
View viewBill = new View();
|
|
|
|
|
|
viewBill.Id = id.ToString();
|
|
|
|
|
|
var billData = service.View(viewBill);
|
|
|
|
|
|
var file = billData.FAppFile_Files.First();
|
|
|
|
|
|
_k3FileService.SetK3Util(k3Apiutil);
|
|
|
|
|
|
var fileFullName = _k3FileService.GetFilePath(billData.FAppFile_Files.First());
|
|
|
|
|
|
var result = AjaxResult
|
|
|
|
|
|
.Success(billData)
|
|
|
|
|
|
.AddBillId(_FormId);
|
|
|
|
|
|
result.Add("downloadUrl", $"/Download/{file.FileName}");
|
|
|
|
|
|
return result;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|