# 后端 **Repository Path**: marketing_1/backend ## Basic Information - **Project Name**: 后端 - **Description**: No description available - **Primary Language**: PHP - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-05-12 - **Last Updated**: 2026-06-09 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 收银台营销点餐系统 - 后端服务 ## 项目简介 本系统是一套面向餐饮行业的**营销型点餐收银系统**,基于 Laravel 8 构建,提供从门店管理、商品点餐、排队叫号、会员营销到财务统计的全流程解决方案。 ### 核心特性 - 🍽️ **点餐收银** — 桌台管理、扫码点餐、收银台结算、小票打印 - 🏪 **多平台多门店** — 支持单门店/连锁模式,平台-门店二级管理 - 🎫 **营销体系** — 优惠券发放、分享裂变、VIP等级与资金池、充值返利 - 📱 **微信小程序** — C端用户扫码点餐、排队取号、会员管理 - 📊 **数据统计** — 日报报表、客户月度统计、订单统计分析 - 🍷 **存酒管理** — 客户存酒/取酒全流程记录 - 💰 **财务管理** — 收支分类、提现申请、余额流水 --- ## 技术栈 | 技术 | 说明 | |------|------| | PHP 7.3+ / 8.0 | 运行环境 | | Laravel 8.75 | 核心框架 | | MySQL | 关系型数据库 | | Redis | 缓存/队列/Session | | JWT (tymon/jwt-auth) | API 身份认证 | | 阿里云 OSS | 文件存储 | | 阿里云短信 | 消息通知 | | MongoDB | 辅助存储 | | Maatwebsite Excel | Excel 导入导出 | | Snowflake | 分布式 ID 生成 | --- ## 目录结构 ``` backend/ ├── app/ │ ├── Http/ │ │ ├── Controllers/Api/ │ │ │ ├── v1/ # 基础控制器 │ │ │ ├── v2/ # C端小程序接口 │ │ │ └── v3/ # 总后台管理接口 │ │ ├── Middleware/ # 中间件 │ │ └── Requests/ # 表单验证 │ ├── Models/ # 数据模型 │ └── ... ├── config/ # 配置文件 ├── database/ │ ├── migrations/ # 数据库迁移 │ ├── seeders/ # 数据填充 │ └── *.sql # SQL 备份 ├── routes/ │ └── api.php # API 路由 ├── stubs/ # Excel 导入模板 └── .env.example # 环境配置示例 ``` --- ## API 版本说明 | 版本 | 前缀 | 用途 | 认证方式 | |------|------|------|----------| | V2 | `/api/v2/` | 微信小程序 C 端 | Token | | V3 | `/api/v3/` | 管理后台 B 端 | JWT (admin_api) | ### V3 后台接口模块 | 模块 | 接口前缀 | 说明 | |------|----------|------| | 认证 | `auth/` | 登录/登出 | | 账户 | `menu/` (部分) | 账户 CRUD、密码修改 | | 菜单 | `menu/` | 菜单树 CRUD | | 角色 | `menu/` (部分) | 角色权限管理 | | 组织 | `menu/` (部分) | 组织机构管理 | | Banner | `banner/` | 轮播图管理 | | 平台 | `platform/` | 平台管理 | | 首页 | `home/` | 统计数据 | --- ## 快速开始 ### 环境要求 - PHP >= 7.3 - MySQL >= 5.7 - Redis - Composer ### 安装步骤 ```bash # 1. 安装依赖 composer install # 2. 复制环境配置 cp .env.example .env # 3. 生成应用密钥 php artisan key:generate # 4. 配置 .env(数据库、Redis、OSS、微信等) # 5. 执行数据库迁移 php artisan migrate # 6. 生成 JWT 密钥 php artisan jwt:secret # 7. 启动服务 php artisan serve ``` --- ## 数据库表结构 ### 系统管理 | 表名 | 说明 | |------|------| | `yes_user` | 后台用户 | | `yes_menu` | 菜单权限 | | `yes_role` / `yes_role_menu` | 角色 / 角色菜单关联 | | `yes_organization` | 组织机构 | | `yes_user_log` | 操作日志 | ### 核心业务 | 表名 | 说明 | |------|------| | `platforms` | 平台(单门店/连锁) | | `shops` | 门店 | | `customers` | 客户 | | `customer_shop_bindings` | 客户-门店绑定 | | `table_areas` / `tables` | 桌台区域 / 桌台 | | `categories` | 商品分类 | | `products` | 商品 | | `specs` / `product_specs` | 规格 / 商品规格关联 | | `orders` / `order_subs` / `order_items` | 订单 / 子单 / 明细 | | `order_pay` | 订单支付 | | `cashiers` | 收银台 | | `printers` | 打印机 | ### 营销体系 | 表名 | 说明 | |------|------| | `coupons` / `customer_coupons` | 优惠券 / 用户优惠券 | | `vip_level_configs` | VIP 等级配置 | | `vip_fund_pool_configs` | VIP 月度资金池 | | `vip_reward_records` | VIP 分配记录 | | `share_records` / `share_configs` | 分享记录 / 分享配置 | | `queue_configs` / `queue_records` | 排队配置 / 排队记录 | ### 会员与财务 | 表名 | 说明 | |------|------| | `balance_logs` | 余额流水 | | `recharge_records` | 充值记录 | | `finance_categories` / `finance_records` | 收支分类 / 收支记录 | | `withdraw_requests` | 提现申请 | | `daily_reports` | 日报统计 | | `customer_monthly_stats` | 客户月度统计 | ### 其他 | 表名 | 说明 | |------|------| | `banners` | 轮播图 | | `small_config` | 小程序配置 | | `shop_configs` | 门店配置 | | `wine_storages` / `wine_usage_logs` | 存酒 / 取酒 | | `employees` / `standby_employees` | 员工 / 备用员工 | | `safety_check_items` / `safety_check_records` | 安全检查项 / 巡检记录 | --- ## 队列说明 系统使用 Redis 驟列处理异步任务: | 队列名 | 用途 | |--------|------| | `order_cancel` | 订单自动取消 | | `shop_statistic` | 门店统计计算 | | `order_statistic` | 订单统计计算 | | `good_remind` | 商品开售提醒 | | `order_sms` | 取货时间变更短信通知 | | `order_remind` | 取货到期微信消息提醒 | | `user_upgrade_notice` | 用户勋章升级通知 | 启动队列工作进程: ```bash php artisan queue:work redis --queue=order_cancel,shop_statistic,order_statistic ``` --- ## 配置项说明 ### 微信小程序 在 `.env` 中配置小程序参数: ```env USER_APP_ID=你的小程序AppID USER_APP_SECRET=你的小程序AppSecret MINIPROGRAM_STATE=trial # formal=正式, trial=体验, developer=开发 ``` ### 阿里云 OSS ```env OSS_ACCESS_KEY_ID=你的AccessKeyId OSS_ACCESS_KEY_SECRET=你的AccessKeySecret OSS_BUCKET=你的Bucket名称 OSS_ENDPOINT=oss-cn-xxx.aliyuncs.com ``` ### 阿里云短信 ```env ALI_ACCESS_KEY_ID=你的AccessKeyId ALI_ACCESS_KEY_SECRET=你的AccessKeySecret ALI_SIGN_NAME=短信签名 ALI_TEMPLATE_CODE=短信模板Code ``` --- ## License MIT