本说明适用于本外卖点餐系统的完整部署,包含服务端(Golang)、客户端(Vue3 H5)和后台管理端(PHP 5.6)。
CodApp 扫码点餐小程序系统为商家提供了一套完整、独立、自主可控的自助点餐解决方案,支持 微信小程序与H5双端部署,无需依赖第三方平台,不抽佣、不限制功能。安装部署过程简单清晰,适合具备基础技术能力的商家团队快速上手。本安装说明书将详细指导你如何完成从源码获取、服务端部署(支持 Golang)、数据库配置、微信小程序上传审核,到最终上线运行的每一步操作。无论你是首次接触自助点餐系统,还是希望将现有系统升级为更灵活、数据可控的无抽佣扫码点餐方案,本安装指南都将为你提供全面技术支持。让你实现“一键部署,极速上线,完全掌控”的运营目标!
本系统包含 3 个子系统:
api.xxx.com
www.xxx.com
admin.xxx.com
1. 环境要求
2. 数据库准备
orderfoodh5
3. 将 api 上传至服务器 /var/www/html/api
,并配置文件 conf.ini(JSON 格式)
请修改 /var/www/html/api
权限为可写可执行
请修改 conf.ini 文件中的内容如下,替换为你的数据库与 Redis 配置:
{
"Db": {
"Driver": "mysql",
"Host": "你的数据库地址,例如 127.0.0.1 或公网地址",
"Name": "数据库名称,例如 orderfoodh5",
"User": "数据库用户名,例如 root",
"Password": "数据库密码,例如 yourpassword",
"Port": "3306",
"Charset": "utf8"
},
"Cache": {
"Driver": "redis",
"Host": "Redis 地址,例如 127.0.0.1",
"Num": "0",
"Port": "6379",
"Auth": "Redis 密码,如果没有可为空字符串"
},
"Conf": {
"Name": "项目名称,例如 ofH5",
"Host": "服务端监听地址,通常为 127.0.0.1",
"Port": "9100", // 服务端监听端口,默认 9100
"Secret": "f8dd1dfac2db6f2a395eb4ee0b5b7dc5", // 接口加密密钥,请保持复杂度,下面客户端和后台端都保持一致"
"Mode": "Dev" // 可选值:Dev(开发模式)或 Release(生产模式)
}
}
4. 使用 Supervisor 管理 Golang 服务
创建文件 /etc/supervisor/conf.d/orderFood.conf
,内容如下:
[program:orderFood]
directory=/var/www/html/api
command=/home/www/server/orderFood
autostart=true
autorestart=true
stderr_logfile=/var/log/orderFood.err.log
stdout_logfile=/var/log/orderFood.out.log
执行命令:
supervisorctl reread
supervisorctl update
supervisorctl start orderFood
5. 配置 Nginx(服务端代理)
server {
listen 443 ssl;
server_name api.xxx.com;
ssl_certificate /etc/ssl/server.crt;
ssl_certificate_key /etc/ssl/server.key;
location / {
proxy_pass http://127.0.0.1:9100;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
1. 将 dist 上传至服务器 /var/www/html/dist
,并配置:
2. 客户端请求接口地址需指向 https://api.xxx.com
请修改 config.js 文件中的内容如下:
window._APP_CONFIG = {
VITE_APP_API_URL: "https://api.xxx.com", // 服务端地址
VITE_APP_CDN_URL: "https://api.xxx.com", // CDN加速地址
VITE_APP_API_SECRET: "f8dd1dfac2db6f2a395eb4ee0b5b7dc5",
VITE_APP_TIMEOUT: "5000",
VITE_APP_DEBUG_MODE: false,
VITE_APP_COLOR_PRIMARY: "#BB4040",
VITE_APP_COLOR_SECONDARY: "#6c757d",
VITE_APP_COLOR_SUCCESS: "#28a745",
VITE_APP_COLOR_DANGER: "#dc3545",
VITE_APP_COLOR_WARNING: "#ffc107",
VITE_APP_COLOR_INFO: "#17a2b8",
VITE_APP_COLOR_LIGHT: "#f8f9fa",
VITE_APP_COLOR_DARK: "#343a40",
VITE_APP_COLOR_MUTED: "#999",
VITE_APP_COLOR_WHITE: "#ffffff",
};
3. 使用 nginx 配置 www.xxx.com 网站
server {
listen 443 ssl;
server_name www.xxx.com;
ssl_certificate /etc/ssl/www.crt;
ssl_certificate_key /etc/ssl/www.key;
root /var/www/html/dist;
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
}
4. 若使用不同源,请开启 CORS 跨域支持
1. 环境准备
/var/www/html/admin
/var/www/html/admin/Public/Static/upload
[Config]
ApiUrl='https://api.xxx.com'
CdnUrl='https://api.xxx.com'
Secret='f8dd1dfac2db6f2a395eb4ee0b5b7dc5'
Number='1.0.0'
2. 配置 Nginx(后台站点)
server {
listen 443 ssl;
server_name admin.xxx.com;
ssl_certificate /etc/ssl/admin.crt;
ssl_certificate_key /etc/ssl/admin.key;
root /var/www/html/admin/Public; #注意这里绑定的是目录下的Public文件夹
location / {
index index.html index.htm index.php;
if (!-e $request_filename) {
rewrite ^.*$ /index.php last;
break;
}
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
**Q1:数据库连接失败?
Q2:访问接口返回 502?
Q3:如何申请 HTTPS 证书?
Q4:后台页面访问空白?
感谢使用本系统!如有问题请联系技术支持。