|
@@ -54,13 +54,6 @@ namespace MySystem
|
|
|
JsonData jsonObj = JsonMapper.ToObject(content);
|
|
|
if (jsonObj.Count > 0)
|
|
|
{
|
|
|
- // if (jsonObj["event_type"].ToString() == "TRANSACTION.SUCCESS")
|
|
|
- // {
|
|
|
- // JsonData resource = jsonObj["resource"];
|
|
|
- //开始解密
|
|
|
- // string WxPayResourceDecryptModel = AesGcmDecrypt(resource["associated_data"].ToString(), resource["nonce"].ToString(), resource["ciphertext"].ToString());
|
|
|
- // {\"sp_mchid\":\"1611167423\",\"sub_mchid\":\"1622024882\",\"sp_appid\":\"wxe2c051b3e46c0f6f\",\"out_trade_no\":\"2022022621562926396898863\",\"transaction_id\":\"4200001412202202267619496496\",\"trade_type\":\"JSAPI\",\"trade_state\":\"SUCCESS\",\"trade_state_desc\":\"支付成功\",\"bank_type\":\"OTHERS\",\"attach\":\"\",\"success_time\":\"2022-02-26T21:56:42+08:00\",\"payer\":{\"sp_openid\":\"omawy5W6jb0pgPfuKUVs6K3bEhzk\",\"sub_openid\":\"\"},\"amount\":{\"total\":1,\"payer_total\":1,\"currency\":\"CNY\",\"payer_currency\":\"CNY\"}}
|
|
|
- // JsonData orderObj = JsonMapper.ToObject(WxPayResourceDecryptModel);
|
|
|
string OrderNo = jsonObj["outOrderNo"].ToString();
|
|
|
string TradeNo = jsonObj["orderNo"].ToString();
|
|
|
WebCMSEntities db = new WebCMSEntities();
|
|
@@ -90,27 +83,9 @@ namespace MySystem
|
|
|
}
|
|
|
}
|
|
|
db.Dispose();
|
|
|
- // }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // public string AesGcmDecrypt(string associatedData, string nonce, string ciphertext)
|
|
|
- // {
|
|
|
- // GcmBlockCipher gcmBlockCipher = new GcmBlockCipher(new AesEngine());
|
|
|
- // AeadParameters aeadParameters = new AeadParameters(
|
|
|
- // new KeyParameter(Encoding.UTF8.GetBytes(AppConfig.WeChatParam.AesGemKey)),
|
|
|
- // 128,
|
|
|
- // Encoding.UTF8.GetBytes(nonce),
|
|
|
- // Encoding.UTF8.GetBytes(associatedData));
|
|
|
- // gcmBlockCipher.Init(false, aeadParameters);
|
|
|
-
|
|
|
- // byte[] data = Convert.FromBase64String(ciphertext);
|
|
|
- // byte[] plaintext = new byte[gcmBlockCipher.GetOutputSize(data.Length)];
|
|
|
- // int length = gcmBlockCipher.ProcessBytes(data, 0, data.Length, plaintext, 0);
|
|
|
- // gcmBlockCipher.DoFinal(plaintext, length);
|
|
|
- // return Encoding.UTF8.GetString(plaintext);
|
|
|
- // }
|
|
|
-
|
|
|
//分账队列
|
|
|
public void StartProfitShare()
|
|
|
{
|
|
@@ -140,39 +115,28 @@ namespace MySystem
|
|
|
if (order.IsAct == 1 && order.PayMoney >= set.MinPayMoney)
|
|
|
{
|
|
|
MerchantAddInfo merchantAdd = db.MerchantAddInfo.FirstOrDefault(m => m.Id == order.MerchantId) ?? new MerchantAddInfo();
|
|
|
- //添加分账接收方
|
|
|
- // if(merchant.Version == 0)
|
|
|
- // {
|
|
|
- // AddOpenDivideAccounts addOpenDivideAccounts =
|
|
|
- // HaoDaHelper.Instance.AddOpenDivideAccounts();
|
|
|
- // merchant.Version = 1;
|
|
|
- // db.SaveChanges();
|
|
|
- // }
|
|
|
//发起分账
|
|
|
decimal fee = order.PayMoney; //单位:分
|
|
|
if (fee >= 1)
|
|
|
{
|
|
|
- string TradeNo = order.SeoTitle;
|
|
|
- string OrderNo = order.OrderNo;
|
|
|
- string applyNo = "FZ202307050006";
|
|
|
- string mchtNo = "";
|
|
|
- string orderNo = "";
|
|
|
- string acctNo = "";
|
|
|
- string acctType = "1";
|
|
|
- string amount = "";
|
|
|
+ string applyNo = "FZ" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8); //批次号
|
|
|
+ string mchtNo = merchantAdd.OutMchtNo; //慧掌柜商户号
|
|
|
+ string orderNo = order.OrderNo; //交易订单号(好哒平台订单号,G开头)
|
|
|
+ string acctNo = AppConfig.Haoda.AcctNo; //账户号,账户类型为商户收款账户时填收款商户号, 账户类型为分账接收方时填分账接收方账户号
|
|
|
+ string acctType = "1"; //账户类型(0:商户收款账户(大B),1:分账接收方账户(小B))
|
|
|
+ string amount = (fee * (1M - 0.0038M)).ToString(); //金额(分)
|
|
|
HaoDaHelper.Instance.OrderDivideAccounts(OrderDivideAccountsUtil.AddValue(applyNo, mchtNo, orderNo, acctNo, acctType, amount));
|
|
|
|
|
|
//开始监听分账状态
|
|
|
Dictionary<string, object> req = new Dictionary<string, object>();
|
|
|
- req.Add("SubMchid", merchantAdd.SubMchid); //子商户号
|
|
|
- req.Add("TradeNo", TradeNo); //微信订单号
|
|
|
- req.Add("OrderNo", OrderNo); //商户订单号
|
|
|
+ req.Add("ApplyNo", applyNo);
|
|
|
+ req.Add("OrderNo", orderNo);
|
|
|
+ req.Add("MchtNo", mchtNo);
|
|
|
RedisDbconn.Instance.AddList("ProfitShareQueue", Newtonsoft.Json.JsonConvert.SerializeObject(req));
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
RedisDbconn.Instance.AddList("ConsumerOrders:Divi:2:List", order.Id.ToString());
|
|
|
- // RedisDbconn.Instance.AddRightList("ConsumerOrders:Divi:2:" + order.MerchantId, order);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -182,7 +146,7 @@ namespace MySystem
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
- function.WriteLog(DateTime.Now.ToString() + ":" + ex.ToString(), "微信分账队列异常");
|
|
|
+ function.WriteLog(DateTime.Now.ToString() + ":" + ex.ToString(), "好哒分账队列异常");
|
|
|
}
|
|
|
Thread.Sleep(2000);
|
|
|
}
|