Compare commits
1 Commits
master
...
dependabot
Author | SHA1 | Date |
---|---|---|
dependabot[bot] | 5c42a22aa4 | 3 years ago |
@ -1,63 +1,144 @@ |
||||
### 用与应用分发,苹果超级签名 |
||||
#### 部署前准备 |
||||
- 备案域名【至少需要一个域名,以下可通过子域名部署】 |
||||
- API域名 |
||||
- 前端web域名 |
||||
- 下载页域名 |
||||
- 下载页域名可配置多个 |
||||
- 存储域名(使用阿里云oss存储) |
||||
- ssl证书 |
||||
- API域名证书 |
||||
- 存储域名证书(使用阿里云oss存储) |
||||
- 前端web域名证书(可选) |
||||
- Centos8Stream 服务器 |
||||
- 如果使用oss存储,则带宽为1M,若使用本地存储,则带宽越大越好 |
||||
- 如果使用超级签,最低配置为2cpu 4G内存,若干不使用签名,则1cpu2G就行 |
||||
- 阿里云短信或极光短信服务【可选一个,主要用与注册,重置密码】 |
||||
- 阿里云短信 |
||||
- 极光短信 |
||||
- 邮箱服务【可选,用与注册,重置密码,通知信息】 |
||||
- 阿里云OSS存储【可选】 |
||||
- [sts授权配置](https://help.aliyun.com/document_detail/100624.html) |
||||
- 阿里云CDN【可选,用与加速访问】 |
||||
- 极验验证【可选,滑动验证服务】 |
||||
- 微信公众号【可选,用与微信扫描登录】 |
||||
- 阿里云支付【可选,用与购买下载次数】 |
||||
- 微信支付【可选,用与购买下载次数】 |
||||
|
||||
#### 自用搭建建议 |
||||
- 阿里云服务器需要1cpu 2G内存,无需系统盘,如果使用超级签,可以适当增加配置 |
||||
- 需要阿里云OSS存储和阿里云CDN,并且OSS存储和阿里云服务器部署同一个地区 |
||||
- 可以申请一个极验进行滑动验证,或者开启验证码验证 |
||||
- 阿里云备案域名:api和前端可以使用一个域名,下载页单独域名 |
||||
|
||||
#### 部署必备资料 |
||||
- 域名证书 |
||||
- web域名和证书 |
||||
- api域名和证书 |
||||
- 下载页域名(可配置证书) |
||||
- 存储域名和证书 |
||||
- 本地存储,则该域名和证书可以和api域名证书一致 |
||||
- 阿里云oss存储 |
||||
- 开启cdn,需要新域名和证书 |
||||
- 不开启,无需域名和证书 |
||||
- Centos8Stream 服务器 |
||||
|
||||
## 部署方式 |
||||
|
||||
### 1.[Docker 部署](./doc/docker.md) 【推荐】 |
||||
|
||||
### 2.[本地部署](./doc/local.md) |
||||
|
||||
### 功能预览 |
||||
![img_1.png](./doc/images/img_1.png) |
||||
![img_2.png](./doc/images/img_2.png) |
||||
![img_3.png](./doc/images/img_3.png) |
||||
![img_4.png](./doc/images/img_4.png) |
||||
![img_5.png](./doc/images/img_5.png) |
||||
![img_6.png](./doc/images/img_6.png) |
||||
![img_7.png](./doc/images/img_7.png) |
||||
![img_8.png](./doc/images/img_8.png) |
||||
![img_9.png](./doc/images/img_9.png) |
||||
![img_10.png](./doc/images/img_10.png) |
||||
![img_11.png](./doc/images/img_11.png) |
||||
##### 从git上面下载源码 |
||||
``` |
||||
cd /data/ |
||||
git clone https://github.com/nineaiyu/FlyApps |
||||
``` |
||||
|
||||
#### 超级签名依赖部署 |
||||
##### fastlane [相关文档](https://github.com/fastlane/fastlane/blob/master/spaceship/docs/DeveloperPortal.md) |
||||
``` |
||||
# fastlane |
||||
#1 gem ruby安装 |
||||
yum install gem -y |
||||
yum install ruby-devel -y |
||||
yum install gcc gcc-c++ -y |
||||
|
||||
#gem修改为国内镜像 |
||||
gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/ |
||||
|
||||
gem sources -l |
||||
#https://gems.ruby-china.com |
||||
#确保只有 gems.ruby-china.com |
||||
|
||||
#2 更新rubby |
||||
gpg2 --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB |
||||
|
||||
#如果脚本执行失败,可以这样 |
||||
# echo 199.232.68.133 raw.githubusercontent.com >> /etc/hosts |
||||
|
||||
curl -L get.rvm.io | bash -s stable |
||||
source /etc/profile.d/rvm.sh |
||||
rvm list known |
||||
rvm install 2.7 |
||||
|
||||
#3 安装fastlane |
||||
gem install fastlane |
||||
gem install pry |
||||
|
||||
# space 好像有点问题,需要把这个注释掉 |
||||
vim /usr/local/rvm/gems/ruby-2.7.0/gems/fastlane-2.146.1/spaceship/lib/spaceship/base.rb +298 |
||||
#v.gsub!("\n", "\n\t") # to align nested elements #注释掉,要不然会报错 |
||||
|
||||
``` |
||||
##### isign |
||||
``` |
||||
# python2.7 |
||||
yum update python -y |
||||
pip install -U setuptools pip |
||||
|
||||
wget https://github.com/nineaiyu/isign/archive/v1.8.0.tar.gz |
||||
tar xvf v1.8.0.tar.gz |
||||
cd isign-1.8.0/ |
||||
|
||||
python setup.py build |
||||
python setup.py install |
||||
``` |
||||
|
||||
### FlyApp 服务器搭建 [python3 环境] |
||||
|
||||
|
||||
##### 搭建python env 环境 |
||||
``` |
||||
yum install python36 python36-devel redis mariadb-server mariadb-devel -y |
||||
python3 -m venv py3 |
||||
source py3/bin/activate |
||||
``` |
||||
|
||||
###### 安装pip包 |
||||
``` |
||||
cd FlyApps/fir_ser/ |
||||
pip install -r requirements.txt |
||||
``` |
||||
|
||||
###### 配置数据库 |
||||
``` |
||||
在 settings.py 配置redis 和 mysql 数据库 |
||||
``` |
||||
|
||||
###### 迁移数据库 |
||||
``` |
||||
#如果是mysql,需要做一下配置,如果是sqlite,需要升级sqlite |
||||
#记得根据配置创建数据库 |
||||
#create database flyapp default character set utf8 COLLATE utf8_general_ci; |
||||
#grant all on flyapp.* to flyuser@'127.0.0.1' identified by 'flypwd00oo.1'; |
||||
|
||||
python manage.py makemigrations |
||||
python manage.py migrate |
||||
``` |
||||
|
||||
### FlyApp web端搭建 |
||||
###### npm编译环境 |
||||
``` |
||||
yum install npm |
||||
npm install -g n |
||||
n latest |
||||
npm install -g yarn |
||||
``` |
||||
|
||||
###### 编译web端 |
||||
``` |
||||
cd FlyApps/fir_client/ |
||||
vim src/restful/index.js #修改api接口地址 |
||||
|
||||
yarn install |
||||
yarn build |
||||
``` |
||||
|
||||
|
||||
###### 编译下载页面 |
||||
``` |
||||
cd FlyApps/fir_download/ |
||||
vim src/restful/download.js #修改api接口地址 |
||||
|
||||
yarn install |
||||
yarn build |
||||
``` |
||||
|
||||
###### web目录操作 |
||||
``` |
||||
# web目录: /www/wwwroot/fly.dvcloud.xin/ |
||||
|
||||
cd /www/wwwroot/fly.dvcloud.xin/ |
||||
cp -a /data/FlyApps/fir_client/dist/* . |
||||
cp -a /data/FlyApps/fir_download/dist/* . |
||||
``` |
||||
|
||||
##### 更新sqllite |
||||
``` |
||||
tar xvf sqlite-autoconf-3310100.tar.gz |
||||
cd sqlite-autoconf-3310100 |
||||
|
||||
./configure --prefix=/usr/local/sqlite |
||||
make -j4 |
||||
|
||||
make install |
||||
rm -rf /usr/bin/sqlite3 |
||||
|
||||
ln -s /usr/local/sqlite/bin/sqlite3 /usr/bin/sqlite3 |
||||
ll /usr/bin/sqlite3 |
||||
|
||||
|
||||
echo "/usr/local/sqlite/lib" > /etc/ld.so.conf.d/sqlite3.conf |
||||
ldconfig |
||||
|
||||
``` |
@ -0,0 +1,12 @@ |
||||
#!/bin/bash |
||||
# |
||||
# |
||||
# shellcheck disable=SC2006 |
||||
s_path=`pwd` |
||||
|
||||
#first build fir_client |
||||
docker pull node:14.17.3 |
||||
\cp -a build_client.sh fir_client/ |
||||
docker run --rm -v "${s_path}"/fir_client:/fir_client -it node:14.17.3 sh /fir_client/build_client.sh |
||||
|
||||
cd "${s_path}"/fir_ser/ && docker build . -t flyapps |
@ -0,0 +1,7 @@ |
||||
#!/bin/bash |
||||
# |
||||
# |
||||
|
||||
cd /fir_client/ && yarn config set registry https://registry.npm.taobao.org && yarn install && yarn build |
||||
|
||||
|
@ -1,102 +0,0 @@ |
||||
### Docker最小化部署前准备,如果使用超级签和云存储,需要使用阿里云的服务器 |
||||
系统|Centos 8 Stream 纯净系统 [2cpu 4G内存] |
||||
----|---- |
||||
域名|```app.hehelucky.cn``` |
||||
域名SSL证书| nginx 格式证书 [阿里云和腾讯云都可以申请免费ssl证书] |
||||
数据路径| ```/data``` |
||||
|
||||
|
||||
### 开始部署 |
||||
##### 1.从git上面下载源码 |
||||
``` |
||||
cd /data/ |
||||
dnf install git -y |
||||
git clone https://github.com/nineaiyu/flyapps |
||||
``` |
||||
|
||||
## 注意,下面展示的相对路径,都是以```/data/flyapps```为相对目录 |
||||
|
||||
#### 2.docker环境安装 |
||||
``` |
||||
cd /data/flyapps/docker/init |
||||
sh init.sh |
||||
``` |
||||
|
||||
#### 3.配置域名和证书,如果有cdn或者oss,也要进行配置 |
||||
a.将域名证书通过```sftp软件```或者```rz命令```复制到```/data/flyapps/nginx.conf.d```目录中 |
||||
|
||||
b.将域名证书分别重命名为 ```域名.pem``` 和 ```域名.key``` .本次使用的域名是 ```app.hehelucky.cn``` ,因此,证书名称类似如下 |
||||
```shell script |
||||
nginx.conf.d/app.hehelucky.cn.key |
||||
nginx.conf.d/app.hehelucky.cn.pem |
||||
``` |
||||
c.修改NGINX配置文件```nginx.conf.d/flyapps-vhost.conf```,将```server_name```字段修改为域名,将```ssl_certificate```和 |
||||
```ssl_certificate_key```修改为对应证书路径,修改之后,对应字段如下 |
||||
```shell |
||||
server_name app.hehelucky.cn; |
||||
ssl_certificate /etc/nginx/conf.d/app.hehelucky.cn.pem; |
||||
ssl_certificate_key /etc/nginx/conf.d/app.hehelucky.cn.key; |
||||
``` |
||||
|
||||
#### 4.配置api服务需要修改api和web域名,如果有需求,还可以配置 短信,邮箱,geetest,存储等信息 |
||||
##### fir_ser配置文件 ```fir_ser/config.py``` |
||||
```python |
||||
class DOMAINCONF(object): |
||||
API_DOMAIN = "https://app.hehelucky.cn" # 用与开启本地存储,上传应用配置 |
||||
WEB_DOMAIN = "https://app.hehelucky.cn" # 用于超级签跳转配置,该域名一般为前端页面域名 |
||||
``` |
||||
|
||||
##### fir_client配置文件 ```fir_client/vue.confjg.js``` |
||||
```javascript |
||||
const pro_base_env = { |
||||
baseUrl: '/', //该选项可以填写web-api的域名,类似 https://api.xxx.com/ |
||||
index_static: '/', //若配置cdn等加速,可以填写cdn加速域名 |
||||
baseShortUrl: '/', //该选项可以填写short-api的域名,也可以和web-api域名一样,类似 https://api.xxx.com/ |
||||
short_static: '/short/', //若配置cdn等加速,可以填写cdn加速域名 |
||||
version: version, |
||||
}; |
||||
``` |
||||
|
||||
##### 构建静态资源 |
||||
``` |
||||
cd /data/flyapps/docker/scripts |
||||
sh build.sh |
||||
``` |
||||
|
||||
##### 启动所有服务 |
||||
``` |
||||
cd /data/flyapps/docker/scripts |
||||
sh start_all.sh |
||||
``` |
||||
|
||||
##### 关闭所有服务 |
||||
``` |
||||
cd /data/flyapps/docker/scripts |
||||
sh stop_all.sh |
||||
``` |
||||
|
||||
##### 根据提示创建默认管理用户,用与访问管理后台 |
||||
```shell |
||||
docker exec -it flyapps python manage.py createsuperuser |
||||
``` |
||||
|
||||
##### 测试访问 |
||||
- 在浏览器输入自己配置的域名 https://app.hehelucky.cn/ 进行访问 |
||||
- 管理后台访问 https://app.hehelucky.cn:3448/ 进行访问 |
||||
|
||||
|
||||
##### 如果要使用本地的数据库和redis,api服务使用容器,需要修改文件```/data/flyapps/docker/flyapps/docker-compose.yml``` |
||||
```shell |
||||
external_links: |
||||
- mariadb:mariadb |
||||
- redis:redis |
||||
``` |
||||
修改为 |
||||
```shell |
||||
extra_hosts: |
||||
- "mariadb:172.31.31.1" |
||||
- "redis:172.31.31.1" |
||||
``` |
||||
并将```nginx:```下面的配置注释掉 |
||||
|
||||
同时还需要修改mariadb和redis授权 |
Before Width: | Height: | Size: 77 KiB |
Before Width: | Height: | Size: 77 KiB |
Before Width: | Height: | Size: 53 KiB |
Before Width: | Height: | Size: 54 KiB |
Before Width: | Height: | Size: 51 KiB |
Before Width: | Height: | Size: 52 KiB |
Before Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 70 KiB |
Before Width: | Height: | Size: 44 KiB |
Before Width: | Height: | Size: 57 KiB |
Before Width: | Height: | Size: 56 KiB |
@ -1,166 +0,0 @@ |
||||
### 本地部署前准备 |
||||
系统 | Centos 8 Stream [2cpu 4G内存] |
||||
----|---- |
||||
域名|```app.hehelucky.cn``` |
||||
域名SSL证书| nginx 格式证书 [阿里云和腾讯云都可以申请免费ssl证书] |
||||
数据路径| ```/data``` |
||||
|
||||
|
||||
##### 从git上面下载源码 |
||||
```shell |
||||
cd /data/ |
||||
dnf install git gcc zip unzip -y |
||||
git clone https://github.com/nineaiyu/flyapps |
||||
``` |
||||
|
||||
|
||||
### flyapps 本地部署 [python3 环境] |
||||
|
||||
##### 搭建python env 环境 |
||||
```shell |
||||
dnf install python39 python39-devel redis mariadb-server mariadb-devel -y |
||||
python3.9 -m venv py39 |
||||
source py39/bin/activate |
||||
``` |
||||
|
||||
###### 安装pip包 |
||||
```shell |
||||
cd /data/flyapps/fir_ser/ |
||||
pip install -U setuptools pip -i https://pypi.tuna.tsinghua.edu.cn/simple/ |
||||
pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple/ |
||||
``` |
||||
|
||||
#### 配置数据库 |
||||
##### 启动mariadb数据库 |
||||
```shell |
||||
systemctl restart mariadb |
||||
systemctl enable mariadb |
||||
``` |
||||
##### 创建mysql数据库 |
||||
```shell |
||||
mysql |
||||
``` |
||||
执行下面mysql命令 |
||||
```mariadb |
||||
create database flyapps default character set utf8 COLLATE utf8_general_ci; |
||||
grant all on flyapps.* to flyuser@'127.0.0.1' identified by 'KGzKjZpWBp4R4RSa'; |
||||
``` |
||||
##### 启动redis数据库 |
||||
```shell |
||||
echo 'requirepass nineven' >> /etc/redis.conf # 配置授权密码 |
||||
systemctl restart redis |
||||
systemctl enable redis |
||||
``` |
||||
|
||||
### flyapps zsign ipa重签名工具安装 |
||||
```shell |
||||
dnf install openssl-devel -y |
||||
dnf install gcc-c++ gcc -y |
||||
cd /data/flyapps/fir_ser/ |
||||
tar xvf zsign-1.1.2.tar.gz |
||||
cd zsign-1.1.2/ |
||||
g++ *.cpp common/*.cpp -lcrypto -O3 -std=c++11 -o /usr/bin/zsign |
||||
``` |
||||
|
||||
|
||||
#### 配置api服务需要修改api和web域名,如果有需求,还可以配置 短信,邮箱,geetest,存储等信息 |
||||
##### fir_ser配置文件 ```fir_ser/config.py``` |
||||
```python |
||||
class DOMAINCONF(object): |
||||
API_DOMAIN = "https://app.hehelucky.cn" # 用与开启本地存储,上传应用配置 |
||||
WEB_DOMAIN = "https://app.hehelucky.cn" # 用于超级签跳转配置,该域名一般为前端页面域名 |
||||
``` |
||||
|
||||
##### fir_client配置文件 ```fir_client/vue.confjg.js``` |
||||
```javascript |
||||
const pro_base_env = { |
||||
baseUrl: '/', //该选项可以填写web-api的域名,类似 https://api.xxx.com/ |
||||
index_static: '/', //若配置cdn等加速,可以填写cdn加速域名 |
||||
baseShortUrl: '/', //该选项可以填写short-api的域名,也可以和web-api域名一样,类似 https://api.xxx.com/ |
||||
short_static: '/short/', //若配置cdn等加速,可以填写cdn加速域名 |
||||
version: version, |
||||
}; |
||||
``` |
||||
|
||||
### flyapps web端搭建 |
||||
###### npm编译环境 |
||||
```shell |
||||
dnf install npm -y |
||||
npm install -g n |
||||
n 12.13 # 安装12版本的node或者14版本 ,最新版本会有问题 |
||||
npm install -g yarn |
||||
``` |
||||
|
||||
|
||||
|
||||
###### 编译web端和下载页 |
||||
```shell |
||||
cd /data/flyapps/fir_client/ |
||||
vim vue.config.js #修改api接口地址 |
||||
# pro_base_env 正式环境信息 |
||||
# dev_base_env 开发环境信息 |
||||
|
||||
yarn install |
||||
yarn build index # 前端打包,输出目录 dist_index |
||||
yarn build short # 下载页打包,输出目录 dist_short |
||||
``` |
||||
|
||||
###### 编译web管理后台 |
||||
```shell |
||||
cd /data/flyapps/fir_admin/ |
||||
yarn install |
||||
yarn build:prod # 下载页打包,输出目录 dist |
||||
``` |
||||
|
||||
### nginx配置 |
||||
##### 安装nginx |
||||
```shell |
||||
dnf install nginx -y |
||||
``` |
||||
##### 将域名ssl证书解压到```/etc/nginx/conf.d/``` 目录中,并重命名为```域名.pem```,```域名.key```格式 |
||||
##### 拷贝虚拟主机配置文件 |
||||
```shell |
||||
cp /data/flyapps/nginx.conf.d/flyapps-vhost.conf /etc/nginx/conf.d/ |
||||
``` |
||||
1.创建web目录,并将打包好的web复制该目录 |
||||
```shell |
||||
mkdir -pv /data/{fir_client/short,fir_admin} |
||||
cp -a /data/flyapps/fir_client/dist_index/* /data/fir_client/ |
||||
cp -a /data/flyapps/fir_client/dist_short/* /data/fir_client/short/ |
||||
cp -a /data/flyapps/fir_admin/dist/* /data/fir_admin/ |
||||
chown nginx.nginx -R /data/{fir_client,fir_admin} |
||||
``` |
||||
2.启动nginx服务 |
||||
```shell |
||||
nginx -t |
||||
systemctl restart nginx |
||||
systemctl enable nginx |
||||
``` |
||||
|
||||
##### 添加redis和mariadb uwsgi本地解析 |
||||
```shell |
||||
echo '127.0.0.1 mariadb redis flyapps' >> /etc/hosts |
||||
``` |
||||
|
||||
###### 迁移数据库 |
||||
```shell |
||||
cd /data/flyapps/fir_ser/ |
||||
python manage.py makemigrations |
||||
python manage.py migrate |
||||
``` |
||||
|
||||
#### 启动api服务 |
||||
```shell |
||||
echo 'net.core.somaxconn=1024' >> /etc/sysctl.conf |
||||
sysctl -p |
||||
cd /data/flyapps/fir_ser/ |
||||
python manage.py start all -u nginx -usm 1 -d |
||||
``` |
||||
|
||||
##### 根据提示创建默认管理用户,用与访问管理后台 |
||||
```shell |
||||
python manage.py createsuperuser |
||||
``` |
||||
- 需要输入用户名,邮箱和密码 |
||||
- 用户名和密码用与登录管理后台 |
||||
- 邮箱和密码用与登录前端web |
@ -0,0 +1,51 @@ |
||||
##### 从git上面下载源码 |
||||
``` |
||||
cd /data/ |
||||
git clone https://github.com/nineaiyu/FlyApps |
||||
``` |
||||
|
||||
#### docker环境安装 [centos7] |
||||
``` |
||||
yum install epel-release -y |
||||
yum clean all && yum makecache |
||||
yum install docker -y |
||||
|
||||
``` |
||||
#### 配置域名和证书,如果有cdn或者oss,也要进行配置 |
||||
```shell script |
||||
nginx.conf.d/app.hehelucky.cn.key |
||||
nginx.conf.d/app.hehelucky.cn.pem |
||||
nginx.conf.d/flyapps-vhost.conf |
||||
``` |
||||
### api服务需要修改api和web域名,短信,邮箱,geetest,存储等信息 |
||||
```shell script |
||||
vim fir_ser/config.py |
||||
|
||||
API_DOMAIN = "https://app.hehelucky.cn" |
||||
WEB_DOMAIN = "https://app.hehelucky.cn" |
||||
MOBILEPROVISION = "https://ali-static.jappstore.com/embedded.mobileprovision" |
||||
|
||||
``` |
||||
### web页面需要修改指定api域名 |
||||
```vuejs |
||||
vim fir_client/vue.config.js |
||||
|
||||
const pro_base_env = { |
||||
baseUrl: 'https://flyapps.cn', |
||||
index_static: 'https://static.flyapps.cn/index/', |
||||
baseShortUrl: 'https://flyapps.top', |
||||
short_static: 'https://static.flyapps.top/short/', |
||||
}; |
||||
``` |
||||
|
||||
##### 构建静态资源和api服务 |
||||
``` |
||||
sh build.sh |
||||
``` |
||||
|
||||
|
||||
##### 启动所有服务 |
||||
``` |
||||
sh start.sh |
||||
``` |
||||
|
@ -1,67 +0,0 @@ |
||||
version: '3.2' |
||||
|
||||
services: |
||||
buildflyapps: |
||||
image: 'flyapps' |
||||
build: |
||||
context: ../../fir_ser |
||||
dockerfile: Dockerfile |
||||
command: |
||||
- echo |
||||
- success |
||||
|
||||
buildclient: |
||||
container_name: buildclient |
||||
image: 'node:14.17.3' |
||||
working_dir: /fir_client |
||||
volumes: |
||||
- /etc/localtime:/etc/localtime:ro |
||||
- ../../fir_client:/fir_client |
||||
- ../../data/web/:/web |
||||
command: |
||||
- bash |
||||
- -c |
||||
- yarn config set registry https://registry.npm.taobao.org && yarn install && yarn build index && yarn build short && ([ ! -e /web/fir_client ] && \cp -a dist_index /web/fir_client || \cp -a dist_index/* /web/fir_client/) && ([ ! -e /web/fir_client/short ] && \cp -a dist_short /web/fir_client/short || \cp -a dist_short/* /web/fir_client/short/) && echo build success |
||||
|
||||
buildindex: |
||||
container_name: buildindex |
||||
image: 'node:14.17.3' |
||||
working_dir: /fir_client |
||||
volumes: |
||||
- /etc/localtime:/etc/localtime:ro |
||||
- ../../fir_client:/fir_client |
||||
- ../../data/web/:/web |
||||
command: |
||||
- bash |
||||
- -c |
||||
- yarn config set registry https://registry.npm.taobao.org && yarn install && yarn build index && ([ ! -e /web/fir_index ] && \cp -a dist_index /web/fir_index || \cp -a dist_index/* /web/fir_index/) && echo build success |
||||
|
||||
|
||||
|
||||
buildshort: |
||||
container_name: buildshort |
||||
image: 'node:14.17.3' |
||||
working_dir: /fir_client |
||||
volumes: |
||||
- /etc/localtime:/etc/localtime:ro |
||||
- ../../fir_client:/fir_client |
||||
- ../../data/web/:/web |
||||
command: |
||||
- sh |
||||
- -c |
||||
- yarn config set registry https://registry.npm.taobao.org && yarn install && yarn build short && ([ ! -e /web/fir_short ] && \cp -a dist_short /web/fir_short || \cp -a dist_short/* /web/fir_short/) && echo build success |
||||
|
||||
|
||||
buildadmin: |
||||
container_name: buildadmin |
||||
image: 'node:14.17.3' |
||||
working_dir: /fir_admin |
||||
volumes: |
||||
- /etc/localtime:/etc/localtime:ro |
||||
- ../../fir_admin:/fir_admin |
||||
- ../../data/web/:/web |
||||
command: |
||||
- sh |
||||
- -c |
||||
- yarn config set registry https://registry.npm.taobao.org && yarn install && yarn build:prod && ([ ! -e /web/fir_admin ] && \cp -a dist /web/fir_admin || \cp -a dist/* /web/fir_admin/) && echo build success |
||||
|
@ -1,31 +0,0 @@ |
||||
version: '3' |
||||
|
||||
networks: |
||||
flyapps: |
||||
external: true |
||||
name: flyapps |
||||
|
||||
services: |
||||
flyapps: |
||||
container_name: flyapps |
||||
restart: always |
||||
image: 'nineven/flyapps' |
||||
working_dir: /data/fir_ser |
||||
volumes: |
||||
- /etc/localtime:/etc/localtime:ro |
||||
- ../../fir_ser:/data/fir_ser |
||||
- ../../data/flyapps/files:/data/fir_ser/files |
||||
- ../../data/logs/flyapps/:/data/fir_ser/logs |
||||
- ../../data/flyapps/supersign/:/data/fir_ser/supersign |
||||
- ../../nginx.conf.d:/data/cert |
||||
networks: |
||||
flyapps: |
||||
ipv4_address: 172.31.31.100 |
||||
external_links: |
||||
- mariadb:mariadb |
||||
- redis:redis |
||||
sysctls: |
||||
- net.core.somaxconn=4096 |
||||
extra_hosts: |
||||
- "mariadb:172.31.31.1" |
||||
- "redis:172.31.31.1" |
@ -1,48 +0,0 @@ |
||||
version: '3' |
||||
|
||||
networks: |
||||
flyapps: |
||||
external: true |
||||
name: flyapps |
||||
|
||||
services: |
||||
flyapps: |
||||
container_name: flyapps |
||||
restart: always |
||||
image: 'nineven/flyapps' |
||||
working_dir: /data/fir_ser |
||||
volumes: |
||||
- /etc/localtime:/etc/localtime:ro |
||||
- ../../fir_ser:/data/fir_ser |
||||
- ../../data/flyapps/files:/data/fir_ser/files |
||||
- ../../data/logs/flyapps/:/data/fir_ser/logs |
||||
- ../../data/flyapps/supersign/:/data/fir_ser/supersign |
||||
- ../../nginx.conf.d:/data/cert |
||||
networks: |
||||
flyapps: |
||||
ipv4_address: 172.31.31.100 |
||||
external_links: |
||||
- mariadb:mariadb |
||||
- redis:redis |
||||
sysctls: |
||||
- net.core.somaxconn=4096 |
||||
nginx: |
||||
container_name: nginx |
||||
restart: always |
||||
image: 'nginx:1.21.3' |
||||
volumes: |
||||
- /etc/localtime:/etc/localtime:ro |
||||
- ../../data/web:/data |
||||
- ../../nginx.conf.d:/etc/nginx/conf.d |
||||
- ../../data/logs/nginx:/var/log/nginx |
||||
networks: |
||||
flyapps: |
||||
ipv4_address: 172.31.31.200 |
||||
ports: |
||||
- 80:80 |
||||
- 443:443 |
||||
- 3448:3448 |
||||
external_links: |
||||
- flyapps:flyapps |
||||
depends_on: |
||||
- flyapps |
@ -1,7 +0,0 @@ |
||||
#!/bin/bash |
||||
# |
||||
# |
||||
|
||||
for i in nginx flyapps mariadb redis buildclient buildshort buildadmin ;do echo $i;docker rm -f $i;done |
||||
|
||||
docker network rm flyapps |
@ -1,10 +0,0 @@ |
||||
#!/bin/bash |
||||
# |
||||
# |
||||
|
||||
|
||||
docker pull 'bitnami/mariadb:10.7.3' |
||||
docker pull 'bitnami/redis:6.2.7' |
||||
docker pull 'nginx:1.21.3' |
||||
docker pull 'nineven/flyapps:latest' |
||||
docker pull 'node:14.17.3' |
@ -1,24 +0,0 @@ |
||||
#!/bin/bash |
||||
# |
||||
# |
||||
|
||||
which dockerd |
||||
if [ $? -ne 0 ];then |
||||
dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo |
||||
dnf install docker-ce -y |
||||
fi |
||||
#which docker-compose |
||||
#if [ $? -ne 0 ];then |
||||
# curl -L https://get.daocloud.io/docker/compose/releases/download/v2.5.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose |
||||
# chmod +x /usr/local/bin/docker-compose |
||||
#fi |
||||
|
||||
data_path="$(dirname $(dirname `pwd`))/data" |
||||
mkdir -pv ${data_path}/{flyapps/files,web,mariadb,redis,logs/{mariadb,nginx,flyapps}} |
||||
\cp $(dirname $(dirname `pwd`))/fir_ser/files/head_img.jpeg ${data_path}/flyapps/files/ |
||||
chown 1001.1001 -R ${data_path}/{flyapps,web,mariadb,redis,logs/{mariadb,nginx,flyapps}} |
||||
chown 101.101 -R ${data_path}/{flyapps,logs/flyapps} |
||||
systemctl start docker && docker network create flyapps --driver bridge --subnet=172.31.31.0/24 --gateway=172.31.31.1 |
||||
systemctl enable docker |
||||
systemctl status docker |
||||
|
@ -1 +0,0 @@ |
||||
Asia/Shanghai |
@ -1,43 +0,0 @@ |
||||
version: '3.2' |
||||
|
||||
|
||||
|
||||
networks: |
||||
flyapps: |
||||
external: true |
||||
name: flyapps |
||||
|
||||
services: |
||||
|
||||
mariadb: |
||||
image: bitnami/mariadb:10.7.3 |
||||
container_name: mariadb |
||||
restart: always |
||||
environment: |
||||
- MARIADB_ROOT_PASSWORD=rootIPD.xx2.19 |
||||
- MARIADB_DATABASE=flyapps |
||||
- MARIADB_USER=flyuser |
||||
- MARIADB_PASSWORD=KGzKjZpWBp4R4RSa |
||||
#- ALLOW_EMPTY_PASSWORD=yes |
||||
- MARIADB_ENABLE_SLOW_QUERY=1 |
||||
- MARIADB_LONG_QUERY_TIME=3 |
||||
- MARIADB_SKIP_TEST_DB=yes |
||||
- MARIADB_EXTRA_FLAGS=--max-connect-errors=3000 --max_connections=30000 |
||||
ports: |
||||
- 3306:3306 |
||||
networks: |
||||
flyapps: |
||||
ipv4_address: 172.31.31.90 |
||||
volumes: |
||||
- ../init/timezone:/etc/timezone:ro |
||||
- /etc/localtime:/etc/localtime:ro |
||||
- ../../data/mariadb:/bitnami/mariadb/data |
||||
- ../../data/logs/mariadb:/data/logs/mariadb |
||||
- ./server.cnf:/opt/bitnami/mariadb/conf/my_custom.cnf:ro |
||||
|
||||
# adminer: |
||||
# image: adminer |
||||
# ports: |
||||
# - 8080:8080 |
||||
# networks: |
||||
# - fungame |
@ -1,108 +0,0 @@ |
||||
# |
||||
# These groups are read by MariaDB server. |
||||
# Use it for options that only the server (but not clients) should see |
||||
# |
||||
# See the examples of server my.cnf files in /usr/share/mysql/ |
||||
# |
||||
|
||||
|
||||
# this is only for the mysqld standalone daemon |
||||
[mysqld] |
||||
binlog_cache_size = 192K |
||||
thread_stack = 384K |
||||
join_buffer_size = 4096K |
||||
query_cache_type = 1 |
||||
max_heap_table_size = 1024M |
||||
|
||||
default_storage_engine = InnoDB |
||||
performance_schema_max_table_instances = 400 |
||||
table_definition_cache = 400 |
||||
skip-external-locking |
||||
key_buffer_size = 512M |
||||
max_allowed_packet = 1G |
||||
table_open_cache = 1024 |
||||
sort_buffer_size = 2048K |
||||
net_buffer_length = 4K |
||||
read_buffer_size = 2048K |
||||
read_rnd_buffer_size = 1024K |
||||
myisam_sort_buffer_size = 16M |
||||
thread_cache_size = 192 |
||||
query_cache_size = 256M |
||||
tmp_table_size = 1024M |
||||
sql-mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES |
||||
|
||||
|
||||
max_connections = 30000 |
||||
max_connect_errors = 1000 |
||||
open_files_limit = 65535 |
||||
|
||||
expire_logs_days = 10 |
||||
#log_queries_not_using_indexes=on |
||||
|
||||
character-set-client-handshake = FALSE |
||||
character-set-server = utf8mb4 |
||||
collation-server = utf8mb4_general_ci |
||||
init_connect='SET NAMES utf8mb4' |
||||
#character-set-server=utf8 |
||||
skip_name_resolve |
||||
event_scheduler=1 |
||||
#skip-grant-tables |
||||
|
||||
|
||||
#innodb_data_home_dir = /var/lib/mysql/ |
||||
#innodb_data_file_path = ibdata1:10M:autoextend |
||||
#innodb_log_group_home_dir = /var/lib/mysql/ |
||||
#innodb_buffer_pool_size = 1024M |
||||
#innodb_log_file_size = 128M |
||||
#innodb_log_buffer_size = 32M |
||||
#innodb_flush_log_at_trx_commit = 1 |
||||
#innodb_lock_wait_timeout = 50 |
||||
#innodb_max_dirty_pages_pct = 90 |
||||
#innodb_read_io_threads = 4 |
||||
#innodb_write_io_threads = 4 |
||||
|
||||
|
||||
|
||||
# |
||||
# Allow server to accept connections on all interfaces. |
||||
# |
||||
#bind-address=0.0.0.0 |
||||
# |
||||
# this is only for embedded server |
||||
# This group is only read by MariaDB servers, not by MySQL. |
||||
# If you use the same .cnf file for MySQL and MariaDB, |
||||
# you can put MariaDB-only options here |
||||
[mariadb] |
||||
#autoset_open_files_limit |
||||
#enable_slow_query_log |
||||
|
||||
#audit |
||||
plugin_load_add=server_audit |
||||
server_audit_logging=on |
||||
server_audit_events=connect,query |
||||
server_audit=force_plus_permanent |
||||
server_audit_events=QUERY_DDL,QUERY_DML,CONNECT |
||||
server_audit_output_type=file |
||||
server_audit_file_rotate_now=on |
||||
server_audit_file_rotations=9 |
||||
server_audit_file_rotate_size=1G |
||||
server_audit_file_path=/data/logs/mariadb |
||||
|
||||
|
||||
log_error=/data/logs/mariadb/mariadb.err.log |
||||
|
||||
log_output=FILE |
||||
slow_query_log |
||||
long_query_time=3 |
||||
slow_query_log_file=/data/logs/mariadb/mariadb-slow.log |
||||
log_queries_not_using_indexes=ON #Logging Queries That Don't Use Indexes |
||||
|
||||
|
||||
|
||||
#server_id=2 |
||||
log-bin=/data/logs/mariadb/mysql-bin |
||||
|
||||
# This group is only read by MariaDB-10.5 servers. |
||||
# If you use the same .cnf file for MariaDB of different versions, |
||||
# use this group for options that older servers don't understand |
||||
|
@ -1,25 +0,0 @@ |
||||
version: '3.2' |
||||
|
||||
|
||||
networks: |
||||
flyapps: |
||||
external: true |
||||
name: flyapps |
||||
|
||||
services: |
||||
redis: |
||||
image: 'bitnami/redis:6.2.7' |
||||
container_name: redis |
||||
restart: always |
||||
volumes: |
||||
- ../init/timezone:/etc/timezone:ro |
||||
- /etc/localtime:/etc/localtime:ro |
||||
- ../../data/redis:/bitnami/redis/data |
||||
environment: |
||||
#- REDIS_REPLICATION_MODE=master |
||||
#- ALLOW_EMPTY_PASSWORD=yes |
||||
- REDIS_PASSWORD=nineven |
||||
networks: |
||||
- flyapps |
||||
#ports: |
||||
# - 6379:6379 |
@ -1,6 +0,0 @@ |
||||
#!/bin/bash |
||||
# |
||||
# |
||||
|
||||
cd ../build/ |
||||
docker compose up buildclient buildadmin |
@ -1,9 +0,0 @@ |
||||
#!/bin/bash |
||||
# |
||||
# |
||||
|
||||
cd ../mariadb/ && docker compose up -d |
||||
cd ../redis/ && docker compose up -d |
||||
|
||||
cd ../flyapps/ && docker compose up -d |
||||
docker logs -f flyapps |
@ -1,10 +0,0 @@ |
||||
#!/bin/bash |
||||
# |
||||
# |
||||
|
||||
|
||||
cd ../flyapps/ && docker compose down |
||||
|
||||
cd ../redis/ && docker compose down |
||||
|
||||
cd ../mariadb/ && docker compose down |
Before Width: | Height: | Size: 71 KiB |
After Width: | Height: | Size: 22 KiB |
@ -1,470 +0,0 @@ |
||||
<template> |
||||
<el-main> |
||||
|
||||
<el-dialog |
||||
:close-on-click-modal="false" |
||||
:close-on-press-escape="false" |
||||
:visible.sync="configVisible" |
||||
center |
||||
title="下载页部署配置" |
||||
width="666px"> |
||||
|
||||
|
||||
<el-card v-for="info in config_lists" :key="info.key" class="box-card" shadow="hover" |
||||
style="margin-bottom: 20px"> |
||||
<div slot="header" class="clearfix"> |
||||
<span><el-tag size="medium" type="info">配置KEY</el-tag> <el-tag size="medium">{{ info.key }}</el-tag></span> |
||||
<div style="float: right"> |
||||
<el-switch |
||||
v-model="info.value" |
||||
active-color="#13ce66" |
||||
active-text="启用" |
||||
active-value="true" |
||||
inactive-color="#ff4949" |
||||
inactive-text="关闭" |
||||
inactive-value="false" |
||||
@change="changeConfig(info)"> |
||||
</el-switch> |
||||
</div> |
||||
</div> |
||||
<el-tag size="medium" type="info">描述信息</el-tag> |
||||
{{ info.title }} |
||||
</el-card> |
||||
<el-divider></el-divider> |
||||
<el-card style="margin-top: 20px"> |
||||
<div slot="header" class="clearfix"> |
||||
<el-tag size="medium" type="success">下载页源码及操作文档</el-tag> |
||||
</div> |
||||
<div v-if="short_download_list.length>0"> |
||||
<div style="margin: 10px" v-for="short_download_uri in short_download_list" :key="short_download_uri.key"> |
||||
<el-tag size="medium" type="info">{{short_download_uri.title}}</el-tag> |
||||
<el-link style="margin-left: 10px" :href="short_download_uri.value" target="_blank">点击下载</el-link> |
||||
</div> |
||||
</div> |
||||
</el-card> |
||||
|
||||
<div slot="footer" class="dialog-footer"> |
||||
<el-button @click="updateConfig">恢复默认值</el-button> |
||||
<el-button @click="configVisible=false">取消</el-button> |
||||
</div> |
||||
|
||||
</el-dialog> |
||||
|
||||
<el-dialog |
||||
:close-on-click-modal="false" |
||||
:close-on-press-escape="false" |
||||
:visible.sync="addCnameVisible" |
||||
center |
||||
title="添加下载页服务器域名" |
||||
width="800px"> |
||||
|
||||
<el-steps :active="p_active" finish-status="success" :align-center="true"> |
||||
<el-step title="添加服务器域名"></el-step> |
||||
<el-step title="验证服务器域名所有权"></el-step> |
||||
<el-step title="添加成功"></el-step> |
||||
</el-steps> |
||||
|
||||
<el-container> |
||||
|
||||
<div v-if="p_active===0" style="margin-top: 20px"> |
||||
<el-tag style="margin: 10px 5px">1.如果是cdn等含有CNAME,直接添加cdn的 CNAME 值</el-tag> |
||||
<el-tag style="margin: 10px 5px">2.如果是服务器,需要将域名解析到服务器,然后添加该解析的域名</el-tag> |
||||
<div style="width: 600px;text-align: center;margin: auto"> |
||||
|
||||
<el-form ref="form" :model="addSerInfo" label-width="120px"> |
||||
|
||||
<el-form-item label="下载服务器域名"> |
||||
<el-input v-model="addSerInfo.domain_record" placeholder="cdn的cname或者服务器的域名,必填"></el-input> |
||||
</el-form-item> |
||||
|
||||
<el-form-item label="下载服务器地址"> |
||||
<el-input v-model="addSerInfo.ip_address" placeholder="如果有服务器地址,添加服务器ip,否则填写服务器域名"></el-input> |
||||
</el-form-item> |
||||
<el-form-item label="备注"> |
||||
<el-input type="textarea" v-model="addSerInfo.description"></el-input> |
||||
</el-form-item> |
||||
</el-form> |
||||
<div style="margin-top: 20px;"> |
||||
<el-button type="primary" @click="addCnameSer">下一步</el-button> |
||||
</div> |
||||
</div> |
||||
|
||||
</div> |
||||
|
||||
<div v-else-if="p_active===1" style="margin-top: 30px;text-align: center"> |
||||
|
||||
请联系域名管理员,前往 <strong>{{ cnameInfo.domain_record }}</strong> 域名 DNS 管理后台添加如下 {{ cnameInfo.r_type }} 记录。 |
||||
<el-table |
||||
:data="domain_tData" |
||||
border |
||||
stripe |
||||
v-loading="loading" |
||||
style="width: 100%;margin-top: 20px"> |
||||
<el-table-column |
||||
align="center" |
||||
label="记录类型" |
||||
prop="r_type" |
||||
width="100"> |
||||
</el-table-column> |
||||
<el-table-column |
||||
align="center" |
||||
label="主机记录" |
||||
prop="host_r" |
||||
> |
||||
<template slot-scope="scope"> |
||||
<el-tooltip content="点击复制到剪贴板"> |
||||
<el-link v-if="scope.row.host_r" v-clipboard:copy="scope.row.host_r" |
||||
v-clipboard:success="copy_success" |
||||
:underline="false">{{ scope.row.host_r }} |
||||
</el-link> |
||||
</el-tooltip> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column |
||||
align="center" |
||||
label="记录值" |
||||
prop="cname_r" |
||||
width="300"> |
||||
<template slot-scope="scope"> |
||||
<el-tooltip content="点击复制到剪贴板"> |
||||
<el-link v-if="scope.row.cname_r" v-clipboard:copy="scope.row.cname_r" |
||||
v-clipboard:success="copy_success" |
||||
:underline="false">{{ scope.row.cname_r }} |
||||
</el-link> |
||||
</el-tooltip> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<el-alert :closable="false" |
||||
show-icon |
||||
style="margin-top: 30px" |
||||
title="请在域名DNS配置成功后,点击“下一步”按钮" |
||||
type="warning"/> |
||||
|
||||
<div style="margin-top: 20px;text-align: center;"> |
||||
<el-button type="primary" @click="p_active=0">上一步</el-button> |
||||
<el-button type="primary" @click="checkCnameSer" :disabled="loading">下一步</el-button> |
||||
</div> |
||||
</div> |
||||
</el-container> |
||||
|
||||
|
||||
</el-dialog> |
||||
|
||||
|
||||
<div> |
||||
<el-input |
||||
v-model="search_key" |
||||
clearable |
||||
placeholder="输入下载服务器域名" |
||||
style="width: 30%;margin-right: 30px;margin-bottom: 5px"/> |
||||
<el-button icon="el-icon-search" type="primary" @click="handleCurrentChange(1)"> |
||||
搜索 |
||||
</el-button> |
||||
<div style="float: right"> |
||||
|
||||
|
||||
<el-tooltip content="下载页配置,可以定制部署私有下载页"> |
||||
<el-button plain type="primary" @click="configFun"> |
||||
下载页配置 |
||||
</el-button> |
||||
</el-tooltip> |
||||
<el-button plain type="primary" @click="addDownloadSer"> |
||||
添加下载页服务器 |
||||
</el-button> |
||||
</div> |
||||
|
||||
<el-table |
||||
v-loading="loading" |
||||
:data="cname_info_list" |
||||
border |
||||
stripe |
||||
style="width: 100%"> |
||||
|
||||
<el-table-column |
||||
align="center" |
||||
fixed |
||||
label="下载服务器域名" |
||||
prop="domain_name"> |
||||
<template slot-scope="scope"> |
||||
<el-tooltip content="点击复制到剪贴板"> |
||||
<el-link v-if="scope.row.domain_record" v-clipboard:copy="scope.row.domain_record" |
||||
v-clipboard:success="copy_success" |
||||
:underline="false">{{ scope.row.domain_record }} |
||||
</el-link> |
||||
</el-tooltip> |
||||
</template> |
||||
</el-table-column> |
||||
|
||||
<el-table-column |
||||
align="center" |
||||
label="下载服务器地址" |
||||
prop="ip_address"> |
||||
</el-table-column> |
||||
|
||||
<el-table-column |
||||
align="center" |
||||
label="状态" |
||||
prop="is_enable" |
||||
width="110"> |
||||
|
||||
<template slot-scope="scope"> |
||||
<el-tooltip v-if="scope.row.is_enable === true" content="已经绑定成功" placement="left-start"> |
||||
<el-button size="small" type="success">成功 |
||||
</el-button> |
||||
</el-tooltip> |
||||
<el-tooltip v-else content="点击激活服务器域名绑定信息" placement="left-start"> |
||||
<el-button size="small" type="warning" @click="continueBind(scope.row)">继续绑定 |
||||
</el-button> |
||||
</el-tooltip> |
||||
|
||||
</template> |
||||
|
||||
</el-table-column> |
||||
|
||||
<el-table-column |
||||
:formatter="format_create_time" |
||||
align="center" |
||||
label="域名绑定时间" |
||||
prop="created_time" |
||||
width="170" |
||||
> |
||||
</el-table-column> |
||||
<el-table-column |
||||
align="center" |
||||
label="备注" |
||||
prop="description"> |
||||
</el-table-column> |
||||
<el-table-column |
||||
align="center" |
||||
label="操作" |
||||
prop="is_enable" |
||||
width="100"> |
||||
|
||||
<template slot-scope="scope"> |
||||
<el-tooltip content="删除该下载页服务器" placement="left-start"> |
||||
<el-button size="small" type="danger" @click="delCnameSer(scope.row)">删除 |
||||
</el-button> |
||||
</el-tooltip> |
||||
|
||||
</template> |
||||
|
||||
</el-table-column> |
||||
</el-table> |
||||
|
||||
|
||||
</div> |
||||
<div style="margin-top: 20px;margin-bottom: 20px"> |
||||
<el-pagination |
||||
:current-page.sync="pagination.currentPage" |
||||
:page-size="pagination.pagesize" |
||||
:page-sizes="[10, 20, 50, 100]" |
||||
:total="pagination.total" |
||||
layout="total,sizes, prev, pager, next" |
||||
@size-change="handleSizeChange" |
||||
@current-change="handleCurrentChange"> |
||||
</el-pagination> |
||||
</div> |
||||
</el-main> |
||||
</template> |
||||
|
||||
<script> |
||||
|
||||
import {dCnameInfoFun, personalConfigInfo} from "@/restful"; |
||||
import {getUserInfoFun} from '@/utils' |
||||
import {format_time} from "@/utils/base/utils"; |
||||
|
||||
export default { |
||||
name: "FirUserDomain", |
||||
data() { |
||||
return { |
||||
addSerInfo: {}, |
||||
cnameInfo: {}, |
||||
domain_tData: [], |
||||
p_active: 0, |
||||
cname_info_list: [], |
||||
search_key: "", |
||||
pagination: {"currentPage": 1, "total": 0, "pagesize": 10}, |
||||
loading: false, |
||||
configVisible: false, |
||||
addCnameVisible: false, |
||||
config_lists: [], |
||||
short_download_list: [] |
||||
} |
||||
}, |
||||
methods: { |
||||
continueBind(cname_info) { |
||||
this.addSerInfo = cname_info |
||||
this.addCnameVisible = true |
||||
this.addCnameSer() |
||||
}, |
||||
delCnameSer(cname_info) { |
||||
this.$confirm('若下载域名绑定到该解析,同时也会删除绑定的下载域名,是否继续删除?', '警告', { |
||||
confirmButtonText: '确定', |
||||
cancelButtonText: '取消', |
||||
type: 'warning' |
||||
}).then(() => { |
||||
dCnameInfoFun(data => { |
||||
if (data.code === 1000) { |
||||
this.$message.success("删除成功") |
||||
this.get_data_from_tabname(); |
||||
} else { |
||||
this.$message.error("操作失败了 " + data.msg) |
||||
} |
||||
}, { |
||||
methods: 'DELETE', |
||||
data: {'domain_record': cname_info.domain_record} |
||||
}) |
||||
}) |
||||
}, |
||||
checkCnameSer() { |
||||
this.loading=true |
||||
dCnameInfoFun(data => { |
||||
this.loading=false |
||||
if (data.code === 1000) { |
||||
this.$message.success(this.addSerInfo.domain_record + " 添加成功") |
||||
this.get_data_from_tabname(); |
||||
this.addDownloadSer() |
||||
this.addCnameVisible = false |
||||
} else { |
||||
this.$message.error("操作失败了 " + data.msg) |
||||
} |
||||
}, { |
||||
methods: 'PUT', |
||||
data: {'act': 'check', 'domain_record': this.addSerInfo.domain_record} |
||||
}) |
||||
}, |
||||
addCnameSer() { |
||||
let domain_record = this.addSerInfo.domain_record |
||||
let ip_address = this.addSerInfo.ip_address |
||||
if (domain_record && domain_record.length > 6 && ip_address && ip_address.length > 6) { |
||||
dCnameInfoFun(data => { |
||||
if (data.code === 1000) { |
||||
this.p_active = 1 |
||||
this.cnameInfo = data.data |
||||
this.domain_tData = [this.cnameInfo] |
||||
} else { |
||||
this.$message.error("操作失败了 " + data.msg) |
||||
} |
||||
}, { |
||||
methods: 'POST', |
||||
data: this.addSerInfo |
||||
}) |
||||
} else { |
||||
this.$message.error("参数有误") |
||||
} |
||||
|
||||
}, |
||||
addDownloadSer() { |
||||
this.addSerInfo = {} |
||||
this.cnameInfo = {} |
||||
this.p_active = 0 |
||||
this.addCnameVisible = true |
||||
}, |
||||
configFun() { |
||||
personalConfigInfo(data => { |
||||
if (data.code === 1000) { |
||||
this.short_download_list = data.data |
||||
} else { |
||||
this.$message.error("获取数据失败了 " + data.msg) |
||||
} |
||||
}, { |
||||
methods: 'GET' |
||||
}, 'short_download_uri') |
||||
|
||||
|
||||
personalConfigInfo(data => { |
||||
if (data.code === 1000) { |
||||
this.config_lists = data.data |
||||
this.configVisible = true |
||||
} else { |
||||
this.$message.error("获取数据失败了 " + data.msg) |
||||
} |
||||
}, { |
||||
methods: 'GET' |
||||
}, 'preview_route') |
||||
}, |
||||
changeConfig(info) { |
||||
personalConfigInfo(data => { |
||||
if (data.code === 1000) { |
||||
this.$message.success("操作成功") |
||||
this.configFun() |
||||
} else { |
||||
this.$message.error("操作失败了 " + data.msg) |
||||
} |
||||
}, { |
||||
methods: 'PUT', data: {config_key: info.key, config_value: info.value} |
||||
}, 'preview_route') |
||||
}, |
||||
updateConfig() { |
||||
personalConfigInfo(data => { |
||||
if (data.code === 1000) { |
||||
this.$message.success("操作成功") |
||||
this.configFun() |
||||
} else { |
||||
this.$message.error("操作失败了 " + data.msg) |
||||
} |
||||
}, { |
||||
methods: 'DELETE' |
||||
}, 'preview_route') |
||||
}, |
||||
|
||||
copy_success() { |
||||
this.$message.success('复制剪切板成功'); |
||||
}, |
||||
handleSizeChange(val) { |
||||
this.pagination.pagesize = val; |
||||
this.get_data_from_tabname({ |
||||
"size": this.pagination.pagesize, |
||||
"page": 1 |
||||
}) |
||||
}, |
||||
handleCurrentChange(val) { |
||||
this.pagination.currentPage = val; |
||||
this.get_data_from_tabname({ |
||||
"size": this.pagination.pagesize, |
||||
"page": this.pagination.currentPage |
||||
}) |
||||
}, |
||||
|
||||
get_data_from_tabname(data = {}) { |
||||
data.search_key = this.search_key.replace(/^\s+|\s+$/g, ""); |
||||
this.UserCnameInfoFun(data) |
||||
}, |
||||
UserCnameInfoFun(params) { |
||||
this.loading = true; |
||||
dCnameInfoFun(data => { |
||||
if (data.code === 1000) { |
||||
this.cname_info_list = data.data; |
||||
this.pagination.total = data.count; |
||||
|
||||
} else { |
||||
this.$message.error("域名绑定信息获取失败") |
||||
} |
||||
this.loading = false; |
||||
}, {methods: 'GET', data: params}) |
||||
}, |
||||
|
||||
format_create_time(row) { |
||||
return format_time(row.created_time) |
||||
}, |
||||
|
||||
}, mounted() { |
||||
getUserInfoFun(this); |
||||
this.get_data_from_tabname(); |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style scoped> |
||||
.el-main { |
||||
margin: 20px auto 100px; |
||||
width: 1166px; |
||||
position: relative; |
||||
padding-bottom: 1px; |
||||
color: #9b9b9b; |
||||
-webkit-font-smoothing: antialiased; |
||||
border-radius: 1%; |
||||
} |
||||
|
||||
</style> |
@ -1,733 +0,0 @@ |
||||
<template> |
||||
<el-main> |
||||
<el-dialog :close-on-click-modal="false" :destroy-on-close="true" :title="title" |
||||
:visible.sync="dialogReceiverVisible" width="780px"> |
||||
|
||||
<el-form ref="recevierform" :model="addreceiverinfo" |
||||
label-width="80px" style="margin:0 auto;"> |
||||
|
||||
|
||||
<el-form-item label="姓名"> |
||||
<el-input v-model="addreceiverinfo.receiver_name"/> |
||||
</el-form-item> |
||||
|
||||
<el-form-item label="邮箱"> |
||||
<el-input v-model="addreceiverinfo.email"/> |
||||
</el-form-item> |
||||
|
||||
|
||||
<el-form-item v-if="captcha.captcha_image" style="height: 40px"> |
||||
<el-row style="height: 40px"> |
||||
<el-col :span="16"> |
||||
<el-input v-model="addreceiverinfo.verify_code" clearable maxlength="6" |
||||
placeholder="请输入验证码" @keyup.enter.native="onSubmit"/> |
||||
</el-col> |
||||
<el-col :span="8"> |
||||
<el-image |
||||
:src="captcha.captcha_image" |
||||
fit="contain" |
||||
style="margin:0 4px;border-radius:4px;cursor:pointer;height: 40px" @click="get_auth_code"> |
||||
</el-image> |
||||
</el-col> |
||||
</el-row> |
||||
</el-form-item> |
||||
|
||||
<el-form-item> |
||||
<el-row> |
||||
<el-col :span="16"> |
||||
<el-input v-model="addreceiverinfo.seicode" clearable |
||||
placeholder="邮箱验证码" prefix-icon="el-icon-mobile"/> |
||||
</el-col> |
||||
<el-col :span="8"> |
||||
<el-button plain style="margin:0 4px;border-radius:4px;cursor:pointer;height: 40px" type="info" |
||||
@click="onGetCode">获取验证码 |
||||
</el-button> |
||||
</el-col> |
||||
</el-row> |
||||
</el-form-item> |
||||
|
||||
<el-form-item> |
||||
<div id="captcha" ref="captcha"></div> |
||||
</el-form-item> |
||||
|
||||
|
||||
<el-form-item label="微信"> |
||||
<el-tag v-if="addreceiverinfo.wxopenid && addreceiverinfo.wxopenid.length > 6"> |
||||
{{ addreceiverinfo.wxopenid }} |
||||
</el-tag> |
||||
<el-popover v-else |
||||
v-model="wx_visible" |
||||
placement="top" |
||||
title="打开微信扫一扫进行绑定" |
||||
trigger="manual"> |
||||
<div> |
||||
<el-image :src="wx_login_qr_url" style="width: 176px;height: 166px"/> |
||||
</div> |
||||
<el-button slot="reference" size="small" @click="wxLogin">绑定微信</el-button> |
||||
</el-popover> |
||||
</el-form-item> |
||||
|
||||
<el-form-item label="备注"> |
||||
<el-input v-model="addreceiverinfo.description"/> |
||||
</el-form-item> |
||||
|
||||
<el-button @click="saveReceiver">保存</el-button> |
||||
<el-button @click="cancelReceiver">取消</el-button> |
||||
</el-form> |
||||
</el-dialog> |
||||
|
||||
|
||||
<el-dialog :close-on-click-modal="false" :destroy-on-close="true" :visible.sync="dialogChangeReceiverVisible" |
||||
title="修改消息接收人"> |
||||
|
||||
<div style="text-align: left;margin-bottom: 10px"> |
||||
<div style="margin-bottom: 10px"> |
||||
<el-tag type="warning">提醒:如果以下消息接收人的信息有变更,请到“消息接收人管理”中进行修改。</el-tag> |
||||
</div> |
||||
消息类型:{{ notifyConfigMsg.message_type }} - {{ notifyConfigMsg.config_name }} |
||||
</div> |
||||
<el-table |
||||
ref="multipleTable" |
||||
:data="receiver_info_lists" |
||||
border |
||||
stripe |
||||
style="width: 100%" |
||||
@selection-change="handleSelectionChange"> |
||||
<el-table-column |
||||
type="selection" |
||||
width="55"> |
||||
</el-table-column> |
||||
<el-table-column |
||||
align="center" |
||||
fixed |
||||
label="姓名" |
||||
prop="receiver_name" |
||||
width="100"> |
||||
</el-table-column> |
||||
<el-table-column |
||||
align="center" |
||||
label="邮箱" |
||||
prop="email" |
||||
width="200"> |
||||
</el-table-column> |
||||
<el-table-column |
||||
align="center" |
||||
label="微信" |
||||
prop="domain_name" |
||||
width="260"> |
||||
<template slot-scope="scope"> |
||||
<el-popover v-if="scope.row.weixin.openid" placement="top" trigger="hover"> |
||||
<div style="float: right;margin-top: 10px"> |
||||
<el-image :src="scope.row.weixin.head_img_url" style="width: 80px;height: 80px"/> |
||||
</div> |
||||
<p>昵称: {{ scope.row.weixin.nickname }}</p> |
||||
<p>性别: {{ scope.row.weixin.sex|sex_filter }}</p> |
||||
<p>住址: {{ scope.row.weixin.address }}</p> |
||||
<p>微信ID: {{ scope.row.weixin.openid }}</p> |
||||
<div slot="reference" class="name-wrapper"> |
||||
<el-tag>{{ scope.row.weixin.openid }}</el-tag> |
||||
</div> |
||||
</el-popover> |
||||
<el-tag v-else> /</el-tag> |
||||
</template> |
||||
</el-table-column> |
||||
|
||||
<el-table-column |
||||
align="center" |
||||
label="备注" |
||||
prop="description"> |
||||
</el-table-column> |
||||
|
||||
</el-table> |
||||
<div style="text-align: left;margin-bottom: 10px;margin-top: 10px"> |
||||
<el-button plain size="small" type="primary" @click="addRecevier"> |
||||
新增消息接收人 |
||||
</el-button> |
||||
</div> |
||||
<span slot="footer"> |
||||
<el-button @click="updateConfig(undefined)">保存</el-button> |
||||
<el-button @click="dialogChangeReceiverVisible=false">取消</el-button> |
||||
</span> |
||||
|
||||
</el-dialog> |
||||
|
||||
|
||||
<el-tabs v-model="activeName" tab-position="top" type="border-card" @tab-click="handleClick"> |
||||
|
||||
<el-tab-pane label="基本接收管理" name="config"> |
||||
|
||||
<el-table |
||||
:data="[{name:'消息类型',email:'邮件通知',weixin:'微信通知',user:'消息接收人'}]" |
||||
:show-header="false" |
||||
border |
||||
stripe |
||||
style="width: 100%"> |
||||
<el-table-column |
||||
align="center" |
||||
prop="name" |
||||
width="200"> |
||||
</el-table-column> |
||||
<el-table-column |
||||
align="center" |
||||
prop="email" |
||||
width="200"> |
||||
</el-table-column> |
||||
<el-table-column |
||||
align="center" |
||||
prop="weixin" |
||||
width="200"> |
||||
</el-table-column> |
||||
<el-table-column |
||||
align="center" |
||||
prop="user"> |
||||
</el-table-column> |
||||
</el-table> |
||||
|
||||
<el-collapse v-model="activeConfig"> |
||||
<el-collapse-item v-for="info in message_type_choices" :key="info.id" :disabled="info.disabled" |
||||
:name="info.id"> |
||||
<template slot="title"> |
||||
<div style="width: 200px"> |
||||
<h2>{{ info.name }}</h2> |
||||
</div> |
||||
</template> |
||||
<el-table |
||||
:data="info.data" |
||||
:show-header="false" |
||||
border |
||||
stripe |
||||
style="width: 100%"> |
||||
<el-table-column |
||||
align="center" |
||||
fixed |
||||
prop="config_name" |
||||
width="200"> |
||||
</el-table-column> |
||||
<el-table-column |
||||
align="center" |
||||
fixed |
||||
prop="enable_email" |
||||
width="200"> |
||||
<template slot-scope="scope"> |
||||
<el-checkbox v-model="scope.row.enable_email" @change="updateConfig(scope.row)">邮件</el-checkbox> |
||||
</template> |
||||
</el-table-column> |
||||
|
||||
<el-table-column |
||||
align="center" |
||||
fixed |
||||
prop="enable_weixin" |
||||
width="200"> |
||||
<template slot-scope="scope"> |
||||
<el-checkbox v-model="scope.row.enable_weixin" @change="updateConfig(scope.row)">微信</el-checkbox> |
||||
</template> |
||||
</el-table-column> |
||||
|
||||
<el-table-column |
||||
align="center" |
||||
fixed |
||||
prop="senders"> |
||||
<template slot-scope="scope"> |
||||
<el-tag v-for="user in scope.row.senders" :key="user.id" style="margin-right: 3px" type="info"> |
||||
{{ user.receiver_name }} |
||||
</el-tag> |
||||
<el-tag type="success"> |
||||
<el-link :underline="false" type="success" @click="changeNotifyConfig(scope.row)">修改</el-link> |
||||
</el-tag> |
||||
</template> |
||||
</el-table-column> |
||||
|
||||
</el-table> |
||||
</el-collapse-item> |
||||
</el-collapse> |
||||
</el-tab-pane> |
||||
<el-tab-pane label="消息接收人管理" name="receiver"> |
||||
|
||||
<div style="float: right;margin-bottom: 10px"> |
||||
|
||||
<el-button plain type="primary" @click="addRecevier"> |
||||
新增消息接收人 |
||||
</el-button> |
||||
|
||||
</div> |
||||
<el-table |
||||
v-loading="loading" |
||||
:data="receiver_info_lists" |
||||
border |
||||
stripe |
||||
style="width: 100%"> |
||||
|
||||
<el-table-column |
||||
align="center" |
||||
fixed |
||||
label="姓名" |
||||
prop="receiver_name" |
||||
width="100"> |
||||
</el-table-column> |
||||
<el-table-column |
||||
align="center" |
||||
label="邮箱" |
||||
prop="email" |
||||
width="200"> |
||||
</el-table-column> |
||||
<el-table-column |
||||
align="center" |
||||
label="微信" |
||||
prop="domain_name"> |
||||
<template slot-scope="scope"> |
||||
<el-popover v-if="scope.row.weixin.openid" placement="top" trigger="hover"> |
||||
<div style="float: right;margin-top: 10px"> |
||||
<el-image :src="scope.row.weixin.head_img_url" style="width: 80px;height: 80px"/> |
||||
</div> |
||||
<p>昵称: {{ scope.row.weixin.nickname }}</p> |
||||
<p>性别: {{ scope.row.weixin.sex|sex_filter }}</p> |
||||
<p>住址: {{ scope.row.weixin.address }}</p> |
||||
<p>微信ID: {{ scope.row.weixin.openid }}</p> |
||||
<div slot="reference" class="name-wrapper"> |
||||
<el-tag>{{ scope.row.weixin.openid }}</el-tag> |
||||
</div> |
||||
</el-popover> |
||||
<el-tag v-else> /</el-tag> |
||||
</template> |
||||
</el-table-column> |
||||
|
||||
|
||||
<el-table-column |
||||
:formatter="formatter" |
||||
align="center" |
||||
label="添加时间" |
||||
prop="create_time" |
||||
width="170"> |
||||
</el-table-column> |
||||
<el-table-column |
||||
align="center" |
||||
label="备注" |
||||
prop="description"> |
||||
</el-table-column> |
||||
<el-table-column |
||||
align="center" |
||||
label="操作" |
||||
width="120"> |
||||
<template slot-scope="scope"> |
||||
<!-- <el-button size="small" type="text" @click="editReceiver(scope.row)">编辑</el-button>--> |
||||
<el-button size="small" type="text" @click="deleteReceiver(scope.row)">删除</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
</el-tab-pane> |
||||
|
||||
<el-tab-pane label="阈值设置" name="threshold" style="text-align: center"> |
||||
<el-tag style="margin: 20px 0"> 低于阈值设置,将会出发报警,若您配置了消息接收,将会将报警信息推送至关联的接收人</el-tag> |
||||
<div style="margin: auto;width: 700px;height: 100%"> |
||||
<el-form ref="form" :model="threshold" label-width="180px"> |
||||
<el-form-item label="下载次数不足阈值设置"> |
||||
<el-input-number v-model="threshold.notify_available_downloads" :min="0" |
||||
style="width: 300px;margin: 0 20px"></el-input-number> |
||||
<el-button @click="notifyThreshold('update')">保存修改</el-button> |
||||
</el-form-item> |
||||
|
||||
<el-form-item label="签名次数不足阈值设置"> |
||||
<el-input-number v-model="threshold.notify_available_signs" :min="0" |
||||
style="width: 300px;margin: 0 20px"></el-input-number> |
||||
<el-button @click="notifyThreshold('update')">保存修改</el-button> |
||||
</el-form-item> |
||||
</el-form> |
||||
</div> |
||||
|
||||
</el-tab-pane> |
||||
</el-tabs> |
||||
|
||||
</el-main> |
||||
</template> |
||||
|
||||
<script> |
||||
import {notifyConfigInfo, NotifyInfoFun, notifyReceiverInfo, wxBindFun, wxLoginFun} from "@/restful"; |
||||
import {geetest, getUserInfoFun} from "@/utils"; |
||||
import {checkEmail, checkphone, format_time, getRandomStr} from "@/utils/base/utils"; |
||||
|
||||
export default { |
||||
name: "FirUserNotify", |
||||
data() { |
||||
return { |
||||
dialogReceiverVisible: false, |
||||
captcha: {"captcha_image": '', "captcha_key": '', "length": 8}, |
||||
change_type: {email: false, sms: false}, |
||||
wx_visible: false, |
||||
wx_login_qr_url: '', |
||||
unique_key: '', |
||||
userinfo: {}, |
||||
addreceiverinfo: {description: '', wxopenid: '', email: '', receiver_name: '', verify_code: '', seicode: ''}, |
||||
message_type_choices: [], |
||||
activeConfig: [], |
||||
dialogChangeReceiverVisible: false, |
||||
notifyConfigSelection: [], |
||||
notifyConfigMsg: {}, |
||||
title: '', |
||||
isedit: false, |
||||
activeName: 'config', |
||||
receiver_info_lists: [], |
||||
loading: false, |
||||
threshold: {} |
||||
} |
||||
}, methods: { |
||||
onGetCode() { |
||||
this.addreceiverinfo.auth_token = ''; |
||||
this.addreceiverinfo.seicode = ''; |
||||
this.onSubmit(); |
||||
}, |
||||
onSubmit() { |
||||
let email = this.addreceiverinfo.email; |
||||
let verify_code = this.addreceiverinfo.verify_code; |
||||
let captcha_flag = this.addreceiverinfo.verify_code.length === this.captcha.length; |
||||
if (this.captcha.captcha_key === '' || !this.captcha.captcha_key) { |
||||
captcha_flag = true |
||||
} |
||||
if (captcha_flag) { |
||||
let checke = checkEmail(this.addreceiverinfo.email); |
||||
let checkp = checkphone(this.addreceiverinfo.email); |
||||
if (checke || checkp) { |
||||
let params = { |
||||
"target": email, |
||||
"verify_code": verify_code, |
||||
"captcha_key": this.captcha.captcha_key, |
||||
"n_type": 'notify', |
||||
}; |
||||
let seicode = this.addreceiverinfo.seicode; |
||||
let auth_token = this.addreceiverinfo.auth_token; |
||||
if (seicode && seicode.length > 3) { |
||||
params['seicode'] = seicode |
||||
} |
||||
if (auth_token && auth_token.length > 3) { |
||||
params['auth_token'] = auth_token |
||||
} |
||||
if (this.auth_rules.geetest) { |
||||
geetest(this, this.addreceiverinfo.email, params, (n_params) => { |
||||
this.do_notify_sender(n_params) |
||||
}, NotifyInfoFun) |
||||
} else { |
||||
this.do_notify_sender(params) |
||||
} |
||||
} else { |
||||
this.$message({ |
||||
message: '邮箱或手机号输入有误', |
||||
type: 'error' |
||||
}); |
||||
} |
||||
|
||||
} else { |
||||
this.$message({ |
||||
message: '验证码有误', |
||||
type: 'warning' |
||||
}); |
||||
} |
||||
}, |
||||
do_notify_sender(params) { |
||||
NotifyInfoFun(data => { |
||||
if (data.code === 1000) { |
||||
this.$message.success("验证码发送成功") |
||||
this.addreceiverinfo.auth_token = data.data.auth_token; |
||||
} else { |
||||
this.$message.error(data.msg) |
||||
|
||||
} |
||||
}, { |
||||
'methods': 'POST', |
||||
'data': params |
||||
}) |
||||
}, |
||||
|
||||
get_auth_code() { |
||||
NotifyInfoFun(data => { |
||||
if (data.code === 1000) { |
||||
this.auth_rules = data.data.auth_rules; |
||||
this.captcha = this.auth_rules.captcha; |
||||
this.change_type = data.data.change_type; |
||||
this.addreceiverinfo.captcha_key = this.captcha.captcha_key; |
||||
if (this.addreceiverinfo.verify_code) { |
||||
this.addreceiverinfo.verify_code = ''; |
||||
} |
||||
} else { |
||||
this.$message({ |
||||
message: data.msg, |
||||
type: 'error' |
||||
}); |
||||
} |
||||
}, { |
||||
"methods": "GET", |
||||
"data": {} |
||||
}); |
||||
}, |
||||
addRecevier() { |
||||
this.addreceiverinfo = {description: '', wxopenid: '', email: '', receiver_name: '', verify_code: '', seicode: ''} |
||||
this.dialogReceiverVisible = true |
||||
this.title = '新增消息接收人' |
||||
this.get_auth_code() |
||||
}, |
||||
editReceiver(receiver) { |
||||
this.title = '编辑 ' + receiver.receiver_name + ' 消息接收人' |
||||
this.isedit = true |
||||
this.addreceiverinfo = receiver |
||||
this.dialogReceiverVisible = true |
||||
}, |
||||
updateConfig(config = undefined) { |
||||
let data = {} |
||||
if (config) { |
||||
data = { |
||||
'config': config.id, |
||||
'enable_email': config.enable_email, |
||||
'enable_weixin': config.enable_weixin, |
||||
'm_type': config.message_type |
||||
} |
||||
} else { |
||||
let receiver_ids = [] |
||||
for (let receiver of this.notifyConfigSelection) { |
||||
receiver_ids.push(receiver.id) |
||||
} |
||||
data = {'config': this.notifyConfigMsg.id, 'receiver': receiver_ids, 'm_type': this.notifyConfigMsg.m_type} |
||||
} |
||||
|
||||
notifyConfigInfo(data => { |
||||
if (data.code === 1000) { |
||||
this.$message.success('保存成功') |
||||
if (!config) { |
||||
this.dialogChangeReceiverVisible = false; |
||||
} |
||||
this.notifyConfigInfoFun(); |
||||
} else { |
||||
this.$message.error('保存失败,' + data.msg); |
||||
} |
||||
}, {"methods": 'PUT', "data": data}); |
||||
}, |
||||
changeNotifyConfig(info) { |
||||
let params = {"config": info.id, "message_type": info.m_type} |
||||
this.dialogChangeReceiverVisible = true; |
||||
notifyReceiverInfo(data => { |
||||
if (data.code === 1000) { |
||||
this.receiver_info_lists = data.data; |
||||
this.notifyConfigMsg = data.config |
||||
// eslint-disable-next-line no-unused-vars |
||||
this.$nextTick(res => { |
||||
data.data.forEach(row => { |
||||
for (let sender of data.senders) { |
||||
if (sender.sender === row.id) { |
||||
this.$refs.multipleTable.toggleRowSelection(row); |
||||
} |
||||
} |
||||
}); |
||||
}) |
||||
} else { |
||||
this.$message.error('获取失败,' + data); |
||||
} |
||||
this.loading = false; |
||||
}, {"methods": 'GET', "data": params}); |
||||
|
||||
}, |
||||
handleSelectionChange(val) { |
||||
this.notifyConfigSelection = val; |
||||
}, |
||||
// eslint-disable-next-line no-unused-vars |
||||
handleClick(tab, event) { |
||||
this.get_data_from_tabname(tab.name); |
||||
}, |
||||
cancelReceiver() { |
||||
this.dialogReceiverVisible = false; |
||||
this.addreceiverinfo = {description: '', wxopenid: '', email: '', receiver_name: '', verify_code: '', seicode: ''} |
||||
}, |
||||
saveReceiver() { |
||||
notifyReceiverInfo(data => { |
||||
if (data.code === 1000) { |
||||
this.$message.success('操作成功'); |
||||
this.dialogReceiverVisible = false; |
||||
if (this.dialogChangeReceiverVisible) { |
||||
this.changeNotifyConfig(this.notifyConfigMsg) |
||||
} else { |
||||
this.get_data_from_tabname(this.activeName); |
||||
} |
||||
} else { |
||||
this.$message.error('操作失败,' + data.msg); |
||||
} |
||||
}, {"methods": 'POST', 'data': this.addreceiverinfo}); |
||||
}, |
||||
deleteReceiver(sinfo) { |
||||
|
||||
this.$confirm(`将要删除接收人 ${sinfo.receiver_name}, 是否继续?`, '警告', { |
||||
confirmButtonText: '确定', |
||||
cancelButtonText: '取消', |
||||
type: 'warning' |
||||
}).then(() => { |
||||
notifyReceiverInfo(data => { |
||||
if (data.code === 1000) { |
||||
this.$message.success('删除成功'); |
||||
this.notifyReceiverInfoFun(); |
||||
} |
||||
}, {"methods": 'DELETE', 'data': {'id': sinfo.id}}) |
||||
}).catch(() => { |
||||
this.$message({ |
||||
type: 'info', |
||||
message: '已取消删除' |
||||
}); |
||||
}); |
||||
|
||||
}, |
||||
|
||||
notifyReceiverInfoFun() { |
||||
this.loading = true; |
||||
notifyReceiverInfo(data => { |
||||
if (data.code === 1000) { |
||||
this.receiver_info_lists = data.data; |
||||
} else { |
||||
this.$message.error('获取失败,' + data); |
||||
} |
||||
this.loading = false; |
||||
}, {"methods": 'GET'}); |
||||
}, |
||||
setActiveConfig(message_type_choices) { |
||||
let activeConfig = [] |
||||
for (let i of message_type_choices) { |
||||
activeConfig.push(i.id) |
||||
} |
||||
this.activeConfig = activeConfig; |
||||
}, |
||||
notifyConfigInfoFun() { |
||||
this.loading = true; |
||||
notifyConfigInfo(data => { |
||||
if (data.code === 1000) { |
||||
this.receiver_info_lists = data.data; |
||||
this.message_type_choices = data.message_type_choices; |
||||
this.setActiveConfig(this.message_type_choices); |
||||
} else { |
||||
this.$message.error('获取失败,' + data); |
||||
} |
||||
this.loading = false; |
||||
}, {"methods": 'GET'}); |
||||
}, |
||||
notifyThreshold(act) { |
||||
notifyConfigInfo(data => { |
||||
if (data.code === 1000) { |
||||
this.threshold = data.data |
||||
if (act !== 'get') { |
||||
this.$message.success('保存成功') |
||||
} |
||||
} else { |
||||
this.$message.error('获取失败,' + data); |
||||
} |
||||
this.loading = false; |
||||
}, {"methods": 'POST', 'data': {'act': act, 'threshold': this.threshold}}); |
||||
}, |
||||
|
||||
loop_get_wx_info(wx_login_ticket, c_count = 1, unique_key = getRandomStr()) { |
||||
if (wx_login_ticket && wx_login_ticket.length < 3) { |
||||
this.$message.error("获取登陆码失败,请稍后再试"); |
||||
return |
||||
} |
||||
if (!this.wx_visible) { |
||||
return; |
||||
} |
||||
wxLoginFun(data => { |
||||
c_count += 1; |
||||
if (c_count > 30) { |
||||
return; |
||||
} |
||||
if (data.code === 1000) { |
||||
if (this.userinfo.uid === data.data.uid) { |
||||
if (data.data.to_user) { |
||||
this.addreceiverinfo.wxopenid = data.data.to_user |
||||
} |
||||
this.$message.success("绑定成功"); |
||||
this.wx_visible = false; |
||||
} |
||||
} else if (data.code === 1005) { |
||||
this.$message({ |
||||
message: data.msg, |
||||
type: 'error', |
||||
duration: 30000 |
||||
}); |
||||
} else if (data.code === 1004) { |
||||
this.loop_flag = false; |
||||
} else if (data.code === 1006) { |
||||
return this.loop_get_wx_info(wx_login_ticket, c_count, unique_key) |
||||
} |
||||
}, { |
||||
"methods": "POST", |
||||
data: {"ticket": wx_login_ticket, "unique_key": unique_key} |
||||
}) |
||||
}, |
||||
wxLogin() { |
||||
this.wx_visible = !this.wx_visible; |
||||
this.wx_login_qr_url = ''; |
||||
if (this.wx_visible) { |
||||
wxBindFun(data => { |
||||
if (data.code === 1000) { |
||||
this.wx_login_qr_url = data.data.qr; |
||||
this.loop_get_wx_info(data.data.ticket); |
||||
} else { |
||||
this.$message.error(data.msg); |
||||
this.wx_visible = false; |
||||
} |
||||
}, { |
||||
"methods": "POST", "data": {"unique_key": this.unique_key, "w_type": 'notify'} |
||||
}) |
||||
} |
||||
}, |
||||
|
||||
// eslint-disable-next-line no-unused-vars |
||||
formatter(row, column) { |
||||
return format_time(row.create_time) |
||||
}, |
||||
// eslint-disable-next-line no-unused-vars |
||||
get_data_from_tabname(tabname, data = {}) { |
||||
this.$router.push({"name": 'FirUserNotify', params: {act: tabname}}); |
||||
if (tabname === "config") { |
||||
this.notifyConfigInfoFun(); |
||||
} else if (tabname === "receiver") { |
||||
this.notifyReceiverInfoFun(); |
||||
} else if (tabname === "threshold") { |
||||
this.notifyThreshold('get'); |
||||
} |
||||
}, |
||||
}, mounted() { |
||||
getUserInfoFun(this); |
||||
this.userinfo = this.$store.state.userinfo; |
||||
this.unique_key = getRandomStr(); |
||||
if (this.$route.params.act) { |
||||
let activeName = this.$route.params.act; |
||||
let activeName_list = ["config", "receiver", "threshold"]; |
||||
for (let index in activeName_list) { |
||||
if (activeName_list[index] === activeName) { |
||||
this.activeName = activeName; |
||||
this.get_data_from_tabname(activeName); |
||||
return |
||||
} |
||||
} |
||||
} |
||||
this.get_data_from_tabname(this.activeName); |
||||
}, filters: { |
||||
sex_filter: function (x) { |
||||
let ret = '未知'; |
||||
if (x === 1) { |
||||
ret = '男' |
||||
} else if (x === 2) { |
||||
ret = '女' |
||||
} |
||||
return ret; |
||||
}, |
||||
}, watch: { |
||||
'$store.state.userinfo': function () { |
||||
this.userinfo = this.$store.state.userinfo; |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style scoped> |
||||
.el-main { |
||||
text-align: center; |
||||
margin: 20px auto 100px; |
||||
width: 1166px; |
||||
position: relative; |
||||
padding-bottom: 1px; |
||||
color: #9b9b9b; |
||||
-webkit-font-smoothing: antialiased; |
||||
border-radius: 1%; |
||||
} |
||||
</style> |
@ -1,73 +0,0 @@ |
||||
export function GetRandomNum(Min, Max) { |
||||
const Range = Max - Min; |
||||
const Rand = Math.random(); |
||||
return (Min + Math.round(Rand * Range)); |
||||
} |
||||
|
||||
export function getRandomStr(str_length = 32) { |
||||
const SIGNING_v1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'//36
|
||||
// const SIGNING_v2 ='ABCDEFGHJKMNPQRSTUVWXYZ23456789'//31
|
||||
// const SIGNING_v3 ='1234567890'//10
|
||||
// const SIGNING_v4 ='ABCDEFGHIJKLMNOPQRSTUVWXYZ'//26
|
||||
const SIGNING_v5 = 'abcdefghigklmnopqrstuvwxyz'//26
|
||||
let random_str = SIGNING_v1 + SIGNING_v5 |
||||
let random_code = '' |
||||
str_length -= 1 |
||||
for (let i = 0; i < str_length; i++) { |
||||
random_code = random_code + random_str[GetRandomNum(0, str_length)] |
||||
} |
||||
return random_code |
||||
} |
||||
|
||||
|
||||
export function checkEmail(email) { |
||||
let re = /^(\w-*\.*)+@(\w-?)+(\.\w{2,})+$/; |
||||
return re.test(email); |
||||
} |
||||
|
||||
export function checkphone(email) { |
||||
let re = /^1\d{10}$/; |
||||
return re.test(email); |
||||
} |
||||
|
||||
|
||||
export function geetestbase(func, self, uid, params, callback, errback, readyback) { |
||||
func(res => { |
||||
if (res.code === 1000) { |
||||
let data = res.data; |
||||
// eslint-disable-next-line no-undef
|
||||
initGeetest({ |
||||
gt: data.gt, |
||||
challenge: data.challenge, |
||||
new_captcha: data.new_captcha, // 用于宕机时表示是新验证码的宕机
|
||||
offline: !data.success, // 表示用户后台检测极验服务器是否宕机,一般不需要关注
|
||||
product: "bind", // 产品形式,包括:float,popup
|
||||
width: "100%" |
||||
}, (captchaObj) => { |
||||
self.$refs.captcha.innerHTML = ''; |
||||
// captchaObj.appendTo("#captcha");
|
||||
captchaObj.onReady(() => { |
||||
readyback(captchaObj) |
||||
}).onSuccess(() => { |
||||
params.geetest = captchaObj.getValidate(); |
||||
callback(params); |
||||
}).onError(() => { |
||||
captchaObj.destroy(); |
||||
}); |
||||
}); |
||||
} else { |
||||
errback(res) |
||||
} |
||||
}, { |
||||
"methods": "PUT", |
||||
"data": {user_id: uid} |
||||
}); |
||||
} |
||||
|
||||
export function format_time(stime) { |
||||
if (stime) { |
||||
stime = stime.split(".")[0].split("T"); |
||||
return stime[0] + " " + stime[1] |
||||
} else |
||||
return ''; |
||||
} |
@ -1,22 +0,0 @@ |
||||
module.exports =function dateFormat(format, date=null) { |
||||
if(!date){ |
||||
date = new Date() |
||||
} |
||||
const args = { |
||||
"M+": date.getMonth() + 1, |
||||
"d+": date.getDate(), |
||||
"h+": date.getHours(), |
||||
"m+": date.getMinutes(), |
||||
"s+": date.getSeconds(), |
||||
"q+": Math.floor((date.getMonth() + 3) / 3), |
||||
"S": date.getMilliseconds() |
||||
}; |
||||
if (/(y+)/.test(format)) |
||||
format = format.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length)); |
||||
for (let i in args) { |
||||
let n = args[i]; |
||||
if (new RegExp("(" + i + ")").test(format)) |
||||
format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? n : ("00" + n).substr(("" + n).length)); |
||||
} |
||||
return format; |
||||
} |
@ -1,32 +1,41 @@ |
||||
FROM python:3.9.14-slim |
||||
FROM python:3.6.14-slim |
||||
|
||||
# Fixes some weird terminal issues such as broken clear / CTRL+L |
||||
ARG PIP_MIRROR=https://mirrors.aliyun.com/pypi/simple |
||||
|
||||
#RUN sed -i 's/deb.debian.org/mirrors.163.com/g' /etc/apt/sources.list \ |
||||
# && sed -i 's/security.debian.org/mirrors.163.com/g' /etc/apt/sources.list \ |
||||
RUN apt update \ |
||||
&& apt-get install g++ wget zip unzip -y \ |
||||
&& apt-get install libssl-dev openssl libmariadb-dev -y \ |
||||
&& apt-get clean \ |
||||
&& rm -rf /var/lib/apt/lists/* |
||||
RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list \ |
||||
&& sed -i 's/security.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list \ |
||||
&& apt update |
||||
|
||||
RUN apt-get install g++ wget -y |
||||
RUN apt-get install libssl-dev openssl libmariadb-dev -y |
||||
RUN rm -rf /var/lib/apt/lists/* |
||||
|
||||
|
||||
|
||||
#COPY fir_client/dist /data/flyapps/fir_client |
||||
|
||||
#RUN cd /opt/ && wget https://github.com/nineaiyu/zsign/archive/refs/tags/v1.1.2.tar.gz |
||||
ADD zsign-1.1.2.tar.gz /opt/ |
||||
RUN cd /opt/zsign-1.1.2/ && g++ *.cpp common/*.cpp -lcrypto -O3 -std=c++11 -o zsign && cp zsign /usr/bin/ && rm -rf /opt/zsign-1.1.2/ |
||||
COPY zsign-1.1.2.tar.gz /opt/zsign-1.1.2.tar.gz |
||||
RUN cd /opt/ && tar xvf zsign-1.1.2.tar.gz && cd zsign-1.1.2/ && g++ *.cpp common/*.cpp -lcrypto -O3 -std=c++11 -o zsign && cp zsign /usr/bin/ |
||||
# install pip |
||||
COPY requirements.txt /opt/requirements.txt |
||||
RUN cd /opt/ && pip install -U setuptools pip --ignore-installed && pip install --no-cache-dir -r requirements.txt && pip install --no-cache-dir uwsgi |
||||
RUN cd /opt/ && pip install -U setuptools pip -i ${PIP_MIRROR} --ignore-installed && pip install --no-cache-dir -r requirements.txt -i ${PIP_MIRROR} && pip install --no-cache-dir uwsgi -i ${PIP_MIRROR} |
||||
|
||||
RUN rm -rf /var/cache/yum/ |
||||
|
||||
#COPY Docker/flyapps.conf /etc/supervisor/conf.d/flyapps.conf |
||||
#COPY Docker/uwsgi.conf /data/flyapps/fir_ser/uwsgi.conf |
||||
#COPY Docker/flyapps-vhost.conf /etc/nginx/conf.d/flyapps-vhost.conf |
||||
#COPY Docker/app.hehelucky.cn.pem /data/flyapps/app.hehelucky.cn.pem |
||||
#COPY Docker/app.hehelucky.cn.key /data/flyapps/app.hehelucky.cn.key |
||||
|
||||
WORKDIR /data/fir_ser/ |
||||
COPY entrypoint.sh entrypoint.sh |
||||
RUN addgroup --system --gid 101 nginx \ |
||||
&& adduser --system --disabled-login --ingroup nginx --no-create-home --home /nonexistent --gecos "nginx user" --shell /bin/false --uid 101 nginx |
||||
|
||||
#EXPOSE 443 |
||||
#ENTRYPOINT ["./entrypoint.sh"] |
||||
#ENTRYPOINT ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf", "-n"] |
||||
#CMD ["python", "manage.py", "start", "all","-u","nginx","-usm","1"] |
||||
ENTRYPOINT ["/bin/bash", "entrypoint.sh"] |
||||
CMD ["python", "manage.py", "start", "all","-u","nginx","-usm","1"] |
||||
|
||||
|
@ -1,11 +0,0 @@ |
||||
FROM python:3.9.14-slim |
||||
|
||||
RUN pip install --upgrade pip --no-cache-dir && \ |
||||
pip install setuptools-rust oss2 requests-toolbelt androguard requests --no-cache-dir |
||||
|
||||
WORKDIR /opt/ |
||||
|
||||
COPY cli.py /opt/cli.py |
||||
|
||||
CMD ["python", "cli.py"] |
||||
|
@ -1,14 +0,0 @@ |
||||
from django.core.management.base import BaseCommand |
||||
|
||||
from common.utils.caches import add_user_ds |
||||
|
||||
|
||||
class Command(BaseCommand): |
||||
help = 'add user download times' |
||||
|
||||
def add_arguments(self, parser): |
||||
parser.add_argument('uid', type=str, default='') |
||||
parser.add_argument('download_times', type=int, default=100) |
||||
|
||||
def handle(self, *args, **options): |
||||
add_user_ds(options.get('uid', None), options.get('download_times', 100)) |
@ -1,13 +0,0 @@ |
||||
from django.core.management.base import BaseCommand |
||||
|
||||
from common.libs.mp.wechat import create_menu |
||||
|
||||
|
||||
class Command(BaseCommand): |
||||
help = 'create weixin menu' |
||||
|
||||
def add_arguments(self, parser): |
||||
parser.add_argument('menu_json', nargs='?', type=str, default=None) |
||||
|
||||
def handle(self, *args, **options): |
||||
create_menu(options.get('menu_json', None)) |