初始提交:人事共享服务中心钉钉登录功能
This commit is contained in:
148
README.md
Normal file
148
README.md
Normal file
@@ -0,0 +1,148 @@
|
||||
# 人事共享服务中心"码"上办 - 需求收集系统
|
||||
|
||||
## Linux服务器部署指南
|
||||
|
||||
### 1. 上传并解压包
|
||||
|
||||
```bash
|
||||
# 上传 requirement-collection.tar.gz 到服务器
|
||||
|
||||
# 解压
|
||||
tar -xzf requirement-collection.tar.gz
|
||||
cd mashangban
|
||||
```
|
||||
|
||||
### 2. 安装依赖
|
||||
|
||||
```bash
|
||||
pip3 install -r requirements.txt
|
||||
```
|
||||
|
||||
### 3. 初始化数据库
|
||||
|
||||
```bash
|
||||
python3 init_db.py
|
||||
```
|
||||
|
||||
### 4. 启动服务
|
||||
|
||||
```bash
|
||||
python3 run.py
|
||||
```
|
||||
|
||||
### 5. 访问地址
|
||||
|
||||
- 基础地址:http://your-server-ip:5001/requirement-collection
|
||||
- 带钉钉参数:http://your-server-ip:5001/requirement-collection/?userId={{发起人userid}}&name={{发起人姓名}}&dept={{发起人部门}}
|
||||
|
||||
### 6. 钉钉集成
|
||||
|
||||
在钉钉中配置机器人或应用,传入以下参数:
|
||||
|
||||
| 参数 | 说明 | 示例 |
|
||||
|------|------|------|
|
||||
| userId | 钉钉用户ID | manager123 |
|
||||
| name | 用户姓名 | 张三 |
|
||||
| dept | 部门名称 | 人事部 |
|
||||
|
||||
**示例URL:**
|
||||
```
|
||||
https://askill.top/requirement-collection/?userId=user001&name=张三&dept=人事部
|
||||
```
|
||||
|
||||
**首次访问:** 系统自动创建用户并记录姓名和部门信息
|
||||
|
||||
**后续访问:** 根据userId自动识别用户并登录
|
||||
|
||||
### 7. 管理员配置
|
||||
|
||||
默认管理员账户信息:
|
||||
- 用户名:管理员
|
||||
- dingtalk_userid:admin
|
||||
|
||||
如需修改为其他管理员,需要手动编辑数据库。
|
||||
|
||||
### 8. 修改配置(可选)
|
||||
|
||||
#### 修改端口
|
||||
编辑 `run.py` 中的端口号:
|
||||
```python
|
||||
run_simple('0.0.0.0', 端口号, application, ...)
|
||||
```
|
||||
|
||||
#### 使用Gunicorn部署(生产环境推荐)
|
||||
|
||||
```bash
|
||||
pip3 install gunicorn
|
||||
gunicorn -w 4 -b 0.0.0.0:5001 'run:application'
|
||||
```
|
||||
|
||||
#### Nginx反向代理配置
|
||||
|
||||
```nginx
|
||||
server {
|
||||
listen 80;
|
||||
server_name your-domain.com;
|
||||
|
||||
location /requirement-collection {
|
||||
proxy_pass http://127.0.0.1:5001;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 9. 后台运行
|
||||
|
||||
使用systemd管理服务:
|
||||
|
||||
```bash
|
||||
sudo nano /etc/systemd/system/requirement-collection.service
|
||||
```
|
||||
|
||||
写入以下内容:
|
||||
|
||||
```ini
|
||||
[Unit]
|
||||
Description=Requirement Collection Service
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
User=www-data
|
||||
WorkingDirectory=/path/to/mashangban
|
||||
ExecStart=/usr/bin/python3 /path/to/mashangban/run.py
|
||||
Restart=always
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
```
|
||||
|
||||
启用服务:
|
||||
|
||||
```bash
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable requirement-collection
|
||||
sudo systemctl start requirement-collection
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 功能说明
|
||||
|
||||
- **需求汇总**:公开页面,显示所有公开需求
|
||||
- **提交新需求**:登录后可提交(需求标题、需求内容、分会、联系方式、是否公开)
|
||||
- **我的需求**:查看和管理自己提交的需求
|
||||
- **管理后台**:管理员可回答需求、修改公开状态
|
||||
|
||||
## 权限说明
|
||||
|
||||
| 功能 | 普通用户 | 管理员 |
|
||||
|------|---------|--------|
|
||||
| 查看公开需求 | ✓ | ✓ |
|
||||
| 提交需求 | ✓ | ✓ |
|
||||
| 编辑自己的需求 | ✓ | ✓ |
|
||||
| 回答需求 | - | ✓ |
|
||||
| 强制修改公开状态 | - | ✓ |
|
||||
| 查看所有需求 | - | ✓ |
|
||||
Reference in New Issue
Block a user