示例#1
0
        /// <summary>
        /// 获得JsAPI参数
        /// </summary>
        /// <param name="unifiedOrderResult">下单对象</param>
        /// <returns>JsAPI参数</returns>
        public string GetJsApiParameters(WeChatDataModel unifiedOrderResult)
        {
            WeChatDataModel jsApiParam = new WeChatDataModel();

            jsApiParam.SetValue("appId", unifiedOrderResult.GetValue("appid"));
            jsApiParam.SetValue("timeStamp", CommonManager.GetTimeStamp());
            jsApiParam.SetValue("nonceStr", CommonManager.GetRandomStrByGUID());
            jsApiParam.SetValue("package", "prepay_id=" + unifiedOrderResult.GetValue("prepay_id"));
            jsApiParam.SetValue("signType", "MD5");
            jsApiParam.SetValue("paySign", jsApiParam.MakeSign(_config.KEY));
            string parameters = jsApiParam.ToJson();

            return(parameters);
        }