微门禁小程序项目源代码使用说明

代码及目录结构

源码仓库地址: https://gitee.com/jikeshifu/weimenjin_miniprogram
enter image description here

  • weimenjin_admin: 管理后台源码

  • weimenjin_app: 微信小程序端Vue,uniapp源码

  • 数据库: 数据库在weimenjin_admin/db.sql

1.宝塔面板安装所需软件环境如下:

enter image description here
php要安装fileinfo和redis扩展:
enter image description here
禁用函数中删除putenv

2.创建站点:

用域名创建站点,同时创建一个数据库,域名先解析到服务器IP
enter image description here

3.进入站点目录拉取代码或下载压缩包上传上去,推荐使用git拉取代码方便后续更新:

enter image description here
拉取代码后目录如下:
enter image description here

4.导入数据库和修改连接数据库的配置文件

(1)将db.sql文件导入创建的数据库
enter image description here
(2)修改连接数据库的配置文件,两个文件(/.env和/config/database.php)
.env
enter image description here
/config/database.php
enter image description here

5.设置站点目录和运行目录,配置伪静态为Thinkphp

enter image description here
伪静态:
enter image description here

6.配置SSL证书

enter image description here

7.登录后台,默认账号admin,密码wmj123456

配置小程序appid和appsecret
enter image description here

8.配置连接硬件的参数,

(1)系统管理----应用配置,找到如下图所示位置配置
enter image description here
(2)系统管理-----系统配置,找到如下图所示位置,同样配置上上面的参数(兼容新旧版本硬件)
enter image description here

9. 微信小程序后台的合法域名配置

路径:管理 -> 开发管理 -> 服务器域名 -> request合法域名。
enter image description here
根据自己的域名进行配置。

10. 配置微信小程序普通二维码调起小程序规则配置

路径:管理 -> 开发管理 -> 扫普通链接二维码打开小程序

扫码开门的配置

  • 二维码规则填写: 域名/minilock?user_id=

  • 小程序功能页面填写: pages/open/open

后台扫码登录的配置

  • 二维码规则填写: 域名/qrCodeLogin?key=

  • 小程序功能页面填写: pages/index/index

参考下图
enter image description here

11.使用HbuilderX编译小程序端源码

(1)搜索 微门禁 修改小程序名称,涉及的位置替换成自己小程序名称
enter image description here
(2)manifest文件,微信小程序配置,修改成自己的appid
enter image description here
(3)编译,如果后台appid、appsecret及小程序端的appid配置不对,编译时提醒如下:
enter image description here

12.将微信号绑定为超级管理员

步骤

小程序能正常登录和绑定手机号后,进入会员管理,找到会员编号。在系统管理 -> 管理员 -> 修改 -> 会员id中,填入会员编号即可。

作者:极客师傅  创建时间:2025-03-09 02:39
最后编辑:极客师傅  更新时间:2025-04-27 12:41