public string MakeSignOwn(string AdminHotelid, int Hotelid, string signType = "MD5") { //转url格式 string str = ToUrl(); //在string后加入API KEY str += "&key=" + WxPayConfig.key_own(AdminHotelid, Hotelid); if (signType == SIGN_TYPE_MD5) { var md5 = MD5.Create(); var bs = md5.ComputeHash(Encoding.UTF8.GetBytes(str)); var sb = new StringBuilder(); foreach (byte b in bs) { sb.Append(b.ToString("x2")); } //所有字符转为大写 return(sb.ToString().ToUpper()); } else if (signType == SIGN_TYPE_HMAC_SHA256) { return(CalcHMACSHA256Hash(str, WxPayConfig.key_own(AdminHotelid, Hotelid))); } else { throw new WxPayException("sign_type 不合法"); } }