优化定时任务设备消耗展示

pull/37/head
nineven 3 years ago
parent 24a8307164
commit c4a4db2c7e
  1. 14
      fir_ser/common/libs/sendmsg/templates/check_developer.html
  2. 4
      fir_ser/config.py
  3. 18
      fir_ser/xsign/utils/ctasks.py
  4. 19
      fir_ser/xsign/views/supersign.py

@ -136,6 +136,20 @@
<h3>
尊敬的用户 {{ username }} 你好,苹果开发者状态监测如下:
</h3>
<div>
<p>
当前正常设备总量:{{ developer_used_info.used_sign_number }}
</p>
<p>
已使用:【平台:{{ developer_used_info.used_number }} 】【其他:{{ developer_used_info.can_other_used }}】
</p>
<p>
还剩:{{ developer_used_info.can_sign_number }} 可用
</p>
</div>
<div>
昨天消耗设备数:{{ yesterday_used_number }}
</div>
<table class="table table-bordered table-striped">
<thead>
<tr>

@ -7,7 +7,7 @@ import os
API_DOMAIN = "https://app.hehelucky.cn"
WEB_DOMAIN = "https://app.hehelucky.cn"
MOBILEPROVISION = "https://ali-static.jappstore.com/embedded5.mobileprovision"
MOBILEPROVISION = "https://static.flyapps.top/embedded1.mobileprovision"
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
@ -358,6 +358,6 @@ class APPLEDEVELOPERCONF(object):
DEVELOPER_SIGN_STATUS = [1] # 开发者可用于签名的查询
DEVELOPER_USE_STATUS = [1, 2, 3, 4, 5] # 开发者可用状态,详情查看 model.AppIOSDeveloperInfo
DEVELOPER_AUTO_CHECK_STATUS = [1, 2, 4, 5] # 定时认证自动检测
DEVELOPER_WRITE_STATUS = [1, 3, 4] # 开发者api写操作查询
DEVELOPER_WRITE_STATUS = [1, 3, 4] # 开发者api写操作查询[该状态用于苹果api接口]
DEVELOPER_DISABLED_STATUS = [2, 4, 5] # 开发者不可 修改为状态,用户前端控制
DEVELOPER_UID_KEY = "T:" # 开发者共享给其他第三方用户, 中间必须包含 : 前端需要根据 : 进行分割

@ -3,7 +3,7 @@
# project: 4月
# author: liuyu
# date: 2020/4/7
import datetime
import logging
import os
import random
@ -14,7 +14,8 @@ from django.template import loader
from common.core.sysconfig import Config
from fir_ser.settings import SUPER_SIGN_ROOT, SYNC_CACHE_TO_DATABASE
from xsign.models import UserInfo, AppIOSDeveloperInfo
from xsign.models import UserInfo, AppIOSDeveloperInfo, APPSuperSignUsedInfo
from xsign.utils.modelutils import get_developer_devices
from xsign.utils.supersignutils import IosUtils
from xsign.utils.utils import send_ios_developer_active_status
@ -65,6 +66,17 @@ def auto_check_ios_developer_active():
for uid, developer_obj_list in error_issuer_id.items():
userinfo = UserInfo.objects.filter(uid=uid).first()
developer_used_info = get_developer_devices(AppIOSDeveloperInfo.objects.filter(user_id=userinfo))
end_time = datetime.datetime.now().date()
start_time = end_time - datetime.timedelta(days=1)
yesterday_used_number = APPSuperSignUsedInfo.objects.filter(developerid__user_id=userinfo,
created_time__range=[start_time, end_time]).count()
content = loader.render_to_string('check_developer.html',
{'username': userinfo.first_name, 'developer_obj_list': developer_obj_list})
{
'username': userinfo.first_name,
'developer_obj_list': developer_obj_list,
'developer_used_info': developer_used_info,
'yesterday_used_number': yesterday_used_number,
})
send_ios_developer_active_status(userinfo, content)

@ -577,25 +577,6 @@ class DeviceTransferBillView(APIView):
}
return Response(res.dict)
def put(self, request):
res = BaseResponse()
uid = request.data.get('uid')
if uid:
user_obj = UserInfo.objects.filter(uid=uid, is_active=True, supersign_active=True).first()
if user_obj:
bill_obj = IosDeveloperBill.objects.filter(user_id=request.user, to_user_id__uid=uid, status=2).first()
number = 0
if bill_obj:
number = bill_obj.number
res.data = {'uid': user_obj.uid, 'name': user_obj.first_name, "number": number}
else:
res.msg = '用户信息不存在'
res.code = 1003
else:
res.msg = '参数有误'
res.code = 1003
return Response(res.dict)
def post(self, request):
res = BaseResponse()
uid = request.data.get('uid')

Loading…
Cancel
Save