# 极简随手记php **Repository Path**: 5xuni/bs_account_backend ## Basic Information - **Project Name**: 极简随手记php - **Description**: 极简随手记php - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 2 - **Created**: 2025-03-15 - **Last Updated**: 2025-03-15 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README 记账后端代码 =============== - 轻量级服务器,请各位大佬手下留情!!! - 轻量级服务器,请各位大佬手下留情!!! - 轻量级服务器,请各位大佬手下留情!!! - 轻量级服务器,请各位大佬手下留情!!! #### 代码图 代码关系 客户端端代码(uniapp vue2)在 https://gitee.com/brisklan/bs_account 管理后台代码(element UI)在 https://gitee.com/brisklan/bs_account_admin php运行环境要求thinkphp8.0+,开发环境php8.2,其它环境自己测试。 强制路由模式、基于thinkphp6开发 #### 1.项目依赖包 ```shell #①默认php版本 composer install #②指定php版本 php82 /usr/bin/composer install ``` 注意: ①需要redis扩展(如果不用redis缓存则不用) ②开启fileinfo扩展 ③并把禁用函数putenv、 proc_open 移除 ### #1.项目初始化 复制.example.env 文件为.env,修改.env相关配置 ```shell cp .example.env .env ``` - 伪静态配置 ```shell location / { if (!-e $request_filename) { rewrite ^(.*)$ /index.php?s=/$1 last; break; } } ``` - 给文件夹777权限 ```shell chmod -R 777 runtime/ chmod -R 777 /public/storage/ ```` ### #2.本地运行 ```shell php think run ``` ### #3.数据库配置 导入数据库文件 install/bs_jizhang.sql ### 命令行 - 队列,很多操作是队列方式执行的,如果不用队列在env文件中queue中配置is_open = false ```shell #队列 php think queue:listen --queue bs_jz_queue ``` - 生成账单 ```shell php think bill --type day # 生成日账单 php think bill --type month # 生成月账单 php think bill --type year # 生成年账单 php think bill --type week # 生成周账单 ``` ### 用crontab 定时 (www用户) /www/wwwroot/website - 切换crontab用户 ```shell crontab -e -u www ``` - crontab配置 ```shell 0 7 * * * cd /www/wwwroot/website && /usr/bin/php /www/wwwroot/website/think bill --type day 10 7 1 * * cd /www/wwwroot/website && /usr/bin/php /www/wwwroot/website/think bill --type month 20 7 1 1 * cd /www/wwwroot/website && /usr/bin/php /www/wwwroot/website/think bill --type year 30 7 * * 1 cd /www/wwwroot/website && /usr/bin/php /www/wwwroot/website/think bill --type week #每天0点之前统计昨天的数据 0 0 * * * cd /www/wwwroot/website && /usr/bin/php /www/wwwroot/website/think sys_statistics #每30分钟检查周期执行账单 0 */30 * * * cd /www/wwwroot/website && /usr/bin/php /www/wwwroot/website/think bill_check ``` ### 账单邮件通知 1. 邮件配置在config/email.php 2. 队列配置在config/queue.php 3. 发送采用异步延迟10秒推送邮件 4. 队列执行php think queue:listen #请用supervisor管理