|
@@ -0,0 +1,77 @@
|
|
|
|
|
+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.MainModels;
|
|
|
|
|
+using LitJson;
|
|
|
|
|
+using Library;
|
|
|
|
|
+using System.IO;
|
|
|
|
|
+using System.Text;
|
|
|
|
|
+
|
|
|
|
|
+namespace MySystem.Areas.Api.Controllers.v1
|
|
|
|
|
+{
|
|
|
|
|
+ [Area("Api")]
|
|
|
|
|
+ [Route("Api/[controller]/[action]")]
|
|
|
|
|
+ public class PrizeController : BaseController
|
|
|
|
|
+ {
|
|
|
|
|
+ public PrizeController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
|
|
|
|
|
+ {
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ #region 获取奖励日志
|
|
|
|
|
+ [Route("/v1/pri/PriLog/getPriLogDetail")]
|
|
|
|
|
+ public Dictionary<string, object> Set()
|
|
|
|
|
+ {
|
|
|
|
|
+ Dictionary<string, object> result = new Dictionary<string, object>();
|
|
|
|
|
+ try
|
|
|
|
|
+ {
|
|
|
|
|
+ StreamReader sr = new StreamReader(Request.Body);
|
|
|
|
|
+ string requestMes = sr.ReadToEnd();
|
|
|
|
|
+ JsonData json = JsonMapper.ToObject(requestMes);
|
|
|
|
|
+ string value = AesDecrypt(json["content"].ToString(), "kvS4TIRh7Yulg4nr");
|
|
|
|
|
+ JsonData data = JsonMapper.ToObject(value);
|
|
|
|
|
+ string DataNo = data["data_no"].ToString();
|
|
|
|
|
+ string PrizeKind = data["prize_kind"].ToString();
|
|
|
|
|
+
|
|
|
|
|
+ string content = function.PostWebRequest("/noauth/pri/logdetail", "value={\"data_no\":\"" + DataNo + "\",\"prize_kind\":\"" + PrizeKind + "\"}");
|
|
|
|
|
+ result = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string, object>>(content);
|
|
|
|
|
+ }
|
|
|
|
|
+ catch(Exception ex)
|
|
|
|
|
+ {
|
|
|
|
|
+ function.WriteLog(DateTime.Now.ToString() + "\n" + ex.ToString(), "设置押金异常");
|
|
|
|
|
+ result.Add("code", 1);
|
|
|
|
|
+ result.Add("status", "fail");
|
|
|
|
|
+ result.Add("msg", "异常");
|
|
|
|
|
+ }
|
|
|
|
|
+ return result;
|
|
|
|
|
+ }
|
|
|
|
|
+ public string AesDecrypt(string str, string key)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (string.IsNullOrEmpty(str)) return null;
|
|
|
|
|
+ byte[] toEncryptArray = Convert.FromBase64String(str);
|
|
|
|
|
+
|
|
|
|
|
+ System.Security.Cryptography.RijndaelManaged rm = new System.Security.Cryptography.RijndaelManaged
|
|
|
|
|
+ {
|
|
|
|
|
+ Key = Encoding.UTF8.GetBytes(key),
|
|
|
|
|
+ Mode = System.Security.Cryptography.CipherMode.ECB,
|
|
|
|
|
+ Padding = System.Security.Cryptography.PaddingMode.PKCS7,
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ System.Security.Cryptography.ICryptoTransform cTransform = rm.CreateDecryptor();
|
|
|
|
|
+ byte[] resultArray = cTransform.TransformFinalBlock(toEncryptArray, 0, toEncryptArray.Length);
|
|
|
|
|
+ return Encoding.UTF8.GetString(resultArray);
|
|
|
|
|
+ }
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|