12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- 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 System.Web;
- using MySystem.BsModels;
- using LitJson;
- using Library;
- using System.Text.RegularExpressions;
- namespace MySystem.Areas.Api.Controllers
- {
- [Area("Api")]
- [Route("Api/[controller]/[action]")]
- public class LocalPushController : Admin.Controllers.BaseController
- {
- public LocalPushController(IHttpContextAccessor accessor, ILogger<Admin.Controllers.BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
- {
- }
- #region 系统-本地推送
- public JsonResult List(string value)
- {
- value = HttpUtility.UrlDecode(value);
- Dictionary<string, object> Obj = new Dictionary<string, object>();
- List<Dictionary<string, object>> RegistrationList = new List<Dictionary<string, object>>();
- Dictionary<string, object> item = new Dictionary<string, object>();
- item.Add("Title", "title1");
- item.Add("Subtitle", "subtitle");
- item.Add("Body", "日");
- item.Add("Url", "");
- item.Add("MiniAppId", "");
- item.Add("Params", "");
- item.Add("PushDate", "1658734489");
- item.Add("Repeats", "0");
- item.Add("LocalPushId", "user-setting");
- item.Add("RepeatType","");
- RegistrationList.Add(item);
- List<string> ClearList = new List<string>();
- ClearList.Add("1");
- string ClearAll = "";
- Obj.Add("RegistrationList", RegistrationList);
- Obj.Add("ClearList", ClearList);
- Obj.Add("ClearAll", ClearAll);
- return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
- }
- #endregion
- #region 检查签名是否合法,合法返回1,不合法返回提示信息
- /// <summary>
- /// 检查签名是否合法,合法返回1,不合法返回提示信息
- /// </summary>
- /// <param name="value">请求的参数(json字符串)</param>
- /// <param name="signField">要签名的字段</param>
- /// <returns></returns>
- private string CheckSign(string value, string[] signField)
- {
- JsonData json = JsonMapper.ToObject(value);
- Dictionary<string, string> dic = new Dictionary<string, string>();
- for (int i = 0; i < signField.Length; i++)
- {
- dic.Add(signField[i], json[signField[i]].ToString());
- }
- string sign = json["sign"].ToString(); //客户端签名字符串
- return new Sign().sign(dic, sign);
- }
- #endregion
- }
- }
|