Program development of small maintenance access_token

demand

Auto loans into a single system, there is an electronic signature function. Electronic signature function sub app and micro-channel remote signature.

 

When the micro-channel remote signed, will share a small two-dimensional code program.

 

Customers get two-dimensional code, scan code into their own documents for authentication, (Tencent nuclear body) electronic signature -

 

Demand Point 1:

Carrying the order number, and other parameters, to generate the applet code ~

 

Achieve V1

The two-dimensional code generating QRCoder

 

     /// <Summary> 
        /// generate two-dimensional code 
        /// </ Summary> 
        /// <param name = "ID"> Table credit pre ID </ param> 
        /// <Returns> two-dimensional code value md5 , and the time to failure </ Returns> 
        [the Routing (EHttpMethod.HttpGet, "App / code")] 
        public CommonResult <MQCode> CreteCodes (String ID) 
        { 
            var CreteCode Result = (ID, ECaCategory.PreCredit); 
            IF (result.WarnResult ! = null) 
            { 
                return result.WarnResult; 
            } 
            return result.Value; 
        } 


        public CommonResult <MQCode> CreteCode (String ID,ECaCategory caCategory)
        { 
            string qrcodeid = Tools.NewId ();
            if (String.IsNullOrEmpty(id))
            {
                return new WarnResult("参数为空");
            }
            try
            {
                string strCode = "https://open.weixin.qq.com/sns/getexpappinfo?appid=" + _config["WXPrecreditAPPID"] + $"&path=pages/index/index.html?id={id}%26code={qrcodeid}%26time=6#wechat-redirect";
                //strCode = HttpUtility.UrlEncode(strCode);
                QRCodeGenerator qrGenerator = new QRCoder.QRCodeGenerator();
                QRCodeData qrCodeData = qrGenerator.CreateQrCode(strCode, QRCodeGenerator.ECCLevel.Q);
                QRCode qrcode = new QRCode(qrCodeData);
                #region basestring
                string baseICO = "这里是base64二维码图标";
                #endregion 
                var imgICO = Tools.Base64StringToImage (baseICO); 
                // call to generate two-dimensional code 
          System.Drawing.Bitmap qrCodeImage = qrcode.GetGraphic (5, System.Drawing.Color .Black, System.Drawing.Color.White, imgICO, 15,. 6); var path = "UploadFileTemp \\" + _FileHelper.GetFileName ( "JPEG."); // save a local call
          qrCodeImage.Save (path, System. Drawing.Imaging.ImageFormat.Jpeg);
          // call the upload var the Result = _FileHelper.UploadFile (path, Guid.NewGuid (), "1200170005"); ! IF (result.WarnResult = null) { throw new Exception(result.WarnResult.Message); } var resModel = _jsonConverter.Deserialize<dynamic>(result.Value); string md5 = resModel.data.md5; if (string.IsNullOrEmpty(md5)) { throw new Exception(result.Value); } else { //存储二维码逻辑 var saveResult = _orderCRepository.SaveQRCode(qrcodeid, id, md5, caCategory.ToString()); if (saveResult.WarnResult == null) { new new MQCode return () = {the Md5 MD5, Faildate = saveResult.Value}; } the else { return saveResult.WarnResult; } } } catch (Exception ex) { log.LogError ( "error (000010A692FD70000C05):", EX); return new new WarnResult ( "generate two dimensional code error, please contact your system administrator ");. } } public class MQCode { /// <the Summary> /// picture MD5 /// </ the Summary> public String the Md5 {GET; the SET;} /// < the Summary> /// expiration time /// </ Summary> public Faildate the DateTime {GET; SET;} }

  

Achieve v2 version

Call the applet to generate two-dimensional code functionality, the applet server provides three ways to generate.

This is an alternative getUnlimited interface, which does not limit the number of calls to meet business needs.

 

 

Guess you like

Origin www.cnblogs.com/blogs2014/p/12664756.html