更新记录

1.0(2025-10-13) 下载此版本

二维码生成,后端采用c#写,组件采用的ZXing

region CreateQrCode

    /// <summary>
    /// 生成二维码
    /// </summary>
    /// <param name="content"></param>
    /// <returns></returns>
    [HttpPost]
    public Response<object> CreateQrCode([FromForm]  string content)
    {
        try
        { 
            var path = CommonMethod.GenVisitQrCode(content);
            //Log4Net.WriteLog("path:" + path);
            return Success<object>(path);
        }
        catch (Exception ex)
        {
            Log4Net.WriteLog(ex.Message);
            return Error<object>(ex.Message);
        }
    }
    #endregion

///

/// 生成访客二维码 /// /// id /// 图片 public static string GenVisitQrCode(string id) { var writer = new ZXing.QrCode.QRCodeWriter(); Dictionary<EncodeHintType, object> hints = new Dictionary<EncodeHintType, object>(); hints.Add(EncodeHintType.CHARACTER_SET, "UTF-8"); BitMatrix bm = writer.encode(id, BarcodeFormat.QR_CODE, 250, 250, hints); var zzb = new ZXing.ZKWeb.BarcodeWriter { Options = new EncodingOptions() { Margin = 0, } }; string rootpath = Tools.GetWebRootPath(); if (!Directory.Exists(rootpath + "/upload/AI/")) { Directory.CreateDirectory(rootpath + "/upload/AI/"); } string filepath = rootpath + "/upload/AI/" + id + ".jpg"; var b2 = zzb.Write(bm); b2.Save(filepath); b2.Dispose(); return "http://localhost:5000/upload/AI/" + id + ".jpg"; }


平台兼容性

云开发 quickstart

这是云开发的快速启动指引,其中演示了如何上手使用云开发的三大基础能力:

  • 数据库:一个既可在小程序前端操作,也能在云函数中读写的 JSON 文档型数据库
  • 文件存储:在小程序前端直接上传/下载云端文件,在云开发控制台可视化管理
  • 云函数:在云端运行的代码,微信私有协议天然鉴权,开发者只需编写业务逻辑代码

参考文档

隐私、权限声明

1. 本插件需要申请的系统权限列表:

2. 本插件采集的数据、发送的服务器地址、以及数据用途说明:

3. 本插件是否包含广告,如包含需详细说明广告表达方式、展示频率:

许可协议

MIT协议

暂无用户评论。