示例#1
0
        /// <summary>
        /// 创建临时二维码
        /// https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1443433542
        /// </summary>
        /// <param name="access_token"></param>
        /// <param name="scene_str">场景字符串</param>
        /// <param name="callback">回调方法</param>
        /// <param name="expire_seconds">超时毫秒 2592000(默认30天)</param>
        /// <returns></returns>
        public async Task <WxMP_QRSceneResult> CreateTempQRSceneByStr(string access_token, string scene_str, int expire_seconds = 2592000)
        {
            var postUrl = string.Format("https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token={0}", access_token);
            var para    = new WxMP_QrcodeCreateParameter();

            para.expire_seconds = expire_seconds;
            para.scene_str      = scene_str;
            //请求
            return(await ApplicationContext.Http.PostJsonAsync <WxMP_QRSceneResult>(postUrl, para.ToJson()));
        }
示例#2
0
        /// <summary>
        /// 创建永久二维码
        /// https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1443433542
        /// </summary>
        /// <param name="access_token"></param>
        /// <param name="scene_str">场景ID</param>
        /// <param name="callback">回调方法</param>
        /// <param name="expire_seconds">超时毫秒 2592000(默认30天)</param>
        /// <returns></returns>
        public async Task <WxMP_QRSceneResult> CreateQRLimitScene(string access_token, int scene_id, string scene_str)
        {
            var postUrl = string.Format("https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token={0}", access_token);
            var para    = new WxMP_QrcodeCreateParameter();

            para.IsLimit   = true;
            para.scene_id  = scene_id;
            para.scene_str = scene_str;
            //请求
            return(await ApplicationContext.Http.PostJsonAsync <WxMP_QRSceneResult>(postUrl, para.ToJson()));
        }