diff --git a/README.md b/README.md index 9987bc8..b55f4f5 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,35 @@ +### 用与应用分发,苹果超级签名 +#### 部署前准备 +- 备案域名【至少需要一个域名,以下可通过子域名部署】 + - API域名 + - 前端web域名 + - 下载页域名 + - 下载页域名可配置多个 + - 存储域名(使用阿里云oss存储) +- ssl证书 + - API域名证书 + - 存储域名证书(使用阿里云oss存储) + - 前端web域名证书(可选) +- Centos7 服务器 + - 如果使用oss存储,则带宽为1M,若使用本地存储,则带宽越大越好 + - 如果使用超级签,最低配置为2cpu 4G内存,若干不使用签名,则1cpu2G就行 +- 阿里云短信或极光短信服务【可选一个,主要用与注册,重置密码】 + - 阿里云短信 + - 极光短信 +- 邮箱服务【可选,用与注册,重置密码,通知信息】 +- 阿里云OSS存储【可选】 + - [sts授权配置](https://help.aliyun.com/document_detail/100624.html) +- 阿里云CDN【可选,用与加速访问】 +- 极验验证【可选,滑动验证服务】 +- 微信公众号【可选,用与微信扫描登录】 +- 阿里云支付【可选,用与购买下载次数】 +- 微信支付【可选,用与购买下载次数】 + +#### 自用搭建建议 +- 阿里云服务器需要1cpu 2G内存,无需系统盘,如果使用超级签,可以适当增加配置 +- 需要阿里云OSS存储和阿里云CDN,并且OSS存储和阿里云服务器部署同一个地区 +- 可以申请一个极验进行滑动验证,或者开启验证码验证 +- 阿里云备案域名:api和前端可以使用一个域名,下载页单独域名 ##### 从git上面下载源码 ```shell cd /data/ diff --git a/fir_ser/api/management/commands/add_user_download_times.py b/fir_ser/api/management/commands/add_user_download_times.py new file mode 100644 index 0000000..430c266 --- /dev/null +++ b/fir_ser/api/management/commands/add_user_download_times.py @@ -0,0 +1,14 @@ +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)) diff --git a/fir_ser/common/utils/caches.py b/fir_ser/common/utils/caches.py index 37140b4..1b03c83 100644 --- a/fir_ser/common/utils/caches.py +++ b/fir_ser/common/utils/caches.py @@ -417,3 +417,13 @@ def add_user_storage_exchange(user_obj, exchange_number, exchange_month, remote_ except Exception as e: logger.error(f"{user_obj} download_times less then 0. Exception:{e}") return False + + +def add_user_ds(uid, amount): + obj = UserInfo.objects.filter(uid=uid).first() + try: + amount = int(amount) + except Exception: + amount = 0 + if obj and amount: + return admin_change_user_download_times(obj, amount * Config.APP_USE_BASE_DOWNLOAD_TIMES)