优化代码
parent
7953386cd6
commit
9116e55ac9
19
README.md
19
README.md
|
@ -12,33 +12,40 @@ Lumen-IM 是一个网页版在线即时聊天项目,前端使用 Element-ui +
|
|||
- 支持聊天消息撤回、删除或批量删除、转发消息(逐条转发、合并转发)
|
||||
- 支持编写个人笔记、支持笔记分享(好友或群)
|
||||
|
||||
## 2、项目Demo
|
||||
## 2、项目DEMO
|
||||
|
||||
- 地址: [http://im.gzydong.club](http://im.gzydong.club)
|
||||
- 账号: 18798272054 或 18798272055
|
||||
- 密码: admin123
|
||||
|
||||
## 3、环境要求
|
||||
|
||||
- PHP >= 7.2
|
||||
- Swoole >= 4.4
|
||||
- MySQL >= 5.7
|
||||
- Redis >= 5.0
|
||||
- Swoole >= 4.5
|
||||
- OpenSSL
|
||||
- JSON
|
||||
- PDO
|
||||
- Redis >= 5.0.0
|
||||
|
||||
## 4、相关文档
|
||||
|
||||
[Hyperf 框架](https://hyperf.wiki/2.0/#/README)
|
||||
|
||||
## 5、项目安装
|
||||
|
||||
1. 下载源码包
|
||||
2. 安装框架依赖包执行 `compsoer install` 命令 [项目根目录下执行]
|
||||
2. 拷贝项目根目录下 .env.example 文件为 .env 并正确配置相关参数(mysql、redis)
|
||||
3. 执行数据库迁移文件命令生成相关数据表 `php bin/hyperf.php migrate`
|
||||
4. 启动运行项目 `php bin/hyperf.php start`
|
||||
|
||||
注 :[项目运行之前请确保 Mysql、Redis 及 Nginx 服务]
|
||||
注 :[项目运行之前请确保 MySQL、Redis 及 Nginx 服务]
|
||||
|
||||
## Nginx 相关配置(代理 swoole 服务)
|
||||
|
||||
##### 配置 Http 服务
|
||||
|
||||
```
|
||||
upstream hyperfhttp {
|
||||
# Hyperf HTTP Server 的 IP 及 端口
|
||||
|
@ -68,6 +75,7 @@ server {
|
|||
```
|
||||
|
||||
##### 配置 WebSocket 服务
|
||||
|
||||
```
|
||||
# 至少需要一个 Hyperf 节点,多个配置多行
|
||||
upstream hyperf_websocket {
|
||||
|
@ -99,6 +107,7 @@ server {
|
|||
```
|
||||
|
||||
##### 配置图片域名
|
||||
|
||||
```
|
||||
server {
|
||||
listen 80;
|
||||
|
@ -128,8 +137,10 @@ server {
|
|||
```
|
||||
|
||||
### 注意事项
|
||||
|
||||
1. 请确保 PHP 安装 openssl、redis 扩展
|
||||
2. 请确保 Swoole 扩展开启 openssl 扩展
|
||||
|
||||
```
|
||||
[root@iZuf6cs69fbc86cwpu9iv3Z vhost]# php --ri swoole
|
||||
swoole
|
||||
|
|
|
@ -4,11 +4,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Command;
|
||||
|
||||
use App\Helper\Hash;
|
||||
use App\Model\User;
|
||||
use Hyperf\Command\Command as HyperfCommand;
|
||||
use Hyperf\Command\Annotation\Command;
|
||||
use Hyperf\DbConnection\Db;
|
||||
use Psr\Container\ContainerInterface;
|
||||
|
||||
/**
|
||||
|
@ -36,9 +33,6 @@ class TestCommand extends HyperfCommand
|
|||
|
||||
public function handle()
|
||||
{
|
||||
User::create([
|
||||
'mobile' => '18798271181',
|
||||
'password' => Hash::make('asdfbasjhdfbasj'),
|
||||
]);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,6 @@ use App\Cache\UnreadTalk;
|
|||
use App\Constants\TalkMessageType;
|
||||
use App\Constants\TalkMode;
|
||||
use App\Model\Talk\TalkList;
|
||||
use App\Model\UsersFriend;
|
||||
use App\Service\UserFriendService;
|
||||
use App\Support\UserRelation;
|
||||
use Hyperf\Di\Annotation\Inject;
|
||||
|
|
|
@ -29,6 +29,8 @@ class User extends BaseModel implements Authenticatable
|
|||
|
||||
protected $table = 'users';
|
||||
|
||||
public $timestamps = true;
|
||||
|
||||
protected $fillable = [
|
||||
'mobile',
|
||||
'nickname',
|
||||
|
|
Loading…
Reference in New Issue