public static void MsiMspScan(string path, string outputFileName) { Logger.SetupLog(); Controller.Init(Output, null, null); Output("Scanning MSI/MSP packages from:" + path); // SQLProduct sql2016 = new SQLProduct("SQL2016", SQLSetupSource); // sqlProducts.Add(sql2016); SQLProduct sql = new SQLProduct(outputFileName, path); try { //string content = OutputProcessor.SerializeToXML<SQLProduct>(sql); //File.WriteAllText(outputFileName, content); string name = "SQLMsiMsp_Scan_" + System.DateTime.Now.ToString("_yyyy-MM-dd_HH_mm_ss"); SQLProductSum sumFromSetupSrc = new SQLProductSum(name, path, "By SQLMsiMspScan."); sumFromSetupSrc.InitOrAddHashSet(sql); string file = Path.GetFileNameWithoutExtension(outputFileName).Replace(".sum", "") + ".sum.xml"; string content = OutputProcessor.DataContractSerializeToXML <SQLProductSum>(sumFromSetupSrc); File.WriteAllText(file, content); } catch (Exception ex) { Output(ex.Message); Logger.LogError(ex.Message); } }
string setPostDate(Order order) { string UserId = merchantID; //用户编号 必选 String 是 string UserOrderId = order.OrderInsideID; //用户订单号 必选 String 是 string ChargeAccount = order.TargetAccount; //充值账号 必选 String 是 string BuyNum = order.BuyAmount.ToString(); //购买数量 必选 Int 是 string GoodsId = SQLProduct.getChargeClassProductCode(order.ProductID, order.MerchantCode); //商品Id 必选 Int 是 string GameArea = System.Web.HttpUtility.UrlEncode(order.AreaName, Encoding.UTF8); //游戏区 选填 String 否 游戏区服信息-游戏大区 string GameServer = System.Web.HttpUtility.UrlEncode(order.ServerName, Encoding.UTF8); //游戏服 选填 String 否 游戏区服信息-游戏服务器名称 string PassCheck = ""; //游戏通行证 选填 String 否 针对某些有些需要传入通行证账号信息 string Sign = ""; //签名字符串 必选 String 否 加密后的字符串 string md5str = "buynum" + BuyNum + "chargeaccount" + ChargeAccount + "goodsid" + GoodsId + "userid" + UserId + "userorderid" + UserOrderId + "key" + key; WriteLog.Write("方法:setPostDate,订单号:" + order.OrderInsideID + " Xinqidian 机密参数:" + md5str.ToString(), LogPathFile.Recharge.ToString()); Sign = Md5Helper.GetMD5String_Default(md5str); StringBuilder str = new StringBuilder(); str.AppendFormat("UserId={0}", UserId); str.AppendFormat("&UserOrderId={0}", UserOrderId); str.AppendFormat("&ChargeAccount={0}", ChargeAccount); str.AppendFormat("&BuyNum={0}", BuyNum); str.AppendFormat("&GoodsId={0}", GoodsId); str.AppendFormat("&GameArea={0}", GameArea); str.AppendFormat("&GameServer={0}", GameServer); str.AppendFormat("&PassCheck={0}", PassCheck); str.AppendFormat("&Sign={0}", Sign); return(str.ToString()); }
string setPostDate(Order order) { string username = merchantID; //接入代理用户名 string type = SQLProduct.getChargeClassProductCode(order.ProductID, order.MerchantCode); // 具体请参表4 《type匹配表》 string buynum = order.BuyAmount.ToString(); // 购买数量 string sporderid = order.OrderInsideID; // SP订单号,商户平台的订单号,最长32位(yyyyMMddHHmmss+8) string gameuser = ""; // 游戏内分账号(如:WOW1)(如无传空,但是必须传) string buyhaoma = order.TargetAccount; // 要进行充值的号码或通行证号码 string clientip = order.CustomerIp; // 玩家所在IP,必须真实的区域IP地址 string returl = "http://116.62.44.48/NotifyFromXunTong.aspx"; // 回调地址,订单充值成功后返回的URL地址 string sign = ""; // MD5组合数字签名方式:MD5(username={}&type={}&sporderid={}&buynum={}&buyhaoma={}&key=APIkey) 加密MD5输出为32位小写 “{}”为占位符 string md5str = "username="******"&type=" + type + "&sporderid=" + sporderid + "&buynum=" + buynum + "&buyhaoma=" + buyhaoma + "&key=" + key; sign = Md5Helper.MD5Encrypt(md5str); if (isChinese(buyhaoma)) { buyhaoma = System.Web.HttpUtility.UrlEncode(buyhaoma, Encoding.UTF8); } StringBuilder str = new StringBuilder(); str.AppendFormat("username={0}", username); str.AppendFormat("&type={0}", type); str.AppendFormat("&buynum={0}", buynum); str.AppendFormat("&sporderid={0}", sporderid); str.AppendFormat("&gameuser={0}", gameuser); str.AppendFormat("&buyhaoma={0}", buyhaoma); str.AppendFormat("&clientip={0}", clientip); str.AppendFormat("&returl={0}", System.Web.HttpUtility.UrlEncode(returl, Encoding.UTF8)); str.AppendFormat("&sign={0}", sign); return(str.ToString()); }
/// <summary> /// 是否属于等待充值的商品 /// </summary> /// <param name="order"></param> /// <returns></returns> static bool BelongPoProduct(Order order) { try { List <Product> productLst = SQLProduct.GetProducts(p => p.MerchantCode == MerchantCodeType.SUP); if (productLst == null || productLst.Count == 0) { return(false); } foreach (Product item in productLst) { if (order != null && order.ProductID != null) { var result = productLst.Count(p => p.ProductCode == order.ProductID && p.IsActive); if (result != null && result > 0) { return(true); } } } return(false); } catch (Exception ex) { WriteLog.Write("方法:BelongPoProduct_Sup异常,信息:" + ex.Message + ex.StackTrace, LogPathFile.Exception); throw; } }
Order payOrder(object obj) { Order order = (Order)obj; List <Product> productLst = SQLProduct.GetProducts(p => p.MerchantCode == order.MerchantCode); if (productLst == null || productLst.Count == 0) { WriteLog.Write("payOrder: productLst is null, 订单号:" + order.OrderInsideID, LogPathFile.Recharge.ToString()); return(order); } List <ChargeClass> chargeClassLst = SQLChargeClass.GetChargeClasss(p => p.ChargeClassID > 0); if (chargeClassLst == null || chargeClassLst.Count == 0) { WriteLog.Write("payOrder: chargeClassLst is null, 订单号:" + order.OrderInsideID, LogPathFile.Recharge.ToString()); return(order); } foreach (Product item in productLst) { if (order.ProductID.Equals(item.ProductCode) && item.IsActive) { var result = chargeClassLst.SingleOrDefault(p => p.ChargeClassID == item.ChargeClassID); order = (Order)ReflectChargeClasss(order, result.ChargeClassName); break; } } return(order); }
List <string> GetNotifyProduct() { List <Product> productLst = SQLProduct.GetProducts(p => p.ProductID > 0); List <ChargeClass> chargeClassLst = SQLChargeClass.GetChargeClasss(p => p.ChargeClassID > 0); List <string> productIDList = new List <string>(); foreach (Control c in this.pannelCheckbox.Controls) { if (c is CheckBox && (c as CheckBox).Checked) { string checkTxt = (c as CheckBox).Text; foreach (ChargeClass chargeClass in chargeClassLst) { if (checkTxt.Equals(chargeClass.Descrtion)) { foreach (Product product in productLst) { if (product.ChargeClassID.Equals(chargeClass.ChargeClassID)) { productIDList.Add(product.ProductCode); } } } } } } return(productIDList); }
string setPostDate(Order order) { string oid = order.OrderInsideID; // 商家订单ID 必选 String 是 商家自己生成的平台ID,注意参数为小写 string cid = merchantID; // 商家ID 必选 String 是 商家注册的时候产生的一个商家ID string pid = SQLProduct.getChargeClassProductCode(order.ProductID, order.MerchantCode); // 商品ID 必选 String 是 商品ID请在对接的时候向对接技术索要 string pn = System.Web.HttpUtility.UrlEncode(order.TargetAccount, Encoding.UTF8); // 充值号码 必选 String 是 您所需要充值的帐号信息 string nb = order.BuyAmount.ToString(); // 商品数量 必选 String 是 您所需要充值帐号的充值数量个数 string fm = (order.ProductParValue * order.BuyAmount).ToString(); // 充值金额 必选 String 是 充值金额=商品面值*商品数量 string ru = System.Web.HttpUtility.UrlEncode("http://116.62.44.48/NotifyFromRuiLian.aspx", Encoding.UTF8); // 通知地址 必选 String 是 帐号充值结果所反馈到的地址 string at = System.Web.HttpUtility.UrlEncode(order.TargetAccountType, Encoding.UTF8); // 帐号类型 可选 String 否 辅助参数,与指定的商品有关 string ct = System.Web.HttpUtility.UrlEncode(order.RechargeModeName, Encoding.UTF8); // 计费类型 可选 String 否 辅助参数,与指定的商品有关 string fr = ""; // 充值区域 可选 String 否 辅助参数,与指定的商品有(格式:区域编号|区域名称) string fs = ""; // 充值服务器 可选 String 否 辅助参数,与指定的商品有(格式:服务器编号|服务器名称) string rin = ""; // 商家区域 可选 String 否 辅助参数,商家所在区域 string pip = order.CustomerIp; // 充值帐号IP 可选 String 否 辅助参数,充值帐号IP地址 string info1 = ""; // 商家自定义 可选 String 否 可选参数,商家自定义参数,原样返回 string info2 = ""; // 商家自定义 可选 String 否 可选参数,商家自定义参数,原样返回 string sign = ""; // MD5签名 必选 String 否 原串拼接规则:oid-cid-pid-pn-nb-fm-ru-key 例:101447975-test-10097-123456-1-1-backcallurl-test string md5str = oid + "-" + cid + "-" + pid + "-" + pn + "-" + nb + "-" + fm + "-" + ru + "-" + key; sign = Md5Helper.MD5Encrypt(md5str); if (!string.IsNullOrEmpty(order.AreaName)) { //string Area = new ChargeInterface.MBJ.PayAndQueryMBJ().getAreaValue(order.AreaName, pid, AreaValueType.ShuWang);//游戏区域 fr = System.Web.HttpUtility.UrlEncode(order.Area + "|" + order.AreaName, Encoding.UTF8); } if (!string.IsNullOrEmpty(order.Server)) { string Area = new ChargeInterface.MBJ.PayAndQueryMBJ().getAreaValue(order.AreaName, pid, AreaValueType.ShuWang);//游戏区域 fs = System.Web.HttpUtility.UrlEncode(order.Server + "|" + order.ServerName, Encoding.UTF8); } StringBuilder str = new StringBuilder(); str.AppendFormat("oid={0}", oid); str.AppendFormat("&cid={0}", cid); str.AppendFormat("&pid={0}", pid); str.AppendFormat("&pn={0}", pn); str.AppendFormat("&nb={0}", nb); str.AppendFormat("&fm={0}", fm); str.AppendFormat("&ru={0}", ru); str.AppendFormat("&at={0}", at); str.AppendFormat("&ct={0}", ct); str.AppendFormat("&fr={0}", fr); str.AppendFormat("&fs={0}", fs); str.AppendFormat("&rin={0}", rin); str.AppendFormat("&pip={0}", pip); str.AppendFormat("&info1={0}", info1); str.AppendFormat("&info2={0}", info2); str.AppendFormat("&sign={0}", sign); return(str.ToString()); }
public string setPostDate(Order order, string responseUrl, string iD) { string MerchantID = merchantID; //商家编号 Y string MerchantOrderID = order.OrderInsideID; //商家订单编号(不允许重复) Y string ProductID = SQLProduct.getChargeClassProductCode(order.ProductID, order.MerchantCode); //商品编号 Y string BuyAmount = order.BuyAmount.ToString(); //充值数量 Y string TargetAccount = System.Web.HttpUtility.UrlEncode(order.TargetAccount, Encoding.UTF8); //充值账户 N string TargetAccountType = System.Web.HttpUtility.UrlEncode(order.TargetAccountType, Encoding.UTF8); //充值账户类型 N string TargetAccountTypeName = System.Web.HttpUtility.UrlEncode(order.TargetAccountTypeName, Encoding.UTF8); //充值账户类型名称 N string RechargeMode = System.Web.HttpUtility.UrlEncode(order.RechargeMode, Encoding.UTF8); //充值方式 N string RechargeModeName = System.Web.HttpUtility.UrlEncode(order.RechargeModeName, Encoding.UTF8); //充值方式名称 N string Game = System.Web.HttpUtility.UrlEncode(order.Game, Encoding.UTF8); //充值游戏 N string GameName = System.Web.HttpUtility.UrlEncode(order.GameName, Encoding.UTF8); //充值游戏名称 N string Area = getAreaValue(order.AreaName, ProductID, iD); //游戏区域 N string AreaName = System.Web.HttpUtility.UrlEncode(order.AreaName, Encoding.UTF8); //游戏区域名称 N string Server = System.Web.HttpUtility.UrlEncode(order.Server, Encoding.UTF8); //游戏服务器 N string ServerName = System.Web.HttpUtility.UrlEncode(order.ServerName, Encoding.UTF8); //游戏服务器名称 N string CustomerIP = order.CustomerIp; //客户IP/客户区域,用来确定消费区域,只需传一个即可。如果都传以IP为准,如果都不传则默认区域为全国。 N string CustomerRegion = System.Web.HttpUtility.UrlEncode(order.CustomerRegion, Encoding.UTF8); string ResponseUrl = System.Web.HttpUtility.UrlEncode(responseUrl, Encoding.UTF8); //接收异步通知订单状态的Url N string Sign = string.Empty; //数字签名 Y string MD5Str = MerchantID + MerchantOrderID + ProductID + BuyAmount + TargetAccount + key; Sign = Md5Helper.MD5Encrypt(MD5Str); StringBuilder str = new StringBuilder(); str.AppendFormat("MerchantID={0}", MerchantID); str.AppendFormat("&MerchantOrderID={0}", MerchantOrderID); str.AppendFormat("&ProductID={0}", ProductID); str.AppendFormat("&BuyAmount={0}", BuyAmount); str.AppendFormat("&TargetAccount={0}", TargetAccount); str.AppendFormat("&TargetAccountType={0}", TargetAccountType); str.AppendFormat("&TargetAccountTypeName={0}", TargetAccountTypeName); str.AppendFormat("&RechargeMode={0}", RechargeMode); str.AppendFormat("&RechargeModeName={0}", RechargeModeName); str.AppendFormat("&Game={0}", Game); str.AppendFormat("&GameName={0}", GameName); str.AppendFormat("&Area={0}", Area); str.AppendFormat("&AreaName={0}", AreaName); str.AppendFormat("&Server={0}", Server); str.AppendFormat("&ServerName={0}", ServerName); str.AppendFormat("&CustomerIP={0}", CustomerIP); str.AppendFormat("&CustomerRegion={0}", CustomerRegion); str.AppendFormat("&ResponseUrl={0}", ResponseUrl); str.AppendFormat("&Sign={0}", Sign); // 签名 return(str.ToString()); }
string setPostDate(Order order) { string businessId = merchantID; //商户号 由SUP系统分配每个商户唯一的一个商户号 string userOrderId = order.OrderInsideID; // 商户订单号(流水号) 由商户自定义,最大长度不超过32位的唯一流水号 string goodsId = SQLProduct.getChargeClassProductCode(order.ProductID, order.MerchantCode); // 用户商品编号 SUP系统商品编号,由运营人员告知 string userName = System.Web.HttpUtility.UrlEncode(order.TargetAccount, Encoding.UTF8); // 充值用户名 一般是通行证账号或QQ号 string gameName = ""; // 游戏名称 用户充值游戏名称。见游戏名称规则。例:QQ传“Q币”,话费传“话费” string gameAcct = ""; // 游戏账号 如果充值需要填,则要传值。例如充值魔兽世界 除通行证账号外还要传游戏账号,见游戏账号规则 string gameArea = ""; // 游戏区 如果充值需要填,则要传值。见游戏区服规则 string gameType = ""; // 充值类型 见充值类型规则 string acctType = ""; // 账号类型 见账号类型规则。例:QQ传“QQ号”,话费传“手机号” string goodsNum = order.BuyAmount.ToString(); // 充值数量 整数,充值总数量,单位是元 string gameSrv = ""; // 游戏服 如果充值需要填,则要传值。见游戏区服规则 string orderIp = order.CustomerIp; // 充值ip 真实玩家充值请求ip string noticeUrl = System.Web.HttpUtility.UrlEncode("http://116.62.44.48/NotifyFromPanSuo.aspx", Encoding.UTF8); // 异步通知地址 该url地址不能带任何参数 string sign = ""; // 签名 md5 32位小写,做参数验证用 md5(businessId + userOrderId+ goodsId + goodsNum + orderIp + key) string md5str = businessId + userOrderId + goodsId + goodsNum + orderIp + key; sign = Md5Helper.MD5Encrypt(md5str); StringBuilder str = new StringBuilder(); str.AppendFormat("businessId={0}", businessId); str.AppendFormat("&userOrderId={0}", userOrderId); str.AppendFormat("&goodsId={0}", goodsId); str.AppendFormat("&userName={0}", userName); str.AppendFormat("&gameName={0}", gameName); str.AppendFormat("&gameAcct={0}", gameAcct); str.AppendFormat("&gameArea={0}", gameArea); str.AppendFormat("&gameType={0}", gameType); str.AppendFormat("&acctType={0}", acctType); str.AppendFormat("&goodsNum={0}", goodsNum); str.AppendFormat("&gameSrv={0}", gameSrv); str.AppendFormat("&orderIp={0}", orderIp); str.AppendFormat("¬iceUrl={0}", noticeUrl); str.AppendFormat("&sign={0}", sign); return(str.ToString()); }
/// <summary> /// 是否属于等待充值的商品 /// </summary> /// <param name="order"></param> /// <returns></returns> static bool BelongPoProduct(Order order) { try { List <Product> productLst = SQLProduct.GetProducts(p => p.MerchantCode == MerchantCodeType.SW); if (productLst == null || productLst.Count == 0) { return(false); } foreach (Product item in productLst) { if (order != null && order.ProductID != null) { var result = productLst.Count(p => p.ProductCode == order.ProductID && p.IsActive); if (result != null && result > 0) { return(true); } } } return(false); //if (order != null && order.ProductID != null) //{ // if (order.ProductID.Equals("70623") || order.ProductID.Equals("70893") || order.ProductID.Equals("70927") || order.ProductID.Equals("71014") // || order.ProductID.Equals("71015") || order.ProductID.Equals("71016") || order.ProductID.Equals("71017") || order.ProductID.Equals("71018")) // return true; // if (order.ProductID.Equals("70948")) // return true; // if (order.ProductID.Equals("70949") || order.ProductID.Equals("70950") || order.ProductID.Equals("70951") || order.ProductID.Equals("70952") // || order.ProductID.Equals("70953") || order.ProductID.Equals("70954") || order.ProductID.Equals("71324") || order.ProductID.Equals("72161")) // return true; // if (order.ProductID.Equals("71195") || order.ProductID.Equals("70921")) // return true; //} //return false; } catch (Exception ex) { WriteLog.Write("方法:BelongPoProduct异常,信息:" + ex.Message + ex.StackTrace, LogPathFile.Exception); throw; } }
public async Task <SQLProduct> UpdateProduct(SQLProduct product, int id) { return(await _sqlunitOfWork.SQLProductRepository.Update(product, id)); //await Complete(); }
public async Task <SQLProduct> AddProduct(SQLProduct product) { return(await _sqlunitOfWork.SQLProductRepository.Add(product)); }
public string setPostDate(Order order, string responseUrl, string iD) { string MerchantID = merchantID; //商家编号 Y string MerchantOrderID = order.OrderInsideID; //商家订单编号(不允许重复) Y string ProductID = SQLProduct.getChargeClassProductCode(order.ProductID, order.MerchantCode); //商品编号 Y string BuyAmount = order.BuyAmount.ToString(); //充值数量 Y string TargetAccount = order.TargetAccount; //充值账户 N string TargetAccountType = System.Web.HttpUtility.UrlEncode(order.TargetAccountType, Encoding.UTF8); //充值账户类型 N string TargetAccountTypeName = System.Web.HttpUtility.UrlEncode(order.TargetAccountTypeName, Encoding.UTF8); //充值账户类型名称 N string RechargeMode = System.Web.HttpUtility.UrlEncode(order.RechargeMode, Encoding.UTF8); //充值方式 N string RechargeModeName = System.Web.HttpUtility.UrlEncode(order.RechargeModeName, Encoding.UTF8); //充值方式名称 N string Game = System.Web.HttpUtility.UrlEncode(order.Game, Encoding.UTF8); //充值游戏 N string GameName = System.Web.HttpUtility.UrlEncode(order.GameName, Encoding.UTF8); //充值游戏名称 N string Area = getAreaValue(order.AreaName, ProductID, iD); //游戏区域 N string AreaName = System.Web.HttpUtility.UrlEncode(order.AreaName, Encoding.UTF8); //游戏区域名称 N string Server = System.Web.HttpUtility.UrlEncode(order.Server, Encoding.UTF8); //游戏服务器 N string ServerName = System.Web.HttpUtility.UrlEncode(order.ServerName, Encoding.UTF8); //游戏服务器名称 N string CustomerIP = order.CustomerIp; //客户IP/客户区域,用来确定消费区域,只需传一个即可。如果都传以IP为准,如果都不传则默认区域为全国。 N string CustomerRegion = System.Web.HttpUtility.UrlEncode(order.CustomerRegion, Encoding.UTF8); string ResponseUrl = System.Web.HttpUtility.UrlEncode(responseUrl, Encoding.UTF8); //接收异步通知订单状态的Url N string Sign = string.Empty; //数字签名 Y string TargetAccount_Sign = order.TargetAccount; if (new ChargeInterface.SW.PayAndQuerySW().isChinese(TargetAccount)) { TargetAccount = System.Web.HttpUtility.UrlEncode(order.TargetAccount, Encoding.UTF8); } Game = new ChargeInterface.SW.PayAndQuerySW().getGameValue(order.GameName);//充值游戏 if (order.GameName.Contains("魔域") || order.GameName.Contains("魔域掉钱版") || order.GameName.Contains("魔域口袋版") || order.GameName.Contains("机战") || order.GameName.Contains("征服")) { new ChargeInterface.SW.PayAndQuerySW().getmoyuAreaAndServer(order.GameName, order.AreaName, order.ServerName, ref Area, ref Server); switch (order.RechargeModeName) { case "魔石卡": RechargeMode = "1021101902000000001"; break; case "神石卡": RechargeMode = "1021372029000000001"; break; case "太阳石卡": RechargeMode = "1021111902000000001"; break; default: RechargeMode = ""; break; } } else { Area = new ChargeInterface.MBJ.PayAndQueryMBJ().getAreaValue(order.AreaName, ProductID, AreaValueType.ShuWang); Server = System.Web.HttpUtility.UrlEncode(order.Server, Encoding.UTF8); } string MD5Str = MerchantID + MerchantOrderID + ProductID + BuyAmount + TargetAccount_Sign + key; Sign = Md5Helper.MD5Encrypt(MD5Str); StringBuilder str = new StringBuilder(); str.AppendFormat("MerchantID={0}", MerchantID); str.AppendFormat("&MerchantOrderID={0}", MerchantOrderID); str.AppendFormat("&ProductID={0}", ProductID); str.AppendFormat("&BuyAmount={0}", BuyAmount); str.AppendFormat("&TargetAccount={0}", TargetAccount); str.AppendFormat("&TargetAccountType={0}", TargetAccountType); str.AppendFormat("&TargetAccountTypeName={0}", TargetAccountTypeName); str.AppendFormat("&RechargeMode={0}", RechargeMode); str.AppendFormat("&RechargeModeName={0}", RechargeModeName); str.AppendFormat("&Game={0}", Game); str.AppendFormat("&GameName={0}", GameName); str.AppendFormat("&Area={0}", Area); str.AppendFormat("&AreaName={0}", AreaName); str.AppendFormat("&Server={0}", Server); str.AppendFormat("&ServerName={0}", ServerName); str.AppendFormat("&CustomerIP={0}", CustomerIP); str.AppendFormat("&CustomerRegion={0}", CustomerRegion); str.AppendFormat("&ResponseUrl={0}", ResponseUrl); str.AppendFormat("&Sign={0}", Sign); // 签名 return(str.ToString()); }
string setPostDate(Order order) { string MerchantID = merchantID; //商家编号 string MerchantOrderID = order.OrderInsideID; //商家订单编号(不允许重复) string ProductID = SQLProduct.getChargeClassProductCode(order.ProductID, order.MerchantCode); //商品编号 string BuyAmount = order.BuyAmount.ToString();; //充值数量 string TargetAccount = string.Empty; //充值账户 string TargetAccount_Sign = string.Empty; if (order.GameName.Contains("新水浒Q传")) { if (order.TargetAccount.Contains("手机号码")) { TargetAccount = order.TargetAccount.Replace("手机号码", ""); } else if (order.TargetAccount.Contains("其他邮箱【请填写完整账户】")) { TargetAccount = order.TargetAccount.Replace("其他邮箱【请填写完整账户】", ""); } else if (order.TargetAccount.Contains("无")) { TargetAccount = order.TargetAccount.Replace("无", ""); } } else if (order.GameName.Contains("魔兽世界")) { TargetAccount = order.TargetAccount.Replace("+", ";"); } if (string.IsNullOrEmpty(TargetAccount)) { TargetAccount = order.TargetAccount; } TargetAccount_Sign = TargetAccount; if (isChinese(TargetAccount)) { TargetAccount = System.Web.HttpUtility.UrlEncode(order.TargetAccount, Encoding.UTF8); } string TargetAccountType = System.Web.HttpUtility.UrlEncode(order.TargetAccountType, Encoding.UTF8); //充值账户类型 string TargetAccountTypeName = System.Web.HttpUtility.UrlEncode(order.TargetAccountTypeName, Encoding.UTF8); //充值账户类型名称 string RechargeMode = string.Empty; //充值方式 if (order.RechargeModeName.Contains("帐号直充")) { RechargeMode = "1"; } else if (order.RechargeModeName.Contains("点数寄售")) { RechargeMode = "2"; } else if (order.RechargeModeName.Contains("魔兽世界游戏时间")) { RechargeMode = "WOW_TIME"; } if (order.GameName.Contains("春秋Q传") || order.GameName.Contains("剑网3") || order.GameName.Contains("反恐行动") || order.GameName.Contains("剑侠世界")) { if (order.RechargeModeName.Contains("金币")) { RechargeMode = "5"; } else if (order.RechargeModeName.Contains("通宝")) { RechargeMode = "6"; } else if (order.RechargeModeName.Contains("月卡")) { RechargeMode = "1"; } else if (order.RechargeModeName.Contains("点卡")) { RechargeMode = "2"; } } string RechargeModeName = string.Empty; //充值方式名称 if (order.RechargeModeName.Contains("起凡一卡通")) { RechargeModeName = string.Empty; } else { RechargeModeName = System.Web.HttpUtility.UrlEncode(order.RechargeModeName, Encoding.UTF8); } string Game = getGameValue(order.GameName); //充值游戏 string GameName = string.Empty; //充值游戏名称 GameName = System.Web.HttpUtility.UrlEncode(order.GameName, Encoding.UTF8); string Area = ""; //游戏区域 string AreaName = System.Web.HttpUtility.UrlEncode(order.AreaName, Encoding.UTF8); //游戏区域名称 string Server = ""; //游戏服务器 string ServerName = System.Web.HttpUtility.UrlEncode(order.ServerName, Encoding.UTF8); //游戏服务器名称 if (order.GameName.Contains("魔域") || order.GameName.Contains("魔域掉钱版") || order.GameName.Contains("魔域口袋版") || order.GameName.Contains("机战") || order.GameName.Contains("征服")) { getmoyuAreaAndServer(order.GameName, order.AreaName, order.ServerName, ref Area, ref Server); switch (order.RechargeModeName) { case "魔石卡": RechargeMode = "1021101902000000001"; break; case "神石卡": RechargeMode = "1021372029000000001"; break; case "太阳石卡": RechargeMode = "1021111902000000001"; break; default: RechargeMode = ""; break; } } else { Area = new ChargeInterface.MBJ.PayAndQueryMBJ().getAreaValue(order.AreaName, ProductID, AreaValueType.ShuShan); Server = System.Web.HttpUtility.UrlEncode(order.Server, Encoding.UTF8); } string CustomerIP = order.CustomerIp; //客户IP/客户区域,用来确定消费区域,只需传一个即可。如果都传以IP为准,如果都不传则默认区域为全国。 string CustomerRegion = ""; string ResponseUrl = System.Web.HttpUtility.UrlEncode("http://116.62.44.48/NotifyFromShuShan.aspx", Encoding.UTF8);; //接收异步通知订单状态的Url string Sign = ""; //数字签名数字签名 if (string.IsNullOrEmpty(TargetAccount_Sign)) { TargetAccount_Sign = order.TargetAccount; } string md5str = MerchantID + MerchantOrderID + ProductID + BuyAmount + TargetAccount_Sign + key; Sign = Md5Helper.MD5Encrypt(md5str); StringBuilder str = new StringBuilder(); str.AppendFormat("MerchantID={0}", MerchantID); str.AppendFormat("&MerchantOrderID={0}", MerchantOrderID); str.AppendFormat("&ProductID={0}", ProductID); str.AppendFormat("&BuyAmount={0}", BuyAmount); str.AppendFormat("&TargetAccount={0}", TargetAccount); str.AppendFormat("&TargetAccountType={0}", TargetAccountType == null ? "" : TargetAccountType); str.AppendFormat("&TargetAccountTypeName={0}", TargetAccountTypeName == null ? "" : TargetAccountTypeName); str.AppendFormat("&RechargeMode={0}", RechargeMode == null ? "" : RechargeMode); str.AppendFormat("&RechargeModeName={0}", RechargeModeName == null ? "" : RechargeModeName); str.AppendFormat("&Game={0}", Game == null ? "" : Game); str.AppendFormat("&GameName={0}", GameName == null ? "" : GameName); str.AppendFormat("&Area={0}", Area == null ? "" : Area); str.AppendFormat("&AreaName={0}", AreaName == null ? "" : AreaName); str.AppendFormat("&Server={0}", Server == null ? "" : Server); str.AppendFormat("&ServerName={0}", ServerName == null ? "" : ServerName); str.AppendFormat("&CustomerIP={0}", CustomerIP == null ? "" : CustomerIP); str.AppendFormat("&CustomerRegion={0}", CustomerRegion == null ? "" : CustomerRegion); str.AppendFormat("&ResponseUrl={0}", ResponseUrl); str.AppendFormat("&Sign={0}", Sign); return(str.ToString()); }
string setPostDate(Order order) { string CustomerId = merchantID; //int 是 云接口商户编号 string CustomerOrderNo = order.OrderInsideID; //string 是 客户外部系统订单号 string ProductId = SQLProduct.getChargeClassProductCode(order.ProductID, order.MerchantCode); //int 是 要充值的商品编号 string BuyNum = order.BuyAmount.ToString();; //int 是 购买数量 string ChargeAccount = System.Web.HttpUtility.UrlEncode(order.TargetAccount, Encoding.UTF8); //string 是 要充值的游戏账号/手机号/电话/QQ号等 string ChargePassword = ""; //string 否 要充值的账号的密码,部分游戏需要。 string ChargeGame = string.Empty; //string 否 要充值的游戏名称,部分游戏需要 string ChargeRegion = string.Empty; //string 否 要充值的游戏区,部分游戏需要 string ChargeType = string.Empty; //string 否 要充值的游戏类型,部分游戏需要 if (order.ProductID.Equals("14913")) { ChargeGame = System.Web.HttpUtility.UrlEncode("Q币", Encoding.UTF8); } else { ChargeGame = System.Web.HttpUtility.UrlEncode(order.GameName, Encoding.UTF8); } if (order.GameName.Contains("懒人听书-备用")) { ChargeGame = System.Web.HttpUtility.UrlEncode("懒人听书", Encoding.UTF8); if (order.AreaName.Contains("IOS充值")) { ChargeRegion = System.Web.HttpUtility.UrlEncode("苹果端", Encoding.UTF8); } if (order.AreaName.Contains("安卓充值")) { ChargeRegion = System.Web.HttpUtility.UrlEncode("安卓端", Encoding.UTF8); } } else { ChargeRegion = System.Web.HttpUtility.UrlEncode(order.AreaName, Encoding.UTF8); } if (order.ProductID.Equals("14961")) { //网易一卡通按元充值-k2 if (order.RechargeModeName.Contains("点数寄售")) { ChargeType = System.Web.HttpUtility.UrlEncode("点卡交易", Encoding.UTF8); } if (order.RechargeModeName.Contains("帐号直充")) { ChargeType = System.Web.HttpUtility.UrlEncode("游戏点数", Encoding.UTF8); } } else { ChargeType = System.Web.HttpUtility.UrlEncode(order.RechargeModeName, Encoding.UTF8); } if (order.ProductID.Equals("14913")) { ChargeType = ""; } string ChargeServer = System.Web.HttpUtility.UrlEncode(order.Server, Encoding.UTF8); //string 否 要充值的游戏服务器,部分游戏需要 string NotifyUrl = System.Web.HttpUtility.UrlEncode("http://116.62.44.48/NotifyFromKamen.aspx", Encoding.UTF8); //string 否 第三方异步接收地址,用于接收订单成功/失败的状态 string BuyerIp = System.Web.HttpUtility.UrlEncode(order.CustomerIp, Encoding.UTF8); //string 否 购买者IP string RoleName = ""; //string 否 要充值游戏的角色名称,部分游戏需要 string RemainingNumber = ""; //string 否 要充值游戏的剩余数量,部分游戏需要 string ContactType = ""; //string 否 要充值游戏的联系电话,部分游戏需要 string ContactQQ = ""; //string 否 要充值游戏的联系QQ,部分游戏需要 string Sign = ""; //string 是 签名 StringBuilder str = new StringBuilder(); str.AppendFormat("CustomerId={0}", CustomerId); str.AppendFormat("&CustomerOrderNo={0}", CustomerOrderNo); str.AppendFormat("&ProductId={0}", ProductId); str.AppendFormat("&BuyNum={0}", BuyNum); str.AppendFormat("&ChargeAccount={0}", ChargeAccount); if (!string.IsNullOrEmpty(ChargePassword)) { str.AppendFormat("&ChargePassword={0}", ChargePassword); } if (!string.IsNullOrEmpty(ChargeGame)) { str.AppendFormat("&ChargeGame={0}", ChargeGame); } if (!string.IsNullOrEmpty(ChargeRegion)) { str.AppendFormat("&ChargeRegion={0}", ChargeRegion); } if (!string.IsNullOrEmpty(ChargeServer)) { str.AppendFormat("&ChargeServer={0}", ChargeServer); } if (!string.IsNullOrEmpty(ChargeType)) { str.AppendFormat("&ChargeType={0}", ChargeType); } if (!string.IsNullOrEmpty(NotifyUrl)) { str.AppendFormat("&NotifyUrl={0}", NotifyUrl); } if (!string.IsNullOrEmpty(BuyerIp)) { str.AppendFormat("&BuyerIp={0}", BuyerIp); } if (!string.IsNullOrEmpty(RoleName)) { str.AppendFormat("&RoleName={0}", RoleName); } if (!string.IsNullOrEmpty(RemainingNumber)) { str.AppendFormat("&RemainingNumber={0}", RemainingNumber); } if (!string.IsNullOrEmpty(ContactType)) { str.AppendFormat("&ContactType={0}", ContactType); } if (!string.IsNullOrEmpty(ContactQQ)) { str.AppendFormat("&ContactQQ={0}", ContactQQ); } string md5str = str.ToString().Replace("&", "") + key; Sign = Md5Helper.EncryptMd5_Kamen(md5str); str.AppendFormat("&Sign={0}", Sign); // 签名 return(str.ToString()); }
public async Task Post([FromBody] SQLProduct product) { await _sqlProductService.AddProduct(product); }
string setPostDate(Order order) { //公共请求参数 string app_key = appkey; // String 是 32 i4esv1l+76l/7NQCL3QudG90Fq+YgVfFGJAWgT+7qO1Bm9o/adG/1iwO2qXsAXNB 开放平台分配给商户的app_key string method = "fulu.order.direct.add"; // String 是 128 fulu.order.direct.add 接口方法名称 string timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); // string 是 192 2014-07-24 03:07:50 时间戳,格式为:yyyy-MM-dd HH:mm:ss string version = "2.0"; // string 是 3 2.0 调用的接口版本 string format = "json"; // String 是 10 json 接口请求或响应格式 string charset = "utf-8"; // String 是 10 utf-8 请求使用的编码格式,如utf-8等 string sign_type = "md5"; // String 是 10 md5 签名加密类型,目前仅支持md5 string sign = ""; // String 是 344 详见示例 签名串,签名规则详见右侧《常见问题》中的“ 3.签名计算规则说明 ” string app_auth_token = ""; // String 是 40 授权码,固定值为“” string biz_content = ""; // string 是 {"remaining_number":"","charge_type":"Q币","customer_order_no":"201906281030191013526","product_id":"10000001","charge_password":"","charge_ip":"192.168.1.100","charge_game_name":"三国群英传","charge_game_srv":"逐鹿中原","contact_qq":"","charge_account":"888888","buy_num":"1","contact_tel":"","charge_game_region":"电信一区","charge_game_role":"赵云"} #region 请求参数 string remaining_number = ""; // int 否 20 剩余数量 string charge_type = ""; // string 否 20 Q币 充值类型 string customer_order_no = order.OrderInsideID; // string 是 50 201906281030191013526 外部订单号 string product_id = SQLProduct.getChargeClassProductCode(order.ProductID, order.MerchantCode); // int 是 20 10000001 商品编号 string charge_password = ""; // string 否 50 充值密码,部分游戏类要传 string charge_ip = order.CustomerIp; // string 否 20 192.168.1.100 下单真实Ip,区域商品要传 string charge_game_name = order.GameName; // string 否 50 三国群英传 充值游戏名称 //string charge_game_name = ""; //string charge_game_srv = order.ServerName;// string 否 50 逐鹿中原 充值游戏服 string charge_game_srv = ""; string contact_qq = ""; // string 否 50 联系QQ string charge_account = order.TargetAccount; // string 是 50 888888 充值账号 string buy_num = order.BuyAmount.ToString(); // int 是 10 1 购买数量 string contact_tel = ""; // string 否 15 联系电话 //string charge_game_region = order.AreaName;// string 否 50 电信一区 充值游戏区 string charge_game_region = ""; string charge_game_role = "";// string 否 50 赵云 充值游戏角色 if (order.GameName.Contains("懒人听书")) { if (order.AreaName.Contains("IOS充值")) { charge_game_region = "苹果端"; } if (order.AreaName.Contains("安卓充值")) { charge_game_region = "安卓端"; } } else { charge_game_region = order.AreaName; } Dictionary <string, string> dic = new Dictionary <string, string> (); //{"remaining_number":"","charge_type":"Q币","customer_order_no":"201906281030191013526","product_id":"10000001","charge_password":"", // "charge_ip":"192.168.1.100","charge_game_name":"三国群英传","charge_game_srv":"逐鹿中原","contact_qq":"","charge_account":"888888" // "buy_num":"1","contact_tel":"","charge_game_region":"电信一区","charge_game_role":"赵云"} dic.Add("remaining_number", remaining_number); dic.Add("charge_type", charge_type); dic.Add("customer_order_no", customer_order_no); dic.Add("product_id", product_id); dic.Add("charge_password", charge_password); dic.Add("charge_ip", charge_ip); dic.Add("charge_game_name", charge_game_name); dic.Add("charge_game_srv", charge_game_srv); dic.Add("contact_qq", contact_qq); dic.Add("charge_account", charge_account); dic.Add("buy_num", buy_num); dic.Add("contact_tel", contact_tel); dic.Add("charge_game_region", charge_game_region); dic.Add("charge_game_role", charge_game_role); biz_content = JavaScriptConvert.SerializeObject(dic); #endregion #region MD5加密 Dictionary <string, string> dictionary = new Dictionary <string, string>(); dictionary.Add("app_key", app_key); dictionary.Add("method", method); dictionary.Add("timestamp", timestamp); dictionary.Add("version", version); dictionary.Add("format", format); dictionary.Add("charset", charset); dictionary.Add("sign_type", sign_type); dictionary.Add("app_auth_token", app_auth_token); dictionary.Add("biz_content", biz_content); string jsonData = JavaScriptConvert.SerializeObject(dictionary); var chars = jsonData.ToCharArray(); Array.Sort(chars); string data = new string(chars) + key; sign = Md5Helper.Md5_Fulu(data).ToLower(); #endregion Dictionary <string, string> dic2 = new Dictionary <string, string>(); dic2.Add("app_key", app_key); dic2.Add("method", method); dic2.Add("timestamp", timestamp); dic2.Add("version", version); dic2.Add("format", format); dic2.Add("charset", charset); dic2.Add("sign_type", sign_type); dic2.Add("sign", sign); dic2.Add("app_auth_token", app_auth_token); dic2.Add("biz_content", biz_content); string resultData = JavaScriptConvert.SerializeObject(dic2); // { // "app_key": "i4esv1l+76l/7NQCL3QudG90Fq+YgVfFGJAWgT+7qO1Bm9o/adG/1iwO2qXsAXNB", // "method": "fulu.order.direct.add", // "timestamp": "2019-07-27 16:44:30", // "version": "2.0", // "format": "json", // "charset": "utf-8", // "sign_type": "md5", // "sign": "375d05b41775e1ddf2098504444af1e2", // "app_auth_token": "", // "biz_content": "{\"customer_order_no\":\"201906281030191013526\",\"product_id\":10000001,\"charge_account\":\"888888\",\"buy_num\":1,\"charge_ip\":\"192.168.1.100\",\"charge_game_name\":\"三国群英传\",\"charge_game_region\":\"电信一区\",\"charge_game_srv\":\"逐鹿中原\",\"charge_type\":\"Q币\"}" //} return(resultData); }
public async Task Put([FromBody] SQLProduct product, int id) { await _sqlProductService.UpdateProduct(product, id); }