From f4721de044dac25ba94a71677a9f495b58068d7c Mon Sep 17 00:00:00 2001 From: xiaochanghai Date: Thu, 23 Jan 2025 11:59:00 +0800 Subject: [PATCH] =?UTF-8?q?core=20=E6=A1=86=E6=9E=B6=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E6=95=B4=E7=90=86=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Tiobon.Core.Api/Tiobon.Core.Model.xml | 482 +--------------- Tiobon.Core.Api/appsettings.json | 9 - .../Attribute/FromFilterAttribute.cs | 277 --------- Tiobon.Core.Common/Attribute/QueryFilter.cs | 57 -- Tiobon.Core.Common/Helper/CCBPayUtil.cs | 527 ------------------ Tiobon.Core.Common/Static/StaticPayInfo.cs | 37 -- Tiobon.Core.Common/Tiobon.Core.Common.csproj | 1 + .../ServiceExtensions/SwaggerSetup.cs | 2 +- .../IAccessTrendLogServices.cs | 14 - Tiobon.Core.IServices/IPayServices.cs | 42 -- Tiobon.Core.Jobs/TaskCenter.cs | 3 - Tiobon.Core.Jobs/appsettings.json | 21 +- .../CustomEnums/AuthorityScopeEnum.cs | 30 - Tiobon.Core.Model/Models/AccessTrendLog.cs | 27 - Tiobon.Core.Model/PaginationModel.cs | 4 +- Tiobon.Core.Model/ResponseEnum.cs | 23 - Tiobon.Core.Model/TableModel.cs | 27 - Tiobon.Core.Model/ViewModels/PayModel.cs | 102 ---- Tiobon.Core.Model/ViewModels/PayNeedModel.cs | 34 -- .../ViewModels/PayRefundNeedModel.cs | 21 - .../ViewModels/PayRefundReturnModel.cs | 37 -- .../PayRefundReturnOrderInfoModel.cs | 30 - .../ViewModels/PayRefundReturnResultModel.cs | 45 -- .../ViewModels/PayResultModel.cs | 53 -- .../ViewModels/PayReturnResultModel.cs | 39 -- .../AccessTrendLogServices.cs | 12 - Tiobon.Core.Services/BASE/BaseServices.cs | 16 - Tiobon.Core.Services/CommonServices.cs | 6 +- Tiobon.Core.Services/PayServices.cs | 400 ------------- Tiobon.Core.Services/ReportServices.cs | 8 +- .../HostedService/Job1TimedService.cs | 56 -- .../HostedService/Job2TimedService.cs | 43 -- .../Jobs/Job_AccessTrendLog_Quartz.cs | 140 ----- 33 files changed, 19 insertions(+), 2606 deletions(-) delete mode 100644 Tiobon.Core.Common/Attribute/FromFilterAttribute.cs delete mode 100644 Tiobon.Core.Common/Helper/CCBPayUtil.cs delete mode 100644 Tiobon.Core.Common/Static/StaticPayInfo.cs delete mode 100644 Tiobon.Core.IServices/IAccessTrendLogServices.cs delete mode 100644 Tiobon.Core.IServices/IPayServices.cs delete mode 100644 Tiobon.Core.Model/CustomEnums/AuthorityScopeEnum.cs delete mode 100644 Tiobon.Core.Model/Models/AccessTrendLog.cs delete mode 100644 Tiobon.Core.Model/ResponseEnum.cs delete mode 100644 Tiobon.Core.Model/TableModel.cs delete mode 100644 Tiobon.Core.Model/ViewModels/PayModel.cs delete mode 100644 Tiobon.Core.Model/ViewModels/PayNeedModel.cs delete mode 100644 Tiobon.Core.Model/ViewModels/PayRefundNeedModel.cs delete mode 100644 Tiobon.Core.Model/ViewModels/PayRefundReturnModel.cs delete mode 100644 Tiobon.Core.Model/ViewModels/PayRefundReturnOrderInfoModel.cs delete mode 100644 Tiobon.Core.Model/ViewModels/PayRefundReturnResultModel.cs delete mode 100644 Tiobon.Core.Model/ViewModels/PayResultModel.cs delete mode 100644 Tiobon.Core.Model/ViewModels/PayReturnResultModel.cs delete mode 100644 Tiobon.Core.Services/AccessTrendLogServices.cs delete mode 100644 Tiobon.Core.Services/PayServices.cs delete mode 100644 Tiobon.Core.Tasks/HostedService/Job1TimedService.cs delete mode 100644 Tiobon.Core.Tasks/HostedService/Job2TimedService.cs delete mode 100644 Tiobon.Core.Tasks/QuartzNet/Jobs/Job_AccessTrendLog_Quartz.cs diff --git a/Tiobon.Core.Api/Tiobon.Core.Model.xml b/Tiobon.Core.Api/Tiobon.Core.Model.xml index dfdba8fc..6ba3f32b 100644 --- a/Tiobon.Core.Api/Tiobon.Core.Model.xml +++ b/Tiobon.Core.Api/Tiobon.Core.Model.xml @@ -13812,26 +13812,6 @@ Ghrz_Shihua_OA_Employment (Dto.InsertInput) - - - 用户访问趋势日志 - - - - - 用户 - - - - - 次数 - - - - - 更新时间 - - 博客文章 @@ -30192,36 +30172,6 @@ 已逾期 - - - 无任何权限 - - - - - 自定义权限 - - - - - 本部门 - - - - - 本部门及以下 - - - - - 仅自己 - - - - - 所有 - - 真实表名(数据库表名,若没有填写默认实体为表名) @@ -30432,8 +30382,8 @@ 所需分页参数 - 作者:胡丁文 - 时间:2020-4-3 20:31:26 + 作者:SimonHsiao + 时间:2024-5-3 20:31:26 @@ -30456,21 +30406,6 @@ 查询条件( 例如:id = 1 and name = 小明) - - - 无权限 - - - - - 找不到指定资源 - - - - - 找不到指定资源 - - 服务层响应实体(泛型) @@ -30605,31 +30540,6 @@ 数据库读取类型 - - - 表格数据,支持分页 - - - - - 返回编码 - - - - - 返回信息 - - - - - 记录总数 - - - - - 返回数据集 - - 租户模型接口 @@ -31052,394 +30962,6 @@ - - - 商户号 - - - - - 柜台号 - - - - - 分行号 - - - - - 集团商户信息 - - - - - 交易码 - - - - - 商户类型 - - - - - 终端编号 1 - - - - - 终端编号 2 - - - - - 订单号 - - - - - 码信息(一维码、二维码) - - - - - 订单金额,单位:元 - - - - - 商品名称 - - - - - 备注 1 - - - - - 备注 2 - - - - - 分账信息一 - - - - - 分账信息二 - - - - - 子商户公众账号 ID - - - - - 返回信息位图 - - - - - 实名支付 - - - - - 商品详情 - - - - - 订单优惠标记 - - - - - 公钥 - - - - - 请求地址 - - - - - 是否删除空值 - - - - - 退款参数 - - - - - 订单ID - - - - - 商品名称 - - - - - 支付金额(小数点最多两位) - - - - - 二维码/条码信息 - - - - - 备注信息1 - - - - - 备注信息2 - - - - - 订单参数 - - - - - 订单号 - - - - - 退款金额 - - - - - 退款流水号(可选) - - - - - 退款返回消息 - - - - - 序列号 - - - - - 商户号 - - - - - 交易码 - - - - - 返回码 - - - - - 返回码说明 - - - - - 语言 - - - - - 订单信息 - - - - - 订单信息 - - - - - 订单号 - - - - - 支付金额 - - - - - 退款金额 - - - - - 备注1 - - - - - 备注2 - - - - - 退款返回结果消息 - - - - - 订单号 - - - - - 支付金额 - - - - - 退款金额 - - - - - 序列号 - - - - - 商户号 - - - - - 交易码 - - - - - 返回码 - - - - - 返回码说明 - - - - - 语言 - - - - - 支付结果dto - - - - - 支付结果 - Y:成功 - N:失败 - U:不确定 - Q:待轮询 - - - - - 订单ID - - - - - 支付金额 - - - - - 二维码类型 - 1:龙支付 - 2:微信 - 3:支付宝 - 4:银联 - - - - - 等待时间-轮询等待时间 - - - - - 全局事件跟踪号-建行交易流水号 - - - - - 错误码 - - - - - 错误信息 - - - - - 验证签名-防止伪造攻击 - - - - - 返回支付结果 - - - - - 发起的订单ID - - - - - 返回支付的金额 - - - - - 返回支付的类型 1:龙支付 2:微信 3:支付宝 4:银联 - - - - - 返回建行的流水号 - - - - - 错误代码 - - - - - 错误信息 - - 实现IJob的类 diff --git a/Tiobon.Core.Api/appsettings.json b/Tiobon.Core.Api/appsettings.json index 3e44c36b..50980a04 100644 --- a/Tiobon.Core.Api/appsettings.json +++ b/Tiobon.Core.Api/appsettings.json @@ -337,15 +337,6 @@ "ServiceHealthCheck": "/healthcheck", "ConsulAddress": "http://localhost:8500" }, - "PayInfo": { //建行聚合支付信息 - "MERCHANTID": "", //商户号 - "POSID": "", //柜台号 - "BRANCHID": "", //分行号 - "pubKey": "", //公钥 - "USER_ID": "", //操作员号 - "PASSWORD": "", //密码 - "OutAddress": "http://127.0.0.1:12345" //外联地址 - }, "nacos": { "ServerAddresses": [ "http://localhost:8848" ], // nacos 连接地址 "DefaultTimeOut": 15000, // 默认超时时间 diff --git a/Tiobon.Core.Common/Attribute/FromFilterAttribute.cs b/Tiobon.Core.Common/Attribute/FromFilterAttribute.cs deleted file mode 100644 index 3b78cefa..00000000 --- a/Tiobon.Core.Common/Attribute/FromFilterAttribute.cs +++ /dev/null @@ -1,277 +0,0 @@ -using Microsoft.AspNetCore.Mvc.ModelBinding; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; - -namespace Tiobon.Core.Common -{ - public class FilterHeaderBinder : IModelBinder - { - public Task BindModelAsync(ModelBindingContext bindingContext) - { - if (bindingContext == null) - { - throw new ArgumentNullException(nameof(bindingContext)); - } - - var name = bindingContext.FieldName; - - var headers = bindingContext.HttpContext.Request.Headers; - - QueryFilter queryFilter; - - if (!headers.ContainsKey(name)) - { - queryFilter = QueryFilter.Default; - bindingContext.Result = ModelBindingResult.Success(queryFilter); - return Task.CompletedTask; - } - - string filter = headers[name]; - - if (bindingContext.ModelType == typeof(string)) - { - bindingContext.Result = ModelBindingResult.Success(filter); - return Task.CompletedTask; - } - - try - { - if (string.IsNullOrEmpty(filter) || filter == "%22%22" || filter.ToLower() == "%7b%7d") - { - queryFilter = QueryFilter.Default; - } - else if (filter.Trim() == "undefined" || filter.Trim() == "null") - { - queryFilter = QueryFilter.Default; - //LoggerHelper.SendLogError($"QueryFilter 反序列化异常: {filter}\r\n请求地址: {bindingContext.HttpContext.Request.GetEncodedUrl()}"); - } - else - { - queryFilter = JsonConvert.DeserializeObject(System.Web.HttpUtility.UrlDecode(filter)); - SetPredicateValues(queryFilter, bindingContext); - } - - bindingContext.Result = ModelBindingResult.Success(queryFilter ?? QueryFilter.Default); - } - catch - { - //LoggerHelper.SendLogError($"QueryFilter 反序列化失败: {filter}\r\n请求地址: {bindingContext.HttpContext.Request.GetEncodedUrl()}"); - bindingContext.Result = ModelBindingResult.Success(QueryFilter.Default); - } - return Task.CompletedTask; - } - - /// - /// 设置 PredicateValues 的值类型 - /// - /// - /// - private static void SetPredicateValues(QueryFilter queryFilter, ModelBindingContext bindingContext) - { - //if (queryFilter?.PredicateValues == null || queryFilter.PredicateValues.Length == 0) - //{ - // return; - //} - - //for (int i = 0; i < queryFilter.PredicateValues.Length; i++) - //{ - // if (queryFilter.PredicateValues[i] is JObject jObj) - // { - // var prop = jObj.Properties()?.FirstOrDefault(); - // if (prop == null) - // continue; - // var type = StringConvertToType(prop.Name); - // if (type == null) - // continue; - // try - // { - // var v = JsonConvert.DeserializeObject(prop.Value?.ToString(), type); - // if (v != null) - // { - // queryFilter.PredicateValues[i] = v; - // } - // } - // catch (Exception) - // { - // throw; - // //LoggerHelper.SendLogError($"QueryFilter.PredicateValues[{i}] [{queryFilter.PredicateValues[i]}] 反序列化失败\r\n" + - // // $"请求地址: {bindingContext.HttpContext.Request.GetEncodedUrl()}\r\n" + - // // $"错误信息: {ex}"); - // } - // } - //} - } - - - #region 字符串获取类型 - /// - /// 根据 获取 类型 - /// - /// - /// - public static Type StringConvertToType(string name) - { - if (string.IsNullOrEmpty(name)) - { - return default; - } - - switch (name.Trim().ToUpper()) - { - case "INT": - case "INT32": - return typeof(int); - case "INT?": - case "INT32?": - return typeof(int?); - case "INT[]": - case "INT32[]": - return typeof(int[]); - case "INT?[]": - case "INT32?[]": - return typeof(int?[]); - case "LIST": - case "LIST": - return typeof(List); - case "LIST": - case "LIST": - return typeof(List); - - case "LONG": - case "INT64": - return typeof(long); - case "LONG?": - case "INT64?": - return typeof(long?); - case "LONG[]": - case "INT64[]": - return typeof(long[]); - case "LONG?[]": - case "INT64?[]": - return typeof(long?[]); - case "LIST": - case "LIST": - return typeof(List); - case "LIST": - case "LIST": - return typeof(List); - - case "FLOAT": - case "SINGLE": - return typeof(float); - case "FLOAT?": - case "SINGLE?": - return typeof(float?); - case "FLOAT[]": - case "SINGLE[]": - return typeof(float[]); - case "FLOAT?[]": - case "SINGLE?[]": - return typeof(float?[]); - case "LIST": - case "LIST": - return typeof(List); - case "LIST": - case "LIST": - return typeof(List); - - case "DOUBLE": - return typeof(double); - case "DOUBLE?": - return typeof(double?); - case "DOUBLE[]": - return typeof(double[]); - case "DOUBLE?[]": - return typeof(double?[]); - case "LIST": - return typeof(List); - case "LIST": - return typeof(List); - - case "DECIMAL": - return typeof(decimal); - case "DECIMAL?": - return typeof(decimal?); - case "DECIMAL[]": - return typeof(decimal[]); - case "DECIMAL?[]": - return typeof(decimal?[]); - case "LIST": - return typeof(List); - case "LIST": - return typeof(List); - - case "DATETIME": - return typeof(DateTime); - case "DATETIME?": - return typeof(DateTime?); - case "DATETIME[]": - return typeof(DateTime[]); - case "DATETIME?[]": - return typeof(DateTime?[]); - case "LIST": - return typeof(List); - case "LIST": - return typeof(List); - - case "GUID": - return typeof(Guid); - case "GUID?": - return typeof(Guid?); - case "GUID[]": - return typeof(Guid[]); - case "GUID?[]": - return typeof(Guid?[]); - case "LIST": - return typeof(List); - case "LIST": - return typeof(List); - - case "BOOL": - return typeof(bool); - case "BOOL?": - return typeof(bool?); - case "BOOL[]": - return typeof(bool[]); - case "BOOL?[]": - return typeof(bool?[]); - case "LIST": - return typeof(List); - case "LIST": - return typeof(List); - - case "STRING": - return typeof(string); - case "STRING[]": - return typeof(string[]); - case "LIST": - return typeof(List); - - default: - break; - } - - return Type.GetType(name); - } - #endregion - } - - /// - /// 从 Header 自动反序列化 QueryFilter 并绑定 - /// - [AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)] - public class FromFilterAttribute : Attribute, IBindingSourceMetadata, IModelNameProvider, IBinderTypeProviderMetadata - { - public FromFilterAttribute() - { - } - - public BindingSource BindingSource => BindingSource.Header; - - public string Name { get; set; } - - public Type BinderType => typeof(FilterHeaderBinder); - } - - -} diff --git a/Tiobon.Core.Common/Attribute/QueryFilter.cs b/Tiobon.Core.Common/Attribute/QueryFilter.cs index fbc4f9aa..db651ab1 100644 --- a/Tiobon.Core.Common/Attribute/QueryFilter.cs +++ b/Tiobon.Core.Common/Attribute/QueryFilter.cs @@ -4,63 +4,6 @@ using Tiobon.Core.Model; namespace Tiobon.Core.Common; -/// -/// 动态查询条件 -/// -public class QueryFilter -{ - private int _pageIndex; - /// - /// 起始位置(e.g. 0) - /// - [Required] - public int PageIndex - { - get { return _pageIndex; } - set - { - //前端默认从分页显示默认1开始,所以后端需要-1 - if (value >= 1) - value -= 1; - _pageIndex = value; - } - } - /// - /// 每页数量(e.g. 10) - /// - [Required] - public int PageSize { get; set; } - private string _conditions; - /// - /// 查询条件( 例如:id = 1 and name = 小明) - /// - public string Conditions - { - get { return _conditions; } - set - { - //前端默认从分页显示默认1开始,所以后端需要-1 - if (value == "1=1") - value = null; - _conditions = value; - } - } - - /// - /// 排序条件表达式(e.g. LoginName ASC,Name DESC) - /// - public string Sorting { get; set; } - /// - /// 缺省值 - /// - public static QueryFilter Default => new QueryFilter - { - PageIndex = 1, - PageSize = 100000, - Sorting = string.Empty, - Conditions = string.Empty - }; -} /// /// 动态查询条件 diff --git a/Tiobon.Core.Common/Helper/CCBPayUtil.cs b/Tiobon.Core.Common/Helper/CCBPayUtil.cs deleted file mode 100644 index 1f8ef38e..00000000 --- a/Tiobon.Core.Common/Helper/CCBPayUtil.cs +++ /dev/null @@ -1,527 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.IO; -using System.Runtime.InteropServices; -using System.Security.Cryptography; -using System.Text; -using System.Web; - -namespace Tiobon.Core.Common -{ - /// - /// 建行支付助手(根据官方提供的dll反编译过来的) - /// - public class CCBPayUtil - { - // Token: 0x06000001 RID: 1 RVA: 0x00002050 File Offset: 0x00000250 - public string makeCCBParam(string param, string pubkey) - { - string text = this.dicSort(param); - text += this.MD5KEY; - string str = new MessageDigest_MD5().Md5_32(text); - param = param + "&SIGN=" + str; - if (pubkey.Length >= 30) - { - pubkey = pubkey.Substring(pubkey.Length - 30); - } - if (pubkey.Length >= 8) - { - pubkey = pubkey.Substring(0, 8); - } - string text2 = new DES_ENCRY_DECRY().doEncrypt(param, pubkey); - text2 = text2.Replace("+", ","); - return HttpUtility.UrlEncode(text2, Encoding.GetEncoding("ISO-8859-1")); - } - - // Token: 0x06000002 RID: 2 RVA: 0x00002104 File Offset: 0x00000304 - public bool verifyNotifySign(string src, string sign, string pubKey) - { - return new RSASign().verifySigature(src, sign, pubKey); - } - - // Token: 0x06000003 RID: 3 RVA: 0x00002124 File Offset: 0x00000324 - private string dicSort(string param) - { - return this.GetSignContent(this.strToMap(param)); - } - - // Token: 0x06000004 RID: 4 RVA: 0x00002144 File Offset: 0x00000344 - private IDictionary strToMap(string param) - { - IDictionary dictionary = new Dictionary(); - string[] array = param.Split(new char[] - { - '&' - }); - for (int i = 0; i < array.Length; i++) - { - if (!"".Equals(array[i])) - { - string[] array2 = array[i].Split(new char[] - { - '=' - }); - if (array2.Length == 1) - { - dictionary.Add(array2[0], ""); - } - else - { - dictionary.Add(array2[0], array2[1]); - } - } - } - return dictionary; - } - - // Token: 0x06000005 RID: 5 RVA: 0x000021F0 File Offset: 0x000003F0 - private string GetSignContent(IDictionary parameters) - { - IDictionary dictionary = new SortedDictionary(parameters); - IEnumerator> enumerator = dictionary.GetEnumerator(); - StringBuilder stringBuilder = new StringBuilder(""); - while (enumerator.MoveNext()) - { - KeyValuePair keyValuePair = enumerator.Current; - string key = keyValuePair.Key; - keyValuePair = enumerator.Current; - string value = keyValuePair.Value; - if (!string.IsNullOrEmpty(key) && !string.IsNullOrEmpty(value)) - { - stringBuilder.Append(key).Append("=").Append(value).Append("&"); - } - } - return stringBuilder.ToString().Substring(0, stringBuilder.Length - 1); - } - - // Token: 0x04000001 RID: 1 - //private string VERSION = "1.0.0"; - - // Token: 0x04000002 RID: 2 - private string MD5KEY = "20120315201809041004"; - } - internal class RSASign - { - // Token: 0x06000007 RID: 7 RVA: 0x000022C4 File Offset: 0x000004C4 - protected internal bool verifySigature(string signContent, string sign, string pubKey) - { - byte[] inArray = this.hexStrToBytes(pubKey); - pubKey = Convert.ToBase64String(inArray); - string text = "-----BEGIN PUBLIC KEY-----\r\n"; - text += pubKey; - text += "-----END PUBLIC KEY-----\r\n\r\n"; - byte[] sign2 = this.hexStrToBytes(sign); - byte[] bytes = Encoding.GetEncoding(RSASign.DEFAULT_CHARSET).GetBytes(signContent); - return this.RSACheckContent(bytes, sign2, text, "MD5"); - } - - // Token: 0x06000008 RID: 8 RVA: 0x00002330 File Offset: 0x00000530 - private bool RSACheckContent(byte[] signContent, byte[] sign, string publicKeyPem, string signType) - { - bool result; - try - { - RSACryptoServiceProvider rsacryptoServiceProvider = new RSACryptoServiceProvider(); - rsacryptoServiceProvider.PersistKeyInCsp = false; - RSACryptoServiceProviderExtension.LoadPublicKeyPEM(rsacryptoServiceProvider, publicKeyPem); - bool flag = rsacryptoServiceProvider.VerifyData(signContent, signType, sign); - result = flag; - } - catch - { - result = false; - } - return result; - } - - // Token: 0x06000009 RID: 9 RVA: 0x0000237C File Offset: 0x0000057C - private byte[] hexStrToBytes(string s) - { - s = s.Replace(" ", ""); - if (s.Length % 2 != 0) - { - s += " "; - } - byte[] array = new byte[s.Length / 2]; - for (int i = 0; i < array.Length; i++) - { - array[i] = Convert.ToByte(s.Substring(i * 2, 2), 16); - } - return array; - } - - // Token: 0x04000003 RID: 3 - private static string DEFAULT_CHARSET = "GBK"; - } - public class DES_ENCRY_DECRY - { - protected internal string doEncrypt(string param, string pubkey) - { - this.tdesKey = ((pubkey.Length > 8) ? pubkey.Substring(0, 8) : pubkey); - byte[] bytes = this.DESEncrypt(this.UTF_16BE, param, this.ISO_8859_1, this.tdesKey); - return this.Base64Encode(bytes); - } - - // Token: 0x0600001A RID: 26 RVA: 0x00002684 File Offset: 0x00000884 - protected internal string doDecrypt(string param, string pubkey) - { - this.tdesKey = ((pubkey.Length > 8) ? pubkey.Substring(0, 8) : pubkey); - return this.DESDecrypt(this.UTF_16BE, param, this.ISO_8859_1, this.tdesKey); - } - - // Token: 0x0600001B RID: 27 RVA: 0x000026CC File Offset: 0x000008CC - private byte[] DESEncrypt(string dataCharset, string data, string keyCharset, string key) - { - byte[] result; - try - { - byte[] bytes = Encoding.GetEncoding(keyCharset).GetBytes(key); - byte[] rgbIV = bytes; - byte[] bytes2 = Encoding.GetEncoding(dataCharset).GetBytes(data); - var descryptoServiceProvider = DES.Create(); - descryptoServiceProvider.Mode = CipherMode.ECB; - descryptoServiceProvider.Padding = PaddingMode.PKCS7; - MemoryStream memoryStream = new MemoryStream(); - CryptoStream cryptoStream = new CryptoStream(memoryStream, descryptoServiceProvider.CreateEncryptor(bytes, rgbIV), CryptoStreamMode.Write); - cryptoStream.Write(bytes2, 0, bytes2.Length); - cryptoStream.FlushFinalBlock(); - result = memoryStream.ToArray(); - } - catch - { - result = null; - } - return result; - } - - // Token: 0x0600001C RID: 28 RVA: 0x00002764 File Offset: 0x00000964 - private string DESDecrypt(string dataCharset, string data, string keyCoding, string key) - { - string result; - try - { - byte[] bytes = Encoding.GetEncoding(keyCoding).GetBytes(key); - byte[] rgbIV = bytes; - byte[] array = this.Base64Decode(data); - var descryptoServiceProvider = DES.Create(); - descryptoServiceProvider.Mode = CipherMode.ECB; - descryptoServiceProvider.Padding = PaddingMode.PKCS7; - MemoryStream memoryStream = new MemoryStream(); - CryptoStream cryptoStream = new CryptoStream(memoryStream, descryptoServiceProvider.CreateDecryptor(bytes, rgbIV), CryptoStreamMode.Write); - cryptoStream.Write(array, 0, array.Length); - cryptoStream.FlushFinalBlock(); - result = Encoding.GetEncoding(dataCharset).GetString(memoryStream.ToArray()); - } - catch - { - result = null; - } - return result; - } - - // Token: 0x0600001D RID: 29 RVA: 0x00002800 File Offset: 0x00000A00 - private string Base64Encode(byte[] bytes) - { - string result = string.Empty; - try - { - result = Convert.ToBase64String(bytes); - } - catch - { - } - return result; - } - - // Token: 0x0600001E RID: 30 RVA: 0x0000283C File Offset: 0x00000A3C - private byte[] Base64Decode(string source) - { - byte[] result = null; - try - { - result = Convert.FromBase64String(source); - } - catch - { - } - return result; - } - - // Token: 0x04000031 RID: 49 - private string tdesKey = "12345678"; - - // Token: 0x04000032 RID: 50 - private string UTF_16BE = "utf-16BE"; - - // Token: 0x04000033 RID: 51 - private string ISO_8859_1 = "ISO-8859-1"; - } - internal class MessageDigest_MD5 - { - // Token: 0x06000020 RID: 32 RVA: 0x000028A0 File Offset: 0x00000AA0 - protected internal string Md5_32(string src) - { - var md = MD5.Create(); - byte[] bytes = Encoding.UTF8.GetBytes(src); - byte[] array = md.ComputeHash(bytes); - string text = ""; - for (int i = 0; i < array.Length; i++) - { - text += array[i].ToString("x2"); - } - return text; - } - } - internal class RSACryptoServiceProviderExtension - { - // Token: 0x0600000C RID: 12 RVA: 0x00002408 File Offset: 0x00000608 - private static void LoadPublicKeyDER(RSACryptoServiceProvider provider, byte[] DERData) - { - byte[] rsafromDER = RSACryptoServiceProviderExtension.GetRSAFromDER(DERData); - byte[] publicKeyBlobFromRSA = RSACryptoServiceProviderExtension.GetPublicKeyBlobFromRSA(rsafromDER); - provider.ImportCspBlob(publicKeyBlobFromRSA); - } - - // Token: 0x0600000D RID: 13 RVA: 0x0000242C File Offset: 0x0000062C - internal static void LoadPublicKeyPEM(RSACryptoServiceProvider provider, string sPEM) - { - byte[] derfromPEM = RSACryptoServiceProviderExtension.GetDERFromPEM(sPEM); - RSACryptoServiceProviderExtension.LoadPublicKeyDER(provider, derfromPEM); - } - - // Token: 0x0600000E RID: 14 RVA: 0x0000244C File Offset: 0x0000064C - private static byte[] GetPublicKeyBlobFromRSA(byte[] RSAData) - { - byte[] array = null; - uint num = 0U; - if (!RSACryptoServiceProviderExtension.CryptDecodeObject((RSACryptoServiceProviderExtension.CRYPT_ENCODING_FLAGS)65537U, new IntPtr(19), RSAData, (uint)RSAData.Length, RSACryptoServiceProviderExtension.CRYPT_DECODE_FLAGS.NONE, array, ref num)) - { - throw new Win32Exception(Marshal.GetLastWin32Error()); - } - array = new byte[num]; - if (!RSACryptoServiceProviderExtension.CryptDecodeObject((RSACryptoServiceProviderExtension.CRYPT_ENCODING_FLAGS)65537U, new IntPtr(19), RSAData, (uint)RSAData.Length, RSACryptoServiceProviderExtension.CRYPT_DECODE_FLAGS.NONE, array, ref num)) - { - throw new Win32Exception(Marshal.GetLastWin32Error()); - } - return array; - } - - // Token: 0x0600000F RID: 15 RVA: 0x000024C4 File Offset: 0x000006C4 - internal static byte[] GetRSAFromDER(byte[] DERData) - { - byte[] array = null; - byte[] array2 = null; - uint num = 0U; - IntPtr zero = IntPtr.Zero; - if (!RSACryptoServiceProviderExtension.CryptDecodeObject((RSACryptoServiceProviderExtension.CRYPT_ENCODING_FLAGS)65537U, new IntPtr(8), DERData, (uint)DERData.Length, RSACryptoServiceProviderExtension.CRYPT_DECODE_FLAGS.NONE, array, ref num)) - { - throw new Win32Exception(Marshal.GetLastWin32Error()); - } - array = new byte[num]; - if (RSACryptoServiceProviderExtension.CryptDecodeObject((RSACryptoServiceProviderExtension.CRYPT_ENCODING_FLAGS)65537U, new IntPtr(8), DERData, (uint)DERData.Length, RSACryptoServiceProviderExtension.CRYPT_DECODE_FLAGS.NONE, array, ref num)) - { - GCHandle gchandle = GCHandle.Alloc(array, GCHandleType.Pinned); - try - { - RSACryptoServiceProviderExtension.CERT_PUBLIC_KEY_INFO cert_PUBLIC_KEY_INFO = (RSACryptoServiceProviderExtension.CERT_PUBLIC_KEY_INFO)Marshal.PtrToStructure(gchandle.AddrOfPinnedObject(), typeof(RSACryptoServiceProviderExtension.CERT_PUBLIC_KEY_INFO)); - array2 = new byte[cert_PUBLIC_KEY_INFO.PublicKey.cbData]; - Marshal.Copy(cert_PUBLIC_KEY_INFO.PublicKey.pbData, array2, 0, array2.Length); - } - finally - { - gchandle.Free(); - } - return array2; - } - throw new Win32Exception(Marshal.GetLastWin32Error()); - } - - // Token: 0x06000010 RID: 16 RVA: 0x000025C0 File Offset: 0x000007C0 - internal static byte[] GetDERFromPEM(string sPEM) - { - uint num = 0U; - uint num2; - uint num3; - if (!RSACryptoServiceProviderExtension.CryptStringToBinary(sPEM, (uint)sPEM.Length, RSACryptoServiceProviderExtension.CRYPT_STRING_FLAGS.CRYPT_STRING_BASE64HEADER, null, ref num, out num2, out num3)) - { - throw new Win32Exception(Marshal.GetLastWin32Error()); - } - byte[] array = new byte[num]; - if (!RSACryptoServiceProviderExtension.CryptStringToBinary(sPEM, (uint)sPEM.Length, RSACryptoServiceProviderExtension.CRYPT_STRING_FLAGS.CRYPT_STRING_BASE64HEADER, array, ref num, out num2, out num3)) - { - throw new Win32Exception(Marshal.GetLastWin32Error()); - } - return array; - } - - // Token: 0x06000011 RID: 17 - [DllImport("advapi32.dll", SetLastError = true)] - [return: MarshalAs(UnmanagedType.Bool)] - internal static extern bool CryptDestroyKey(IntPtr hKey); - - // Token: 0x06000012 RID: 18 - [DllImport("advapi32.dll", SetLastError = true)] - [return: MarshalAs(UnmanagedType.Bool)] - internal static extern bool CryptImportKey(IntPtr hProv, byte[] pbKeyData, uint dwDataLen, IntPtr hPubKey, uint dwFlags, ref IntPtr hKey); - - // Token: 0x06000013 RID: 19 - [DllImport("advapi32.dll", SetLastError = true)] - [return: MarshalAs(UnmanagedType.Bool)] - internal static extern bool CryptReleaseContext(IntPtr hProv, int dwFlags); - - // Token: 0x06000014 RID: 20 - [DllImport("advapi32.dll", CharSet = CharSet.Auto, SetLastError = true)] - [return: MarshalAs(UnmanagedType.Bool)] - internal static extern bool CryptAcquireContext(ref IntPtr hProv, string pszContainer, string pszProvider, RSACryptoServiceProviderExtension.CRYPT_PROVIDER_TYPE dwProvType, RSACryptoServiceProviderExtension.CRYPT_ACQUIRE_CONTEXT_FLAGS dwFlags); - - // Token: 0x06000015 RID: 21 - [DllImport("crypt32.dll", CharSet = CharSet.Auto, SetLastError = true)] - [return: MarshalAs(UnmanagedType.Bool)] - internal static extern bool CryptStringToBinary(string sPEM, uint sPEMLength, RSACryptoServiceProviderExtension.CRYPT_STRING_FLAGS dwFlags, [Out] byte[] pbBinary, ref uint pcbBinary, out uint pdwSkip, out uint pdwFlags); - - // Token: 0x06000016 RID: 22 - [DllImport("crypt32.dll", SetLastError = true)] - [return: MarshalAs(UnmanagedType.Bool)] - internal static extern bool CryptDecodeObjectEx(RSACryptoServiceProviderExtension.CRYPT_ENCODING_FLAGS dwCertEncodingType, IntPtr lpszStructType, byte[] pbEncoded, uint cbEncoded, RSACryptoServiceProviderExtension.CRYPT_DECODE_FLAGS dwFlags, IntPtr pDecodePara, ref byte[] pvStructInfo, ref uint pcbStructInfo); - - // Token: 0x06000017 RID: 23 - [DllImport("crypt32.dll", SetLastError = true)] - [return: MarshalAs(UnmanagedType.Bool)] - internal static extern bool CryptDecodeObject(RSACryptoServiceProviderExtension.CRYPT_ENCODING_FLAGS dwCertEncodingType, IntPtr lpszStructType, byte[] pbEncoded, uint cbEncoded, RSACryptoServiceProviderExtension.CRYPT_DECODE_FLAGS flags, [In][Out] byte[] pvStructInfo, ref uint cbStructInfo); - - // Token: 0x02000005 RID: 5 - internal enum CRYPT_ACQUIRE_CONTEXT_FLAGS : uint - { - // Token: 0x04000005 RID: 5 - CRYPT_NEWKEYSET = 8U, - // Token: 0x04000006 RID: 6 - CRYPT_DELETEKEYSET = 16U, - // Token: 0x04000007 RID: 7 - CRYPT_MACHINE_KEYSET = 32U, - // Token: 0x04000008 RID: 8 - CRYPT_SILENT = 64U, - // Token: 0x04000009 RID: 9 - CRYPT_DEFAULT_CONTAINER_OPTIONAL = 128U, - // Token: 0x0400000A RID: 10 - CRYPT_VERIFYCONTEXT = 4026531840U - } - - // Token: 0x02000006 RID: 6 - internal enum CRYPT_PROVIDER_TYPE : uint - { - // Token: 0x0400000C RID: 12 - PROV_RSA_FULL = 1U - } - - // Token: 0x02000007 RID: 7 - internal enum CRYPT_DECODE_FLAGS : uint - { - // Token: 0x0400000E RID: 14 - NONE, - // Token: 0x0400000F RID: 15 - CRYPT_DECODE_ALLOC_FLAG = 32768U - } - - // Token: 0x02000008 RID: 8 - internal enum CRYPT_ENCODING_FLAGS : uint - { - // Token: 0x04000011 RID: 17 - PKCS_7_ASN_ENCODING = 65536U, - // Token: 0x04000012 RID: 18 - X509_ASN_ENCODING = 1U - } - - // Token: 0x02000009 RID: 9 - internal enum CRYPT_OUTPUT_TYPES - { - // Token: 0x04000014 RID: 20 - X509_PUBLIC_KEY_INFO = 8, - // Token: 0x04000015 RID: 21 - RSA_CSP_PUBLICKEYBLOB = 19, - // Token: 0x04000016 RID: 22 - PKCS_RSA_PRIVATE_KEY = 43, - // Token: 0x04000017 RID: 23 - PKCS_PRIVATE_KEY_INFO - } - - // Token: 0x0200000A RID: 10 - internal enum CRYPT_STRING_FLAGS : uint - { - // Token: 0x04000019 RID: 25 - CRYPT_STRING_BASE64HEADER, - // Token: 0x0400001A RID: 26 - CRYPT_STRING_BASE64, - // Token: 0x0400001B RID: 27 - CRYPT_STRING_BINARY, - // Token: 0x0400001C RID: 28 - CRYPT_STRING_BASE64REQUESTHEADER, - // Token: 0x0400001D RID: 29 - CRYPT_STRING_HEX, - // Token: 0x0400001E RID: 30 - CRYPT_STRING_HEXASCII, - // Token: 0x0400001F RID: 31 - CRYPT_STRING_BASE64_ANY, - // Token: 0x04000020 RID: 32 - CRYPT_STRING_ANY, - // Token: 0x04000021 RID: 33 - CRYPT_STRING_HEX_ANY, - // Token: 0x04000022 RID: 34 - CRYPT_STRING_BASE64X509CRLHEADER, - // Token: 0x04000023 RID: 35 - CRYPT_STRING_HEXADDR, - // Token: 0x04000024 RID: 36 - CRYPT_STRING_HEXASCIIADDR, - // Token: 0x04000025 RID: 37 - CRYPT_STRING_HEXRAW, - // Token: 0x04000026 RID: 38 - CRYPT_STRING_NOCRLF = 1073741824U, - // Token: 0x04000027 RID: 39 - CRYPT_STRING_NOCR = 2147483648U - } - - // Token: 0x0200000B RID: 11 - internal class CRYPT_OBJID_BLOB - { - // Token: 0x04000028 RID: 40 - internal uint cbData = default; - - // Token: 0x04000029 RID: 41 - internal IntPtr pbData = default; - } - - // Token: 0x0200000C RID: 12 - internal class CRYPT_ALGORITHM_IDENTIFIER - { - // Token: 0x0400002A RID: 42 - internal IntPtr pszObjId = default; - - // Token: 0x0400002B RID: 43 - internal RSACryptoServiceProviderExtension.CRYPT_OBJID_BLOB Parameters = default; - } - - // Token: 0x0200000D RID: 13 - private class CRYPT_BIT_BLOB - { - // Token: 0x0400002C RID: 44 - internal uint cbData = default; - - // Token: 0x0400002D RID: 45 - internal IntPtr pbData = default; - - // Token: 0x0400002E RID: 46 - internal uint cUnusedBits = default; - } - - // Token: 0x0200000E RID: 14 - private class CERT_PUBLIC_KEY_INFO - { - // Token: 0x0400002F RID: 47 - internal RSACryptoServiceProviderExtension.CRYPT_ALGORITHM_IDENTIFIER Algorithm = default; - - // Token: 0x04000030 RID: 48 - internal RSACryptoServiceProviderExtension.CRYPT_BIT_BLOB PublicKey = default; - } - } -} - diff --git a/Tiobon.Core.Common/Static/StaticPayInfo.cs b/Tiobon.Core.Common/Static/StaticPayInfo.cs deleted file mode 100644 index c516b806..00000000 --- a/Tiobon.Core.Common/Static/StaticPayInfo.cs +++ /dev/null @@ -1,37 +0,0 @@ - - -namespace Tiobon.Core.Common.Static -{ - public static class StaticPayInfo - { - /// - /// 商户号 - /// - public readonly static string MERCHANTID = AppSettings.app(new string[] { "PayInfo", "MERCHANTID" }).ObjToString(); - /// - /// 柜台号 - /// - public readonly static string POSID = AppSettings.app(new string[] { "PayInfo", "POSID" }).ObjToString(); - /// - /// 分行号 - /// - public readonly static string BRANCHID = AppSettings.app(new string[] { "PayInfo", "BRANCHID" }).ObjToString(); - /// - /// 公钥 - /// - public readonly static string pubKey = AppSettings.app(new string[] { "PayInfo", "pubKey" }).ObjToString(); - /// - /// 操作员号 - /// - public readonly static string USER_ID = AppSettings.app(new string[] { "PayInfo", "USER_ID" }).ObjToString(); - /// - /// 密码 - /// - public readonly static string PASSWORD = AppSettings.app(new string[] { "PayInfo", "PASSWORD" }).ObjToString(); - /// - /// 外联平台通讯地址 - /// - public readonly static string OutAddress = AppSettings.app(new string[] { "PayInfo", "OutAddress" }).ObjToString(); - - } -} diff --git a/Tiobon.Core.Common/Tiobon.Core.Common.csproj b/Tiobon.Core.Common/Tiobon.Core.Common.csproj index 04ed971e..0641eaf6 100644 --- a/Tiobon.Core.Common/Tiobon.Core.Common.csproj +++ b/Tiobon.Core.Common/Tiobon.Core.Common.csproj @@ -57,6 +57,7 @@ + diff --git a/Tiobon.Core.Extensions/ServiceExtensions/SwaggerSetup.cs b/Tiobon.Core.Extensions/ServiceExtensions/SwaggerSetup.cs index 05d25704..c425af07 100644 --- a/Tiobon.Core.Extensions/ServiceExtensions/SwaggerSetup.cs +++ b/Tiobon.Core.Extensions/ServiceExtensions/SwaggerSetup.cs @@ -53,7 +53,7 @@ namespace Tiobon.Core.Extensions Log.Error("Tiobon.Core.xml和Tiobon.Core.Model.xml 丢失,请检查并拷贝。\n" + ex.Message); } - c.MapType(() => new OpenApiSchema { Type = "string", Format = "string" }); + //c.MapType(() => new OpenApiSchema { Type = "string", Format = "string" }); // ids4和jwt切换 diff --git a/Tiobon.Core.IServices/IAccessTrendLogServices.cs b/Tiobon.Core.IServices/IAccessTrendLogServices.cs deleted file mode 100644 index 13219579..00000000 --- a/Tiobon.Core.IServices/IAccessTrendLogServices.cs +++ /dev/null @@ -1,14 +0,0 @@ -using Tiobon.Core.IServices.BASE; -using Tiobon.Core.Model.Models; - -namespace Tiobon.Core.IServices -{ - /// - /// IAccessTrendLogServices - /// - public interface IAccessTrendLogServices : IBaseServices - { - - } -} - \ No newline at end of file diff --git a/Tiobon.Core.IServices/IPayServices.cs b/Tiobon.Core.IServices/IPayServices.cs deleted file mode 100644 index d40a67cf..00000000 --- a/Tiobon.Core.IServices/IPayServices.cs +++ /dev/null @@ -1,42 +0,0 @@ - -using Tiobon.Core.IServices.BASE; -using Tiobon.Core.Model; -using Tiobon.Core.Model.ViewModels; -using System.Threading.Tasks; - -namespace Tiobon.Core.IServices -{ - /// - /// IPayServices - /// - public interface IPayServices : IBaseServices> - { - /// - /// 被扫支付 - /// - /// - Task> Pay(PayNeedModel payModel); - /// - /// 退款 - /// - /// - /// - Task> PayRefund(PayRefundNeedModel payModel); - /// - /// 轮询查询 - /// - /// - /// 轮询次数 - /// - Task> PayCheck(PayNeedModel payModel,int times); - /// - /// 验证签名 - /// - /// 参数 - /// 签名 - /// 公钥 - /// - bool NotifyCheck(string strSrc, string sign, string pubKey); - - } -} diff --git a/Tiobon.Core.Jobs/TaskCenter.cs b/Tiobon.Core.Jobs/TaskCenter.cs index 6c49a6f4..8e1e11cf 100644 --- a/Tiobon.Core.Jobs/TaskCenter.cs +++ b/Tiobon.Core.Jobs/TaskCenter.cs @@ -1,7 +1,4 @@ using Microsoft.Extensions.DependencyInjection; -using Serilog.Core; -using System; -using Tiobon.Core.Common; using Tiobon.Core.Tasks; namespace Tiobon.Core.Jobs; diff --git a/Tiobon.Core.Jobs/appsettings.json b/Tiobon.Core.Jobs/appsettings.json index 274dead7..50980a04 100644 --- a/Tiobon.Core.Jobs/appsettings.json +++ b/Tiobon.Core.Jobs/appsettings.json @@ -108,7 +108,7 @@ "DBType": 1, "Enabled": true, "Connection": "Data Source=47.99.54.186;User ID=GHR;Password=Tiobon20190101;Database=GHR30;Encrypt=True;TrustServerCertificate=True;", - //"Connection": "Data Source=116.204.98.209;User ID=Tiobon;Password=&($!4UGUyU#$2sp9O;Database=Tiobon;Encrypt=True;TrustServerCertificate=True;", + "Connection1": "Data Source=47.99.54.186;User ID=GHR;Password=Tiobon20190101;Database=GHR5_TY;Encrypt=True;TrustServerCertificate=True;", "ProviderName": "System.Data.SqlClient" }, { @@ -230,7 +230,8 @@ }, "Nacos": { "Enabled": false //Nacos注册中心 - } + }, + "FrontUrl": "https://g.tiobon.com" }, "Middleware": { "RequestResponseLog": { @@ -336,15 +337,6 @@ "ServiceHealthCheck": "/healthcheck", "ConsulAddress": "http://localhost:8500" }, - "PayInfo": { //建行聚合支付信息 - "MERCHANTID": "", //商户号 - "POSID": "", //柜台号 - "BRANCHID": "", //分行号 - "pubKey": "", //公钥 - "USER_ID": "", //操作员号 - "PASSWORD": "", //密码 - "OutAddress": "http://127.0.0.1:12345" //外联地址 - }, "nacos": { "ServerAddresses": [ "http://localhost:8848" ], // nacos 连接地址 "DefaultTimeOut": 15000, // 默认超时时间 @@ -368,5 +360,10 @@ "Enabled": true, "Address": "http://localhost:5341/", "ApiKey": "" + }, + "Resume": { + "CompanyName": "乔邦科技", + "LoginDesc": "应聘人员简历登记表", + "LoginTitle": "欢迎访问" } -} \ No newline at end of file +} diff --git a/Tiobon.Core.Model/CustomEnums/AuthorityScopeEnum.cs b/Tiobon.Core.Model/CustomEnums/AuthorityScopeEnum.cs deleted file mode 100644 index 2776d227..00000000 --- a/Tiobon.Core.Model/CustomEnums/AuthorityScopeEnum.cs +++ /dev/null @@ -1,30 +0,0 @@ -namespace Tiobon.Core.Model -{ - public enum AuthorityScopeEnum - { - /// - /// 无任何权限 - /// - NONE = -1, - /// - /// 自定义权限 - /// - Custom = 1, - /// - /// 本部门 - /// - MyDepart = 2, - /// - /// 本部门及以下 - /// - MyDepartAndDown = 3, - /// - /// 仅自己 - /// - OnlySelf = 4, - /// - /// 所有 - /// - ALL = 9 - } -} diff --git a/Tiobon.Core.Model/Models/AccessTrendLog.cs b/Tiobon.Core.Model/Models/AccessTrendLog.cs deleted file mode 100644 index a1170b0f..00000000 --- a/Tiobon.Core.Model/Models/AccessTrendLog.cs +++ /dev/null @@ -1,27 +0,0 @@ -using SqlSugar; -using System; - -namespace Tiobon.Core.Model.Models -{ - /// - /// 用户访问趋势日志 - /// - public class AccessTrendLog : RootEntityTkey - { - /// - /// 用户 - /// - [SugarColumn(Length = 128, IsNullable = true)] - public string UserInfo { get; set; } - - /// - /// 次数 - /// - public int Count { get; set; } - - /// - /// 更新时间 - /// - public DateTime UpdateTime { get; set; } = DateTime.Now; - } -} diff --git a/Tiobon.Core.Model/PaginationModel.cs b/Tiobon.Core.Model/PaginationModel.cs index b28214ee..e2f29fe3 100644 --- a/Tiobon.Core.Model/PaginationModel.cs +++ b/Tiobon.Core.Model/PaginationModel.cs @@ -2,8 +2,8 @@ { /// /// 所需分页参数 - /// 作者:胡丁文 - /// 时间:2020-4-3 20:31:26 + /// 作者:SimonHsiao + /// 时间:2024-5-3 20:31:26 /// public class PaginationModel { diff --git a/Tiobon.Core.Model/ResponseEnum.cs b/Tiobon.Core.Model/ResponseEnum.cs deleted file mode 100644 index b352a380..00000000 --- a/Tiobon.Core.Model/ResponseEnum.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System.ComponentModel; - -namespace Tiobon.Core.Model -{ - public enum ResponseEnum - { - /// - /// 无权限 - /// - [Description("无权限")] - NoPermissions = 401, - /// - /// 找不到指定资源 - /// - [Description("找不到指定资源")] - NoFound = 404, - /// - /// 找不到指定资源 - /// - [Description("服务器错误")] - ServerError = 500 - } -} diff --git a/Tiobon.Core.Model/TableModel.cs b/Tiobon.Core.Model/TableModel.cs deleted file mode 100644 index 1951426e..00000000 --- a/Tiobon.Core.Model/TableModel.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System.Collections.Generic; - -namespace Tiobon.Core.Model -{ - /// - /// 表格数据,支持分页 - /// - public class TableModel - { - /// - /// 返回编码 - /// - public int Code { get; set; } - /// - /// 返回信息 - /// - public string Msg { get; set; } - /// - /// 记录总数 - /// - public int Count { get; set; } - /// - /// 返回数据集 - /// - public List Data { get; set; } - } -} diff --git a/Tiobon.Core.Model/ViewModels/PayModel.cs b/Tiobon.Core.Model/ViewModels/PayModel.cs deleted file mode 100644 index 1d2bb4b6..00000000 --- a/Tiobon.Core.Model/ViewModels/PayModel.cs +++ /dev/null @@ -1,102 +0,0 @@ -namespace Tiobon.Core.Model.ViewModels -{ - public class PayModel - { - /// - /// 商户号 - /// - public string MERCHANTID { get; set; }//105910100190000");// => self::MERCHANTID, // 商户号 - /// - /// 柜台号 - /// - public string POSID { get; set; } //610000000");// => self::POSID, // 柜台号 - /// - /// 分行号 - /// - public string BRANCHID { get; set; } //610000000");// => self::BRANCHID, // 分行号 - /// - /// 集团商户信息 - /// - public string GROUPMCH { get; set; } //;// => '', // 集团商户信息 - /// - /// 交易码 - /// - public string TXCODE { get; set; } //PAY100");// => 'PAY100', // 交易码 - /// - /// 商户类型 - /// - public string MERFLAG { get; set; } //// => '', // 商户类型 - /// - /// 终端编号 1 - /// - public string TERMNO1 { get; set; } //// => '', // 终端编号 1 - /// - /// 终端编号 2 - /// - public string TERMNO2 { get; set; } //// => '', // 终端编号 2 - /// - /// 订单号 - /// - public string ORDERID { get; set; }//// => '', // 订单号 - /// - /// 码信息(一维码、二维码) - /// - public string QRCODE { get; set; } //// => '', // 码信息(一维码、二维码) - /// - /// 订单金额,单位:元 - /// - public string AMOUNT { get; set; } //");// => '0.01', // 订单金额,单位:元 - /// - /// 商品名称 - /// - public string PROINFO { get; set; } //// => '', // 商品名称 - /// - /// 备注 1 - /// - public string REMARK1 { get; set; } //// => '', // 备注 1 - /// - /// 备注 2 - /// - public string REMARK2 { get; set; }//// => '', // 备注 2 - /// - /// 分账信息一 - /// - public string FZINFO1 { get; set; } //// => '', // 分账信息一 - /// - /// 分账信息二 - /// - public string FZINFO2 { get; set; } //// => '', // 分账信息二 - /// - /// 子商户公众账号 ID - /// - public string SUB_APPID { get; set; } //);// => '', // 子商户公众账号 ID - /// - /// 返回信息位图 - /// - public string RETURN_FIELD { get; set; }// "");// => '', // 返回信息位图 - /// - /// 实名支付 - /// - public string USERPARAM { get; set; } //);// => '', // 实名支付 - /// - /// 商品详情 - /// - public string detail { get; set; }//// => '', // 商品详情 - /// - /// 订单优惠标记 - /// - public string goods_tag { get; set; } //);// => '', // 订单优惠标记 - /// - /// 公钥 - /// - public string pubKey { get; set; } - /// - /// 请求地址 - /// - public string url { get; set; } - /// - /// 是否删除空值 - /// - public bool deleteEmpty { get; set; } - } -} diff --git a/Tiobon.Core.Model/ViewModels/PayNeedModel.cs b/Tiobon.Core.Model/ViewModels/PayNeedModel.cs deleted file mode 100644 index 7cb3aa3e..00000000 --- a/Tiobon.Core.Model/ViewModels/PayNeedModel.cs +++ /dev/null @@ -1,34 +0,0 @@ -namespace Tiobon.Core.Model.ViewModels -{ - /// - /// 退款参数 - /// - public class PayNeedModel - { - - /// - /// 订单ID - /// - public string ORDERID { get; set; } - /// - /// 商品名称 - /// - public string PROINFO { get; set; } - /// - /// 支付金额(小数点最多两位) - /// - public string AMOUNT { get; set; } - /// - /// 二维码/条码信息 - /// - public string QRCODE { get; set; } - /// - /// 备注信息1 - /// - public string REMARK1 { get; set; } - /// - /// 备注信息2 - /// - public string REMARK2 { get; set; } - } -} diff --git a/Tiobon.Core.Model/ViewModels/PayRefundNeedModel.cs b/Tiobon.Core.Model/ViewModels/PayRefundNeedModel.cs deleted file mode 100644 index c92b5a6c..00000000 --- a/Tiobon.Core.Model/ViewModels/PayRefundNeedModel.cs +++ /dev/null @@ -1,21 +0,0 @@ -namespace Tiobon.Core.Model.ViewModels -{ - /// - /// 订单参数 - /// - public class PayRefundNeedModel - { - /// - /// 订单号 - /// - public string ORDER { get; set; } - /// - /// 退款金额 - /// - public string MONEY { get; set; } - /// - /// 退款流水号(可选) - /// - public string REFUND_CODE { get; set; } - } -} diff --git a/Tiobon.Core.Model/ViewModels/PayRefundReturnModel.cs b/Tiobon.Core.Model/ViewModels/PayRefundReturnModel.cs deleted file mode 100644 index 31cb92c1..00000000 --- a/Tiobon.Core.Model/ViewModels/PayRefundReturnModel.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace Tiobon.Core.Model.ViewModels -{ - /// - /// 退款返回消息 - /// - public class PayRefundReturnModel - { - /// - /// 序列号 - /// - public string REQUEST_SN { get; set; } - /// - /// 商户号 - /// - public string CUST_ID { get; set; } - /// - /// 交易码 - /// - public string TX_CODE { get; set; } - /// - /// 返回码 - /// - public string RETURN_CODE { get; set; } - /// - /// 返回码说明 - /// - public string RETURN_MSG { get; set; } - /// - /// 语言 - /// - public string LANGUAGE { get; set; } - /// - /// 订单信息 - /// - public PayRefundReturnOrderInfoModel TX_INFO { get; set; } - } -} diff --git a/Tiobon.Core.Model/ViewModels/PayRefundReturnOrderInfoModel.cs b/Tiobon.Core.Model/ViewModels/PayRefundReturnOrderInfoModel.cs deleted file mode 100644 index 9e51eaab..00000000 --- a/Tiobon.Core.Model/ViewModels/PayRefundReturnOrderInfoModel.cs +++ /dev/null @@ -1,30 +0,0 @@ -namespace Tiobon.Core.Model.ViewModels -{ - /// - /// 订单信息 - /// - public class PayRefundReturnOrderInfoModel - { - /// - /// 订单号 - /// - public string ORDER_NUM { get; set; } - /// - /// 支付金额 - /// - public string PAY_AMOUNT { get; set; } - /// - /// 退款金额 - /// - public string AMOUNT { get; set; } - /// - /// 备注1 - /// - public string REM1 { get; set; } - /// - /// 备注2 - /// - public string REM2 { get; set; } - - } -} diff --git a/Tiobon.Core.Model/ViewModels/PayRefundReturnResultModel.cs b/Tiobon.Core.Model/ViewModels/PayRefundReturnResultModel.cs deleted file mode 100644 index 68abff8d..00000000 --- a/Tiobon.Core.Model/ViewModels/PayRefundReturnResultModel.cs +++ /dev/null @@ -1,45 +0,0 @@ -namespace Tiobon.Core.Model.ViewModels -{ - /// - /// 退款返回结果消息 - /// - public class PayRefundReturnResultModel - { - /// - /// 订单号 - /// - public string ORDER_NUM { get; set; } - /// - /// 支付金额 - /// - public string PAY_AMOUNT { get; set; } - /// - /// 退款金额 - /// - public string AMOUNT { get; set; } - /// - /// 序列号 - /// - public string REQUEST_SN { get; set; } - /// - /// 商户号 - /// - public string CUST_ID { get; set; } - /// - /// 交易码 - /// - public string TX_CODE { get; set; } - /// - /// 返回码 - /// - public string RETURN_CODE { get; set; } - /// - /// 返回码说明 - /// - public string RETURN_MSG { get; set; } - /// - /// 语言 - /// - public string LANGUAGE { get; set; } - } -} diff --git a/Tiobon.Core.Model/ViewModels/PayResultModel.cs b/Tiobon.Core.Model/ViewModels/PayResultModel.cs deleted file mode 100644 index 3dacde5b..00000000 --- a/Tiobon.Core.Model/ViewModels/PayResultModel.cs +++ /dev/null @@ -1,53 +0,0 @@ -namespace Tiobon.Core.Model.ViewModels -{ - /// - /// 支付结果dto - /// - public class PayResultModel - { - /// - /// 支付结果 - /// Y:成功 - /// N:失败 - /// U:不确定 - /// Q:待轮询 - /// - public string RESULT { get; set; } - /// - /// 订单ID - /// - public string ORDERID { get; set; } - /// - /// 支付金额 - /// - public string AMOUNT { get; set; } - /// - /// 二维码类型 - /// 1:龙支付 - /// 2:微信 - /// 3:支付宝 - /// 4:银联 - /// - public string QRCODETYPE { get; set; } - /// - /// 等待时间-轮询等待时间 - /// - public string WAITTIME { get; set; } - /// - /// 全局事件跟踪号-建行交易流水号 - /// - public string TRACEID { get; set; } - /// - /// 错误码 - /// - public string ERRCODE { get; set; } - /// - /// 错误信息 - /// - public string ERRMSG { get; set; } - /// - /// 验证签名-防止伪造攻击 - /// - public string SIGN { get; set; } - } -} diff --git a/Tiobon.Core.Model/ViewModels/PayReturnResultModel.cs b/Tiobon.Core.Model/ViewModels/PayReturnResultModel.cs deleted file mode 100644 index 6a2ef7d5..00000000 --- a/Tiobon.Core.Model/ViewModels/PayReturnResultModel.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tiobon.Core.Model.ViewModels -{ - /// - /// 返回支付结果 - /// - public class PayReturnResultModel - { - /// - /// 发起的订单ID - /// - public string ORDERID { get; set; } - /// - /// 返回支付的金额 - /// - public string AMOUNT { get; set; } - /// - /// 返回支付的类型 1:龙支付 2:微信 3:支付宝 4:银联 - /// - public string QRCODETYPE { get; set; } - /// - /// 返回建行的流水号 - /// - public string TRACEID { get; set; } - /// - /// 错误代码 - /// - public string ERRCODE { get; set; } - /// - /// 错误信息 - /// - public string ERRMSG { get; set; } - } -} diff --git a/Tiobon.Core.Services/AccessTrendLogServices.cs b/Tiobon.Core.Services/AccessTrendLogServices.cs deleted file mode 100644 index b170cdd0..00000000 --- a/Tiobon.Core.Services/AccessTrendLogServices.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Tiobon.Core.IRepository.Base; -using Tiobon.Core.IServices; -using Tiobon.Core.Model.Models; -using Tiobon.Core.Services.BASE; - -namespace Tiobon.Core.Services -{ - public partial class AccessTrendLogServices : BaseServices, IAccessTrendLogServices - { - - } -} diff --git a/Tiobon.Core.Services/BASE/BaseServices.cs b/Tiobon.Core.Services/BASE/BaseServices.cs index 372c2a1b..dc9fbde5 100644 --- a/Tiobon.Core.Services/BASE/BaseServices.cs +++ b/Tiobon.Core.Services/BASE/BaseServices.cs @@ -1155,22 +1155,6 @@ public class BaseServices : IBaseServ //} } - /// - /// 获取根据ID查询的条件 - /// - /// - /// - protected QueryFilter QueryFilterById(Guid id) - { - return new QueryFilter - { - PageIndex = 1, - PageSize = 1, - Sorting = string.Empty, - Conditions = string.Empty - }; - } - #region 检查表中是否已经存在相同代码的数据 public static void CheckOnly(TEntity entity, long? id = null) diff --git a/Tiobon.Core.Services/CommonServices.cs b/Tiobon.Core.Services/CommonServices.cs index 1fc6f18e..bf62df37 100644 --- a/Tiobon.Core.Services/CommonServices.cs +++ b/Tiobon.Core.Services/CommonServices.cs @@ -1,6 +1,4 @@ using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.Logging; -using Mysqlx.Expr; using System.Text.RegularExpressions; namespace Tiobon.Core.Services; @@ -8,11 +6,9 @@ namespace Tiobon.Core.Services; public partial class CommonServices : BaseServices>, ICommonServices { IHttpContextAccessor _httpContextAccessor; - ILogger _logger; public ICaching _caching; - public CommonServices(ILogger logger, IHttpContextAccessor httpContextAccessor, ICaching caching = null) + public CommonServices(IHttpContextAccessor httpContextAccessor, ICaching caching = null) { - _logger = logger; _httpContextAccessor = httpContextAccessor; _caching = caching; } diff --git a/Tiobon.Core.Services/PayServices.cs b/Tiobon.Core.Services/PayServices.cs deleted file mode 100644 index f8423e5b..00000000 --- a/Tiobon.Core.Services/PayServices.cs +++ /dev/null @@ -1,400 +0,0 @@ -using Microsoft.Extensions.Logging; -using System.Text; -using Tiobon.Core.Common.Static; - -namespace Tiobon.Core.Services; - -public partial class PayServices : BaseServices>, IPayServices -{ - IHttpContextAccessor _httpContextAccessor; - ILogger _logger; - public PayServices(ILogger logger, IHttpContextAccessor httpContextAccessor) - { - _logger = logger; - _httpContextAccessor = httpContextAccessor; - } - - public async Task> Pay(PayNeedModel payModel) - { - _logger.LogInformation("支付开始"); - ServiceResult messageModel = new ServiceResult(); - messageModel.Data = new PayReturnResultModel(); - string url = string.Empty; - string param = string.Empty; - string returnData = string.Empty; - try - { - - _logger.LogInformation($"原始GET参数->{_httpContextAccessor.HttpContext.Request.QueryString}"); - //被扫支付 - string host = "https://ibsbjstar.ccb.com.cn/CCBIS/B2CMainPlat_00_BEPAY?"; - ////商户信息 - //string merInfo = "MERCHANTID=105910100190000&POSID=000000000&BRANCHID=610000000"; - ////获取柜台完整公钥 - //string pubKey = "30819d300d06092a864886f70d010101050003818b0030818702818100a32fb2d51dda418f65ca456431bd2f4173e41a82bb75c2338a6f649f8e9216204838d42e2a028c79cee19144a72b5b46fe6a498367bf4143f959e4f73c9c4f499f68831f8663d6b946ae9fa31c74c9332bebf3cba1a98481533a37ffad944823bd46c305ec560648f1b6bcc64d54d32e213926b26cd10d342f2c61ff5ac2d78b020111"; - ////加密原串 - //string param = merInfo + "&MERFLAG=1&TERMNO1=&TERMNO2=&ORDERID=937857156" + - // "&QRCODE=134737690209713400&AMOUNT=0.01&TXCODE=PAY100&PROINFO=&REMARK1=&REMARK2=&SMERID=&SMERNAME=&SMERTYPEID=" + - // "&SMERTYPE=&TRADECODE=&TRADENAME=&SMEPROTYPE=&PRONAME="; - - Dictionary dic = new Dictionary(); - - //支付信息 - dic.Add("MERCHANTID", StaticPayInfo.MERCHANTID);// => self::MERCHANTID, // 商户号 - dic.Add("POSID", StaticPayInfo.POSID);// => self::POSID, // 柜台号 - dic.Add("BRANCHID", StaticPayInfo.BRANCHID);// => self::BRANCHID, // 分行号 - dic.Add("TXCODE", "PAY100");// => 'PAY100', // 交易码 - dic.Add("MERFLAG", "1");// => '', // 商户类型 1线上 2线下 - dic.Add("ORDERID", payModel.ORDERID);//payModel.ORDERID);// => '', // 订单号 - dic.Add("QRCODE", payModel.QRCODE);// => '', // 码信息(一维码、二维码) - dic.Add("AMOUNT", payModel.AMOUNT);// => '0.01', // 订单金额,单位:元 - dic.Add("PROINFO", payModel.PROINFO);// => '', // 商品名称 - dic.Add("REMARK1", payModel.REMARK1);// => '', // 备注 1 - dic.Add("REMARK2", payModel.REMARK2);// => '', // 备注 2 - - //dic.Add("TERMNO1", "");// => '', // 终端编号 1 - //dic.Add("TERMNO2", "");// => '', // 终端编号 2 - //dic.Add("GROUPMCH", "");// => '', // 集团商户信息 - //dic.Add("FZINFO1", "");// => '', // 分账信息一 - //dic.Add("FZINFO2", "");// => '', // 分账信息二 - //dic.Add("SUB_APPID", "");// => '', // 子商户公众账号 ID - //dic.Add("RETURN_FIELD", "");// => '', // 返回信息位图 - //dic.Add("USERPARAM", "");// => '', // 实名支付 - //dic.Add("detail", "");// => '', // 商品详情 - //dic.Add("goods_tag", "");// => '', // 订单优惠标记 - - //商户信息 - Dictionary dicInfo = new Dictionary(); - dicInfo.Add("MERCHANTID", StaticPayInfo.MERCHANTID);// => self::MERCHANTID, // 商户号 - dicInfo.Add("POSID", StaticPayInfo.POSID);// => self::POSID, // 柜台号 - dicInfo.Add("BRANCHID", StaticPayInfo.BRANCHID);// => self::BRANCHID, // 分行号 - var Info = StringHelper.GetPars(dicInfo); - - - //获取拼接请求串 - param = StringHelper.GetPars(dic); - - //加密 - var paramEncryption = new CCBPayUtil().makeCCBParam(param, StaticPayInfo.pubKey); - //拼接请求串 - url = host + Info + "&ccbParam=" + paramEncryption; - //请求 - _logger.LogInformation($"请求地址->{url}"); - _logger.LogInformation($"请求参数->{param}"); - PayResultModel payResult; - try - { - returnData = await HttpHelper.PostAsync(url); - //转换数据 - try - { - payResult = JsonHelper.ParseFormByJson(returnData); - } - catch - { - payResult = new PayResultModel { RESULT = "N", ERRMSG = "参数错误", ORDERID = payModel.ORDERID, AMOUNT = payModel.AMOUNT }; - returnData = StringHelper.GetCusLine(returnData, 15); - } - _logger.LogInformation($"响应数据->{returnData}"); - } - catch (Exception ex) - { - _logger.LogInformation($"异常信息:{ex.Message}"); - _logger.LogInformation($"异常堆栈:{ex.StackTrace}"); - messageModel = await PayCheck(payModel, 1); - return messageModel; - } - switch (payResult.RESULT) - { - case "Y": - Dictionary dicCheckPars = new Dictionary(); - dicCheckPars.Add("RESULT", payResult.RESULT); - dicCheckPars.Add("ORDERID", payResult.ORDERID); - dicCheckPars.Add("AMOUNT", payResult.AMOUNT); - dicCheckPars.Add("WAITTIME", payResult.WAITTIME); - dicCheckPars.Add("TRACEID", payResult.TRACEID); - string strCheckPars = StringHelper.GetPars(dicCheckPars); - if (NotifyCheck(strCheckPars, payResult.SIGN, StaticPayInfo.pubKey)) - { - messageModel.Success = true; - messageModel.Message = "支付成功"; - } - else - { - messageModel.Success = false; - messageModel.Message = "签名失败"; - } - break; - case "N": - messageModel.Success = false; - messageModel.Message = "支付失败"; - break; - case "U": - case "Q": - int waittime = payResult.WAITTIME.ObjToInt(); - if (waittime <= 0) waittime = 5;//如果需要等待默认等待5秒后再次查询 - Thread.Sleep(waittime * 1000); - //轮询查询 - messageModel = await PayCheck(payModel, 1); - break; - default: - messageModel.Success = false; - messageModel.Message = "支付失败"; - break; - } - messageModel.Data.ORDERID = payResult.ORDERID; - messageModel.Data.ERRCODE = payResult.ERRCODE; - messageModel.Data.ERRMSG = payResult.ERRMSG; - messageModel.Data.TRACEID = payResult.TRACEID; - messageModel.Data.AMOUNT = payResult.AMOUNT; - messageModel.Data.QRCODETYPE = payResult.QRCODETYPE; - } - catch (Exception ex) - { - messageModel.Success = false; - messageModel.Message = "服务错误"; - messageModel.Data.ERRMSG = ex.Message; - _logger.LogInformation($"异常信息:{ex.Message}"); - _logger.LogInformation($"异常堆栈:{ex.StackTrace}"); - } - finally - { - _logger.LogInformation($"返回数据->{JsonHelper.GetJSON>(messageModel)}"); - _logger.LogInformation("支付结束"); - } - return messageModel; - } - public async Task> PayRefund(PayRefundNeedModel payModel) - { - _logger.LogInformation("退款开始"); - ServiceResult messageModel = new ServiceResult(); - messageModel.Data = new PayRefundReturnResultModel(); - try - { - _logger.LogInformation($"原始GET参数->{_httpContextAccessor.HttpContext.Request.QueryString}"); - - string REQUEST_SN = StringHelper.GetGuidToLongID().ToString().Substring(0, 16);//请求序列码 - string CUST_ID = StaticPayInfo.MERCHANTID;//商户号 - string USER_ID = StaticPayInfo.USER_ID;//操作员号 - string PASSWORD = StaticPayInfo.PASSWORD;//密码 - string TX_CODE = "5W1004";//交易码 - string LANGUAGE = "CN";//语言 - //string SIGN_INFO = "";//签名信息 - //string SIGNCERT = "";//签名CA信息 - //外联平台客户端服务部署的地址+设置的监听端口 - string sUrl = StaticPayInfo.OutAddress; - - //XML请求报文 - //string sRequestMsg = $" requestXml={REQUEST_SN}{CUST_ID}{USER_ID}{PASSWORD}{TX_CODE}{LANGUAGE}{payModel.MONEY}{payModel.ORDER}{payModel.REFUND_CODE} "; - string sRequestMsg = $"{REQUEST_SN}{CUST_ID}{USER_ID}{PASSWORD}{TX_CODE}{LANGUAGE}{payModel.MONEY}{payModel.ORDER}{payModel.REFUND_CODE} "; - - //string sRequestMsg = readRequestFile("E:/02-外联平台/06-测试/测试报文/商户网银/客户端连接-5W1001-W06.txt"); - - - //注意:请求报文必须放在requestXml参数送 - sRequestMsg = "requestXml=" + sRequestMsg; - - _logger.LogInformation("请求地址:" + sUrl); - _logger.LogInformation("请求报文:" + sRequestMsg); - - HttpClient request = new HttpClient(); - byte[] byteRquest = Encoding.GetEncoding("GB18030").GetBytes(sRequestMsg); - ByteArrayContent bytemsg = new ByteArrayContent(byteRquest); - HttpResponseMessage resulthd = await request.PostAsync(sUrl, bytemsg); - Stream result = await resulthd.Content.ReadAsStreamAsync(); - - StreamReader readerResult = new StreamReader(result, System.Text.Encoding.GetEncoding("GB18030")); - string sResult = await readerResult.ReadToEndAsync(); - _logger.LogInformation("响应报文:" + sResult); - var Xmlresult = XmlHelper.ParseFormByXml(sResult, "TX"); - if (Xmlresult.RETURN_CODE.Equals("000000")) - { - messageModel.Success = true; - messageModel.Message = "退款成功"; - } - else - { - messageModel.Success = false; - messageModel.Message = "退款失败"; - } - messageModel.Data.RETURN_MSG = Xmlresult.RETURN_MSG; - messageModel.Data.TX_CODE = Xmlresult.TX_CODE; - messageModel.Data.REQUEST_SN = Xmlresult.REQUEST_SN; - messageModel.Data.RETURN_CODE = Xmlresult.RETURN_CODE; - messageModel.Data.CUST_ID = Xmlresult.CUST_ID; - messageModel.Data.LANGUAGE = Xmlresult.LANGUAGE; - - messageModel.Data.AMOUNT = Xmlresult.TX_INFO?.AMOUNT; - messageModel.Data.PAY_AMOUNT = Xmlresult.TX_INFO?.PAY_AMOUNT; - messageModel.Data.ORDER_NUM = Xmlresult.TX_INFO?.ORDER_NUM; - request.Dispose(); - } - catch (Exception ex) - { - messageModel.Success = false; - messageModel.Message = "服务错误"; - messageModel.Data.RETURN_MSG = ex.Message; - _logger.LogInformation($"异常信息:{ex.Message}"); - _logger.LogInformation($"异常堆栈:{ex.StackTrace}"); - } - finally - { - _logger.LogInformation($"返回数据->{JsonHelper.GetJSON>(messageModel)}"); - _logger.LogInformation("退款结束"); - - } - return messageModel; - - } - public async Task> PayCheck(PayNeedModel payModel, int times) - { - _logger.LogInformation("轮询开始"); - - ServiceResult messageModel = new ServiceResult(); - messageModel.Data = new PayReturnResultModel(); - string url = string.Empty; - string param = string.Empty; - string returnData = string.Empty; - try - { - //设置最大轮询次数,跟建行保持一致 - int theLastTime = 6; - if (times > theLastTime) throw new Exception($"轮询次数超过最大次数{theLastTime}"); - - string host = "https://ibsbjstar.ccb.com.cn/CCBIS/B2CMainPlat_00_BEPAY?"; - - Dictionary dic = new Dictionary(); - - dic.Add("MERCHANTID", StaticPayInfo.MERCHANTID);// => self::MERCHANTID, // 商户号 - dic.Add("POSID", StaticPayInfo.POSID);// => self::POSID, // 柜台号 - dic.Add("BRANCHID", StaticPayInfo.BRANCHID);// => self::BRANCHID, // 分行号 - dic.Add("TXCODE", "PAY101");// => 'PAY100', // 交易码 - dic.Add("QRYTIME", times.ToString());// => '', // 查询此时(每次加1) - dic.Add("MERFLAG", "1");// => '', // 商户类型 - dic.Add("ORDERID", payModel.ORDERID);// => '', // 订单号 - dic.Add("QRCODE", payModel.QRCODE);// => '', // 码信息(一维码、二维码) - - - //dic.Add("GROUPMCH", "");// => '', // 集团商户信息 - //dic.Add("QRCODETYPE", "");// => '', // 支付类型1:龙支付 2:微信 3:支付宝 4:银联 - //dic.Add("TERMNO1", "");// => '', // 终端编号 1 - //dic.Add("TERMNO2", "");// => '', // 终端编号 2 - //dic.Add("AMOUNT", "");// => '0.01', // 订单金额,单位:元 - //dic.Add("PROINFO", "");// => '', // 商品名称 - //dic.Add("REMARK1", "");// => '', // 备注 1 - //dic.Add("REMARK2", "");// => '', // 备注 2 - //dic.Add("FZINFO1", "");// => '', // 分账信息一 - //dic.Add("FZINFO2", "");// => '', // 分账信息二 - //dic.Add("SUB_APPID", "");// => '', // 子商户公众账号 ID - //dic.Add("RETURN_FIELD", "");// => '', // 返回信息位图 - //dic.Add("USERPARAM", "");// => '', // 实名支付 - //dic.Add("detail", "");// => '', // 商品详情 - //dic.Add("goods_tag", "");// => '', // 订单优惠标记 - - //商户信息 - Dictionary dicInfo = new Dictionary(); - dicInfo.Add("MERCHANTID", StaticPayInfo.MERCHANTID);// => self::MERCHANTID, // 商户号 - dicInfo.Add("POSID", StaticPayInfo.POSID);// => self::POSID, // 柜台号 - dicInfo.Add("BRANCHID", StaticPayInfo.BRANCHID);// => self::BRANCHID, // 分行号 - var Info = StringHelper.GetPars(dicInfo); - - //var newDic = dic.OrderBy(t => t.Key).ToDictionary(o => o.Key, p => p.Value); - //参数信息 - param = StringHelper.GetPars(dic); - //加密 - var paramEncryption = new CCBPayUtil().makeCCBParam(param, StaticPayInfo.pubKey); - //拼接请求串 - url = host + Info + "&ccbParam=" + paramEncryption; - //请求 - _logger.LogInformation($"请求地址->{url}"); - _logger.LogInformation($"请求参数->{param}"); - //转换数据 - PayResultModel payResult; - try - { - returnData = await HttpHelper.PostAsync(url); - _logger.LogInformation($"响应数据->{returnData}"); - } - catch (Exception ex) - { - _logger.LogInformation($"异常信息:{ex.Message}"); - _logger.LogInformation($"异常堆栈:{ex.StackTrace}"); - return await PayCheck(payModel, ++times); - } - - - try - { - payResult = JsonHelper.ParseFormByJson(returnData); - } - catch - { - payResult = new PayResultModel { RESULT = "N", ERRMSG = "参数错误", ORDERID = payModel.ORDERID, AMOUNT = payModel.AMOUNT }; - } - - switch (payResult.RESULT) - { - case "Y": - Dictionary dicCheckPars = new Dictionary(); - dicCheckPars.Add("RESULT", payResult.RESULT); - dicCheckPars.Add("ORDERID", payResult.ORDERID); - dicCheckPars.Add("AMOUNT", payResult.AMOUNT); - dicCheckPars.Add("WAITTIME", payResult.WAITTIME); - string strCheckPars = StringHelper.GetPars(dicCheckPars); - if (NotifyCheck(strCheckPars, payResult.SIGN, StaticPayInfo.pubKey)) - { - messageModel.Success = true; - messageModel.Message = "支付成功"; - } - else - { - messageModel.Success = false; - messageModel.Message = "签名失败"; - } - break; - case "N": - messageModel.Success = false; - messageModel.Message = "支付失败"; - break; - case "U": - case "Q": - int waittime = payResult.WAITTIME.ObjToInt(); - if (waittime <= 0) waittime = 5;//如果需要等待默认等待5秒后再次查询 - Thread.Sleep(waittime * 1000); - //改成轮询查询 - messageModel = await PayCheck(payModel, ++times); - break; - default: - messageModel.Success = false; - messageModel.Message = "支付失败"; - break; - } - messageModel.Data.ORDERID = payResult.ORDERID; - messageModel.Data.ERRCODE = payResult.ERRCODE; - messageModel.Data.ERRMSG = payResult.ERRMSG; - messageModel.Data.TRACEID = payResult.TRACEID; - messageModel.Data.AMOUNT = payResult.AMOUNT; - messageModel.Data.QRCODETYPE = payResult.QRCODETYPE; - } - catch (Exception ex) - { - messageModel.Success = false; - messageModel.Message = "服务错误"; - messageModel.Data.ERRMSG = ex.Message; - _logger.LogInformation($"异常信息:{ex.Message}"); - _logger.LogInformation($"异常堆栈:{ex.StackTrace}"); - } - finally - { - _logger.LogInformation($"返回数据->{JsonHelper.GetJSON>(messageModel)}"); - _logger.LogInformation("轮序结束"); - } - return messageModel; - } - - public bool NotifyCheck(string strSrc, string sign, string pubKey) - { - - return new CCBPayUtil().verifyNotifySign(strSrc, sign, pubKey); - } -} diff --git a/Tiobon.Core.Services/ReportServices.cs b/Tiobon.Core.Services/ReportServices.cs index 11b512f9..9d021271 100644 --- a/Tiobon.Core.Services/ReportServices.cs +++ b/Tiobon.Core.Services/ReportServices.cs @@ -1,16 +1,14 @@ -using Microsoft.Extensions.Logging; -using static Tiobon.Core.Model.Consts; +using static Tiobon.Core.Model.Consts; namespace Tiobon.Core.Services; public partial class ReportServices : BaseServices, IReportServices { IHttpContextAccessor _httpContextAccessor; - ILogger _logger; + private readonly IGhra_StaffServices _staffServices; - public ReportServices(ILogger logger, IHttpContextAccessor httpContextAccessor, ICaching caching = null, IGhra_StaffServices staffServices = null) + public ReportServices(IHttpContextAccessor httpContextAccessor, ICaching caching = null, IGhra_StaffServices staffServices = null) { - _logger = logger; _httpContextAccessor = httpContextAccessor; _caching = caching; _staffServices = staffServices; diff --git a/Tiobon.Core.Tasks/HostedService/Job1TimedService.cs b/Tiobon.Core.Tasks/HostedService/Job1TimedService.cs deleted file mode 100644 index d6c4259e..00000000 --- a/Tiobon.Core.Tasks/HostedService/Job1TimedService.cs +++ /dev/null @@ -1,56 +0,0 @@ -using Microsoft.Extensions.Hosting; -using Tiobon.Core.Common; -using Tiobon.Core.IServices; - -namespace Tiobon.Core.Tasks; - -public class Job1TimedService : IHostedService, IDisposable -{ - private Timer _timer; - private readonly ITiobonArticleServices _TiobonArticleServices; - - // 这里可以注入 - public Job1TimedService(ITiobonArticleServices TiobonArticleServices) - { - _TiobonArticleServices = TiobonArticleServices; - } - - public Task StartAsync(CancellationToken cancellationToken) - { - Console.WriteLine("Job 1 is starting."); - - _timer = new Timer(DoWork, null, TimeSpan.Zero, - TimeSpan.FromSeconds(60 * 60));//一个小时 - - return Task.CompletedTask; - } - - private void DoWork(object state) - { - try - { - var model = _TiobonArticleServices.GetTiobonDetails(1).Result; - Console.WriteLine($"Job 1 启动成功,获取id=1的博客title为:{model?.btitle}"); - } - catch (Exception ex) - { - Console.WriteLine($"Error:{ex.Message}"); - } - - ConsoleHelper.WriteSuccessLine($"Job 1: {DateTime.Now}"); - } - - public Task StopAsync(CancellationToken cancellationToken) - { - Console.WriteLine("Job 1 is stopping."); - - _timer?.Change(Timeout.Infinite, 0); - - return Task.CompletedTask; - } - - public void Dispose() - { - _timer?.Dispose(); - } -} diff --git a/Tiobon.Core.Tasks/HostedService/Job2TimedService.cs b/Tiobon.Core.Tasks/HostedService/Job2TimedService.cs deleted file mode 100644 index bbf59f97..00000000 --- a/Tiobon.Core.Tasks/HostedService/Job2TimedService.cs +++ /dev/null @@ -1,43 +0,0 @@ -using Microsoft.Extensions.Hosting; -using Tiobon.Core.Common; - -namespace Tiobon.Core.Tasks; - -public class Job2TimedService : IHostedService, IDisposable -{ - private Timer _timer; - - // 这里可以注入 - public Job2TimedService() - { - } - - public Task StartAsync(CancellationToken cancellationToken) - { - Console.WriteLine("Job 2 is starting."); - - _timer = new Timer(DoWork, null, TimeSpan.Zero, - TimeSpan.FromSeconds(60 * 60 * 2));//两个小时 - - return Task.CompletedTask; - } - - private void DoWork(object state) - { - ConsoleHelper.WriteWarningLine($"Job 2: {DateTime.Now}"); - } - - public Task StopAsync(CancellationToken cancellationToken) - { - Console.WriteLine("Job 2 is stopping."); - - _timer?.Change(Timeout.Infinite, 0); - - return Task.CompletedTask; - } - - public void Dispose() - { - _timer?.Dispose(); - } -} diff --git a/Tiobon.Core.Tasks/QuartzNet/Jobs/Job_AccessTrendLog_Quartz.cs b/Tiobon.Core.Tasks/QuartzNet/Jobs/Job_AccessTrendLog_Quartz.cs deleted file mode 100644 index 61092b60..00000000 --- a/Tiobon.Core.Tasks/QuartzNet/Jobs/Job_AccessTrendLog_Quartz.cs +++ /dev/null @@ -1,140 +0,0 @@ -using Microsoft.AspNetCore.Hosting; -using Newtonsoft.Json; -using Quartz; -using System.Text; -using Tiobon.Core.Common.LogHelper; -using Tiobon.Core.IServices; -using Tiobon.Core.Model.Models; - -/// -/// 这里要注意下,命名空间和程序集是一样的,不然反射不到 -/// -namespace Tiobon.Core.Tasks; - -public class Job_AccessTrendLog_Quartz : JobBase, IJob -{ - private readonly IAccessTrendLogServices _accessTrendLogServices; - private readonly IWebHostEnvironment _environment; - - public Job_AccessTrendLog_Quartz(IAccessTrendLogServices accessTrendLogServices, IWebHostEnvironment environment, ITasksQzServices tasksQzServices, ITasksLogServices tasksLogServices) - : base(tasksQzServices, tasksLogServices) - { - _accessTrendLogServices = accessTrendLogServices; - _environment = environment; - _tasksQzServices = tasksQzServices; - } - public async Task Execute(IJobExecutionContext context) - { - var executeLog = await ExecuteJob(context, async () => await Run(context)); - } - public async Task Run(IJobExecutionContext context) - { - - // 可以直接获取 JobDetail 的值 - var jobKey = context.JobDetail.Key; - var jobId = jobKey.Name; - // 也可以通过数据库配置,获取传递过来的参数 - JobDataMap data = context.JobDetail.JobDataMap; - - var lastestLogDatetime = (await _accessTrendLogServices.Query(null, d => d.UpdateTime, false)).FirstOrDefault()?.UpdateTime; - if (lastestLogDatetime == null) - { - lastestLogDatetime = Convert.ToDateTime("2021-09-01"); - } - - var accLogs = GetAccessLogs().Where(d => d.User != "" && d.BeginTime.ObjToDate() >= lastestLogDatetime).ToList(); - var logUpdate = DateTime.Now; - - var activeUsers = (from n in accLogs - group n by new { n.User } into g - select new ActiveUserVM - { - user = g.Key.User, - count = g.Count(), - }).ToList(); - - foreach (var item in activeUsers) - { - var user = (await _accessTrendLogServices.Query(d => d.UserInfo != "" && d.UserInfo == item.user)).FirstOrDefault(); - if (user != null) - { - user.Count += item.count; - user.UpdateTime = logUpdate; - await _accessTrendLogServices.Update(user); - } - else - { - await _accessTrendLogServices.Add(new AccessTrendLog() - { - Count = item.count, - UpdateTime = logUpdate, - UserInfo = item.user - }); - } - } - - // 重新拉取 - var actUsers = await _accessTrendLogServices.Query(d => d.UserInfo != "", d => d.Count, false); - actUsers = actUsers.Take(15).ToList(); - - List activeUserVMs = new(); - foreach (var item in actUsers) - { - activeUserVMs.Add(new ActiveUserVM() - { - user = item.UserInfo, - count = item.Count - }); - } - - Parallel.For(0, 1, e => - { - LogLock.OutLogAOP("ACCESSTRENDLOG", "", new string[] { activeUserVMs.GetType().ToString(), JsonConvert.SerializeObject(activeUserVMs) }, false); - }); - } - - private List GetAccessLogs() - { - List userAccessModels = new(); - var accessLogs = LogLock.ReadLog( - Path.Combine(_environment.ContentRootPath, "Log"), "RecordAccessLogs_", Encoding.UTF8, ReadType.Prefix, 2 - ).ObjToString().TrimEnd(','); - - try - { - return JsonConvert.DeserializeObject>("[" + accessLogs + "]"); - } - catch (Exception) - { - var accLogArr = accessLogs.Split("\n"); - foreach (var item in accLogArr) - { - if (item.ObjToString() != "") - { - try - { - var accItem = JsonConvert.DeserializeObject(item.TrimEnd(',')); - userAccessModels.Add(accItem); - } - catch (Exception) - { - } - } - } - - } - - return userAccessModels; - } - -} -public class UserAccessFromFIles -{ - public string User { get; set; } - public string IP { get; set; } - public string API { get; set; } - public string BeginTime { get; set; } - public string OPTime { get; set; } - public string RequestMethod { get; set; } = ""; - public string Agent { get; set; } -}