Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/he426100/hyperf-user-relation
hyperf上下级关系组件
https://github.com/he426100/hyperf-user-relation
Last synced: about 4 hours ago
JSON representation
hyperf上下级关系组件
- Host: GitHub
- URL: https://github.com/he426100/hyperf-user-relation
- Owner: he426100
- Created: 2023-02-23T02:12:34.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2023-12-01T08:04:38.000Z (11 months ago)
- Last Synced: 2024-04-02T10:19:11.929Z (7 months ago)
- Language: PHP
- Size: 70.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# hyperf-user-relation
受[jtar-hyperf-user-node](https://github.com/taobali32/jtar-hyperf-user-node)启发,把自己常用的用户关系实现发出来
## Installation
- Request
```bash
composer require he426100/hyperf-user-relation
```- Publish
```bash
php bin/hyperf.php vendor:publish he426100/hyperf-user-relation
```用户关系表参考
```
CREATE TABLE `user_relation` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`parent_id` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '父级ID',
`user_id` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '会员ID',
`level` int(11) UNSIGNED NOT NULL DEFAULT 1 COMMENT '关系等级',
`create_time` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `parent_user_index`(`parent_id`, `user_id`) USING BTREE,
UNIQUE INDEX `user_level_index`(`user_id`, `level`) USING BTREE,
INDEX `rds_idx_0`(`user_id`, `parent_id`, `level`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = COMPACT;
```