123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- 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;
- namespace MySystem.Areas.Api.Controllers.v1
- {
- [Area("Api")]
- [Route("Api/[controller]/[action]")]
- public class WeChatController : BaseController
- {
- public WeChatController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
- {
- }
- #region 微信服务平台支付回调
- public Dictionary<string, string> Notice()
- {
- StreamReader sr = new StreamReader(Request.Body);
- string requestMes = sr.ReadToEnd();
- function.WriteLog(DateTime.Now.ToString() + "\r\n" + requestMes + "\r\n\r\n", "微信服务平台支付回调");
- RedisDbconn.Instance.AddList("WeChatPayBack", requestMes);
- Dictionary<string, string> dic = new Dictionary<string, string>();
- dic.Add("code", "SUCCESS");
- dic.Add("message", "");
- return dic;
- }
- #endregion
- public Dictionary<string, string> test()
- {
- string AppId = "wx5417e0770bb19c4e";
- string MchId = "1611167423";
- string SubMchId = "1619775262";
- string Description = "四川探火网络科技有限责任公司";
- string OpenId = "omawy5VjduiPpSo9GNldzYZlioZE";
- string Key = AppConfig.WeChatParam.AesGemKey;
- string NotifyUrl = Host + "api/wechat/notice";
- // Dictionary<string, string> dic = new WeChatFunction(_accessor.HttpContext).Pay(AppId, MchId, SubMchId, 0.1M, DateTime.Now.ToString("yyyyMMddHHmmssfff"), Description, OpenId, Key, NotifyUrl);
- Dictionary<string, string> dic = new WeChatFunction(_accessor.HttpContext).Refund(AppId, MchId, SubMchId, 1M, 1M, "2022020817492424848364549", DateTime.Now.ToString("yyyyMMddHHmmssfff"), Description, OpenId, Key, NotifyUrl);
- return dic;
- }
- }
- }
|