|
@@ -0,0 +1,53 @@
|
|
|
+using System;
|
|
|
+using System.Collections.Generic;
|
|
|
+using System.Linq;
|
|
|
+using Microsoft.AspNetCore.Mvc;
|
|
|
+using Microsoft.AspNetCore.Http;
|
|
|
+using Microsoft.Extensions.Logging;
|
|
|
+using Microsoft.Extensions.Options;
|
|
|
+using Microsoft.AspNetCore.Authorization;
|
|
|
+using System.Web;
|
|
|
+using MySystem.BsModels;
|
|
|
+using LitJson;
|
|
|
+using Library;
|
|
|
+
|
|
|
+namespace MySystem.Areas.Api.Controllers.v1
|
|
|
+{
|
|
|
+ [Area("Api")]
|
|
|
+ [Route("Api/v1/[controller]/[action]")]
|
|
|
+ public class AppVersionController : Admin.Controllers.BaseController
|
|
|
+ {
|
|
|
+ public AppVersionController(IHttpContextAccessor accessor, ILogger<Admin.Controllers.BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
|
|
|
+ {
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ #region 商户-检查更新
|
|
|
+ // [Authorize]
|
|
|
+ public JsonResult Detail(string value)
|
|
|
+ {
|
|
|
+ value = DesDecrypt(value);
|
|
|
+ JsonData data = JsonMapper.ToObject(value);
|
|
|
+ string VersionNum = data["VersionNum"].ToString(); //版本号
|
|
|
+ string ClientType = data["ClientType"].ToString(); //终端类型
|
|
|
+ string Role = data["Role"].ToString(); //角色,1-商户,2-创客
|
|
|
+ Dictionary<string, object> Obj = new Dictionary<string, object>();
|
|
|
+ AppVersion query = RedisDbconn.Instance.Get<AppVersion>("AppVersion:Last:" + Role + ":" + ClientType) ?? new AppVersion();
|
|
|
+ if (VersionNum == query.VersionNum)
|
|
|
+ {
|
|
|
+ return Json(new AppResultJson() { Status = "-1", Info = "已是最新版本", Data = Obj });
|
|
|
+ }
|
|
|
+ Obj.Add("CancelText", query.CancelText);
|
|
|
+ Obj.Add("ConfirmText", query.ConfirmText);
|
|
|
+ Obj.Add("Info", query.Info);
|
|
|
+ Obj.Add("Title", query.Title);
|
|
|
+ Obj.Add("VersionNum", query.VersionNum); //版本号
|
|
|
+ Obj.Add("Status", query.Status); //状态
|
|
|
+ Obj.Add("DownloadUrl", query.DownloadUrl);
|
|
|
+ return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+ }
|
|
|
+}
|