/// <summary> /// 对账单数据名称检测 /// </summary> /// <param name="names"></param> /// <param name="type"></param> /// <returns></returns> internal static bool CheckName(subString names, billType type) { switch (type) { case billType.ALL: return(names.Equals("交易时间,公众账号ID,商户号,子商户号,设备号,微信订单号,商户订单号,用户标识,交易类型,交易状态,付款银行,货币种类,总金额,代金券或立减优惠金额,微信退款单号,商户退款单号,退款金额,代金券或立减优惠退款金额,退款类型,退款状态,商品名称,商户数据包,手续费,费率")); case billType.SUCCESS: return(names.Equals("交易时间,公众账号ID,商户号,子商户号,设备号,微信订单号,商户订单号,用户标识,交易类型,交易状态,付款银行,货币种类,总金额,代金券或立减优惠金额,商品名称,商户数据包,手续费,费率")); case billType.REFUND: return(names.Equals("交易时间,公众账号ID,商户号,子商户号,设备号,微信订单号,商户订单号,用户标识,交易类型,交易状态,付款银行,货币种类,总金额,代金券或立减优惠金额,退款申请时间,退款成功时间,微信退款单号,商户退款单号,退款金额,代金券或立减优惠退款金额,退款类型,退款状态,商品名称,商户数据包,手续费,费率")); } return(false); }
/// <summary> /// 对账单统计数据 /// </summary> /// <param name="names"></param> /// <returns></returns> internal static bool CheckName(subString names) { return(names.Equals("总交易单数,总交易额,总退款金额,总代金券或立减优惠退款金额,手续费总金额")); }
/// <summary> /// 加载配置文件 /// </summary> /// <param name="file">配置文件</param> private unsafe void load(FileInfo file) { if (file.Exists) { string fileName = file.FullName.fileNameToLower(); int count = files.length; if (count != 0) { foreach (string name in files.array) { if (errors.length == 0) { if (name == fileName) { errors.Add("配置文件循环嵌套"); errors.Add(name); } } else { errors.Add(name); } if (--count == 0) { break; } } if (errors.length != 0) { log.Error.Real(errors.joinString(@" "), new System.Diagnostics.StackFrame(), false); errors.Empty(); } } string config = File.ReadAllText(fileName, appSetting.Encoding); fixed(char *configFixed = config) { for (char *current = configFixed, end = configFixed + config.Length; current != end;) { char *start = current; while (*current != '=' && ++current != end) { ; } if (current == end) { break; } subString name = subString.Unsafe(config, (int)(start - configFixed), (int)(current - start)); if (name.Equals(appSetting.ConfigIncludeName)) { for (start = ++current; current != end && *current != '\n'; ++current) { ; } Load(Path.Combine(file.DirectoryName, config.Substring((int)(start - configFixed), (int)(current - start)).Trim())); if (current == end) { break; } ++current; } else { for (start = ++current; current != end; ++current) { if (*current == '\n') { while (++current != end && *current == '\n') { ; } if (current == end) { break; } if (*current != '\t' && *current != ' ') { break; } } } hashString nameKey = name; if (configs.ContainsKey(nameKey)) { log.Error.Real("重复的配置名称 : " + name.ToString(), new System.Diagnostics.StackFrame(), false); } else { configs.Add(nameKey, subString.Unsafe(config, (int)(start - configFixed), (int)(current - start))); } } } } } else { log.Default.Real("找不到配置文件 : " + file.FullName, new System.Diagnostics.StackFrame(), false); } }