# jnyp **Repository Path**: bandung/jnyp ## Basic Information - **Project Name**: jnyp - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-04-12 - **Last Updated**: 2025-05-08 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 友博云 CRM 友博云CRM是由[南京友博网络科技有限公司](http://www.u-bo.com/)开发的一套易用、强大、优雅的客户管理系统。 ## 环境要求 Web服务器需要支持 **PHP 7.4.0.** 及以上 ## 部署说明 ### 多域名独立部署方式 此种方式下各应用的访问形式为: - 前台 www.domain.com - 后台 admin.domain.com、admin.domain.com/admin.php、admin.domain.com/oa.php - API api.domain.com - 附件 [各应用域名]/upload #### redis 和RabbitMQ ``` 'redis' => [ 'class' => 'yii\redis\Connection', 'hostname' => '127.0.0.1', 'port' => 6379, 'database' => 10, ], 'queue' => [ 'class' => yii\queue\amqp_interop\Queue::class, 'as log' => yii\queue\LogBehavior::class, 'queueName' => 'coupon', //指定队列名称 'driver' => yii\queue\amqp_interop\Queue::ENQUEUE_AMQP_LIB, 'exchangeName'=>'coupon', //交换机 'heartbeat'=>6, //心跳频率 'queueOptionalArguments'=>[ // 'x-expires' => 300000, 'x-max-priority' => 10, //优先级队列 ], 'host' => '192.168.6.11', 'user' => 'guest', 'password' => 'guest', 'port' => 5672, ], ``` #### 部署方式 将各应用的入口文件内的`require(__DIR__ . '[path]/config/routing.php')`注释掉;并参照如下Nginx配置示例: ``` # 前台 server { listen 80; ... server_name www.ubo.com; root [项目根目录]/front/web/; index index.php; ... location ~ ^/upload/ { root /opt/htdocs/file/; } location / { # 如果找不到真实存在的文件,把请求分发至 index.php try_files $uri $uri/ /index.php$is_args$args; } # 拒绝访问assets目录下的php文件 location ~ ^/assets/.*\.php$ { deny all; } location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; try_files $uri =404; } location ~ ^/robots.txt$ { deny all; } location ~* /\. { deny all; } } # 后台 server { listen 7000; server_name admin.ubo.com; root [项目根目录]/web/; index index.php; ... location ~ ^/upload/ { root /opt/htdocs/file/; } location / { # 如果找不到真实存在的文件,把请求分发至 index.php try_files $uri $uri/ /index.php$is_args$args; } # 拒绝访问assets目录下的php文件 location ~ ^/assets/.*\.php$ { deny all; } location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; try_files $uri =404; } location ~ ^/robots.txt$ { deny all; } location ~* /\. { deny all; } } # Api server { listen 8001; server_name api.ubo.com; root [项目根目录]/api/web/; index index.php; ... location / { # Redirect everything that isn't a real file to index.php try_files $uri $uri/ /index.php$is_args$args; } # 拒绝访问assets目录下的php文件 location ~ ^/assets/.*\.php$ { deny all; } location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; try_files $uri =404; } location ~* /\. { deny all; } } ``` ### 单域名+伪静态部署方式 此种方式下各应用的访问形式为: - 前台 www.domain.com - 后台 www.domain.com/admin、www.domain.com/admin/backend、www.domain.com/admin/oa - API www.domain.com/api - 附件 www.domain.com/file、domain.com/upload #### 部署方式 将各应用的入口文件内的`require(__DIR__ . '[path]/config/routing.php')`注释取消;并参照如下Nginx配置示例: ``` server { listen 80; server_name www.ubo.com; root [项目根目录]/; index index.php; ... location ~ ^/file/ { root [项目根目录]/; } location ~ ^/upload/ { root [项目根目录]/file/; } location ~ ^/admin/((?:oa|backend)/)?(.+\.(?!html|htm|php).+)$ { alias [项目根目录]/web/$2; } location ~ ^/admin/oa { root [项目根目录]/web/; try_files $uri /web/oa.php?$args; } location ~ ^/admin/backend { root [项目根目录]/web/; try_files $uri /web/backend.php?$args; } location ~ ^/admin { root [项目根目录]/web/; try_files $uri /web/index.php?$args; } location /api { root [项目根目录]/api/web/; try_files $uri $uri/ /api/web/index.php?$args; } location / { root [项目根目录]/front/web/; try_files $uri /front/web/index.php?$args; } # 避免 Yii 接管不存在文件的处理过程(404) location ~ \.(js|css|png|jpg|gif|webp|swf|ttf|ico|pdf|mov|fla|zip|rar)$ { root [项目根目录]/front/web; try_files $uri =404; expires 12h; error_log /dev/null; access_log /dev/null; } # 仅允许指定目录下的php文件可访问 location ~ ^/(front/web/index|web/index|web/backend|web/oa|api/web/index)\.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; try_files $uri =404; } location ~ [^/]\.php(/|$) { deny all; } location ~ ^/robots.txt$ { deny all; } location ~* /\. { deny all; } } ``` ## 定时任务迁移备份错误日志表 根据实际情况在指定时间间隔执行错误日志表迁移备份脚本 ```shell php yii error-log/log-migrate ``` 示例: 每个月执行一次错误日志表迁移备份 1. 进入crontab编辑页面 ```shell crontab -e ``` 2. 增加错误日志表迁移备份定时任务 ```shell 0 0 1 */1 * php [项目根目录]/yii error-log/log-migrate >> [项目根目录]/console/runtime/cron.log 2>&1 ``` 3. 重载crontab配置并重启服务 ```shell service crond reload service crond restart ``` ## 自定义vendor 包内容 ``` vendor/overtrue/wechat/src/MiniProgram/Express/Client.php 增加一个 引用类 use \common\traits\wechat\ExpressClient; ```