Example #1
0
        static private string MakeSourceDD(MeiZuModel model, string secret)
        {
            string query_string = "app_id=" + model.app_id + "&buy_amount=" + model.buy_amount + "&cp_order_id=" + model.cp_order_id + "&create_time=" + model.create_time + "&pay_type=" + model.pay_type + "&product_body=" + GetUTF8S(model.product_body) + "&product_id=" + GetUTF8S(model.product_id) + "&product_per_price=" + GetUTF8S(model.product_per_price) + "&product_subject=" + GetUTF8S(model.product_subject) + "&product_unit=" + GetUTF8S(model.product_unit) + "&total_price=" + GetUTF8S(model.total_price) + "&uid=" + GetUTF8S(model.uid) + "&user_info=" + GetUTF8S(model.user_info) + ":" + secret;



            //            string query_string = @"app_id="+ model.app_id + @"&buy_amount="+model.buy_amount+@"&cp_order_id="+model.cp_order_id+@"&create_time="+model.create_time+@"
            //&pay_type="+model.pay_type+@"&product_body="+ GetUTF8S(model.product_body)+@"&product_id="+ GetUTF8S(model.product_id)+
            //@"&product_per_price="+ GetUTF8S(model.product_per_price)+@"&product_subject="+ GetUTF8S(model.product_subject)+@"&product_unit="+ GetUTF8S(model.product_unit)+@"
            //&total_price="+ GetUTF8S(model.total_price)+@"&uid="+ GetUTF8S(model.uid)+@"&user_info="+ GetUTF8S(model.user_info)+":"+ secret;

            return(query_string);
        }
Example #2
0
        static public string MakeSigCreateDD(MeiZuModel model, string secret)
        {
            string mk  = MakeSourceDD(model, secret);
            ILog   log = LogManager.GetLogger("Callback");

            log.Info(" 魅族生成md5第1步:获得编码后的url组合参数:" + mk);
            //使用SHA1的HMAC
            //HMAC hmac = HMACSHA1.Create();
            //hmac.Key = Encoding.UTF8.GetBytes(secret);
            //byte[] hash = hmac.ComputeHash(Encoding.UTF8.GetBytes(mk));
            ////转为base64编码
            //string my_sign = Convert.ToBase64String(hash);


            string my_sign = CalculateMD5Hash(mk);

            log.Info(" 魅族生成md5第2步:新的md5编码" + my_sign);
            return(my_sign);
        }