增加消息提醒功能,下载余额,签名余额不足自动检测,发送邮件或微信通知功能

pull/37/head
nineven 3 years ago
parent 59e73fa83e
commit 88745550d4
  1. 167
      fir_client/src/components/user/FirUserNotify.vue
  2. 14
      fir_client/src/restful/index.js
  3. 4
      fir_client/src/utils/index.js
  4. 3
      fir_ser/api/urls.py
  5. 6
      fir_ser/api/views/login.py
  6. 7
      fir_ser/api/views/login_wx.py
  7. 72
      fir_ser/api/views/notify.py
  8. 6
      fir_ser/api/views/thirdlogin.py
  9. 2
      fir_ser/common/core/exception.py
  10. 5
      fir_ser/common/core/sysconfig.py
  11. 10
      fir_ser/config.py
  12. 55
      fir_ser/tests/django_test.py

@ -16,39 +16,39 @@
</el-form-item> </el-form-item>
<!-- <el-form-item v-if="captcha.captcha_image" style="height: 40px" >--> <el-form-item v-if="captcha.captcha_image" style="height: 40px">
<!-- <el-row style="height: 40px">--> <el-row style="height: 40px">
<!-- <el-col :span="16">--> <el-col :span="16">
<!-- <el-input v-model="addreceiverinfo.verify_code" clearable maxlength="6"--> <el-input v-model="addreceiverinfo.verify_code" clearable maxlength="6"
<!-- placeholder="请输入验证码" @keyup.enter.native="onSubmit"/>--> placeholder="请输入验证码" @keyup.enter.native="onSubmit"/>
<!-- </el-col>--> </el-col>
<!-- <el-col :span="8">--> <el-col :span="8">
<!-- <el-image--> <el-image
<!-- :src="captcha.captcha_image"--> :src="captcha.captcha_image"
<!-- fit="contain"--> fit="contain"
<!-- style="margin:0 4px;border-radius:4px;cursor:pointer;height: 40px" @click="get_auth_code">--> style="margin:0 4px;border-radius:4px;cursor:pointer;height: 40px" @click="get_auth_code">
<!-- </el-image>--> </el-image>
<!-- </el-col>--> </el-col>
<!-- </el-row>--> </el-row>
<!-- </el-form-item>--> </el-form-item>
<!-- <el-form-item>--> <el-form-item>
<!-- <el-row>--> <el-row>
<!-- <el-col :span="16">--> <el-col :span="16">
<!-- <el-input v-model="addreceiverinfo.seicode" clearable--> <el-input v-model="addreceiverinfo.seicode" clearable
<!-- placeholder="邮箱验证码" prefix-icon="el-icon-mobile"/>--> placeholder="邮箱验证码" prefix-icon="el-icon-mobile"/>
<!-- </el-col>--> </el-col>
<!-- <el-col :span="8">--> <el-col :span="8">
<!-- <el-button plain style="margin:0 4px;border-radius:4px;cursor:pointer;height: 40px" type="info"--> <el-button plain style="margin:0 4px;border-radius:4px;cursor:pointer;height: 40px" type="info"
<!-- @click="onGetCode">获取验证码--> @click="onGetCode">获取验证码
<!-- </el-button>--> </el-button>
<!-- </el-col>--> </el-col>
<!-- </el-row>--> </el-row>
<!-- </el-form-item>--> </el-form-item>
<!-- <el-form-item>--> <el-form-item>
<!-- <div id="captcha" ref="captcha"></div>--> <div id="captcha" ref="captcha"></div>
<!-- </el-form-item>--> </el-form-item>
<el-form-item label="微信"> <el-form-item label="微信">
@ -341,9 +341,9 @@
</template> </template>
<script> <script>
import {notifyConfigInfo, notifyReceiverInfo, wxBindFun, wxLoginFun} from "@/restful"; import {notifyConfigInfo, NotifyInfoFun, notifyReceiverInfo, wxBindFun, wxLoginFun} from "@/restful";
import {getUserInfoFun} from "@/utils"; import {geetest, getUserInfoFun} from "@/utils";
import {getRandomStr} from "@/utils/base/utils"; import {checkEmail, checkphone, getRandomStr} from "@/utils/base/utils";
export default { export default {
name: "FirUserNotify", name: "FirUserNotify",
@ -351,11 +351,12 @@ export default {
return { return {
dialogReceiverVisible: false, dialogReceiverVisible: false,
captcha: {"captcha_image": '', "captcha_key": '', "length": 8}, captcha: {"captcha_image": '', "captcha_key": '', "length": 8},
change_type: {email: false, sms: false},
wx_visible: false, wx_visible: false,
wx_login_qr_url: '', wx_login_qr_url: '',
unique_key: '', unique_key: '',
userinfo: {}, userinfo: {},
addreceiverinfo: {description: '', wxopenid: '', email: '', receiver_name: ''}, addreceiverinfo: {description: '', wxopenid: '', email: '', receiver_name: '', verify_code: '', seicode: ''},
message_type_choices: [], message_type_choices: [],
activeConfig: [], activeConfig: [],
dialogChangeReceiverVisible: false, dialogChangeReceiverVisible: false,
@ -369,10 +370,98 @@ export default {
threshold: {} threshold: {}
} }
}, methods: { }, 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() { addRecevier() {
this.addreceiverinfo = {description: '', wxopenid: '', email: '', receiver_name: ''} this.addreceiverinfo = {description: '', wxopenid: '', email: '', receiver_name: '', verify_code: '', seicode: ''}
this.dialogReceiverVisible = true this.dialogReceiverVisible = true
this.title = '新增消息接收人' this.title = '新增消息接收人'
this.get_auth_code()
}, },
editReceiver(receiver) { editReceiver(receiver) {
this.title = '编辑 ' + receiver.receiver_name + ' 消息接收人' this.title = '编辑 ' + receiver.receiver_name + ' 消息接收人'
@ -442,7 +531,7 @@ export default {
}, },
cancelReceiver() { cancelReceiver() {
this.dialogReceiverVisible = false; this.dialogReceiverVisible = false;
this.addreceiverinfo = {description: '', wxopenid: '', email: '', receiver_name: ''} this.addreceiverinfo = {description: '', wxopenid: '', email: '', receiver_name: '', verify_code: '', seicode: ''}
}, },
saveReceiver() { saveReceiver() {
notifyReceiverInfo(data => { notifyReceiverInfo(data => {

@ -624,6 +624,20 @@ export function changeInfoFun(callBack, params, load = true) {
); );
} }
/**用户接收者验证 */
export function NotifyInfoFun(callBack, params, load = true) {
getData(
params.methods,
USERSEVER + '/notify/notify',
params.data,
data => {
callBack(data);
},
load,
true,
true
);
}
/**用户绑定域名*/ /**用户绑定域名*/
export function domainFun(callBack, params, load = true) { export function domainFun(callBack, params, load = true) {

@ -345,13 +345,13 @@ export function ImgToBase64(url, callback) {
}; };
} }
export function geetest(self, uid, params, callback) { export function geetest(self, uid, params, callback, http_func = loginFun) {
const loading = self.$loading({ const loading = self.$loading({
lock: true, lock: true,
text: 'Loading', text: 'Loading',
spinner: 'el-icon-loading', spinner: 'el-icon-loading',
}); });
return geetestbase(loginFun, self, uid, params, callback, res => { return geetestbase(http_func, self, uid, params, callback, res => {
self.$message({ self.$message({
message: res.msg, message: res.msg,
type: 'error' type: 'error'

@ -23,7 +23,7 @@ from api.views.login import LoginView, UserInfoView, RegistView, AuthorizationVi
UserApiTokenView, CertificationView, ChangeInfoView UserApiTokenView, CertificationView, ChangeInfoView
from api.views.login_wx import WeChatLoginView, WeChatLoginCheckView, WeChatBindView, WeChatWebLoginView from api.views.login_wx import WeChatLoginView, WeChatLoginCheckView, WeChatBindView, WeChatWebLoginView
from api.views.logout import LogoutView from api.views.logout import LogoutView
from api.views.notify import NotifyReceiverView, NotifyConfigView from api.views.notify import NotifyReceiverView, NotifyConfigView, NotifyInfoView
from api.views.order import PriceView, OrderView, PaySuccess, OrderSyncView from api.views.order import PriceView, OrderView, PaySuccess, OrderSyncView
from api.views.report import ReportView from api.views.report import ReportView
from api.views.storage import StorageView, CleanStorageView from api.views.storage import StorageView, CleanStorageView
@ -58,6 +58,7 @@ urlpatterns = [
re_path("^orders$", OrderView.as_view()), re_path("^orders$", OrderView.as_view()),
re_path("^notify/receiver$", NotifyReceiverView.as_view()), re_path("^notify/receiver$", NotifyReceiverView.as_view()),
re_path("^notify/config$", NotifyConfigView.as_view()), re_path("^notify/config$", NotifyConfigView.as_view()),
re_path("^notify/notify$", NotifyInfoView.as_view()),
re_path("^orders.sync$", OrderSyncView.as_view()), re_path("^orders.sync$", OrderSyncView.as_view()),
re_path("^certification$", CertificationView.as_view()), re_path("^certification$", CertificationView.as_view()),
re_path(r"^pay_success/(?P<name>\w+)$", PaySuccess.as_view()), re_path(r"^pay_success/(?P<name>\w+)$", PaySuccess.as_view()),

@ -198,11 +198,11 @@ def check_change_userinfo(target, act, key, user, ftype=None):
return res return res
def check_common_info(target, act): def check_common_info(target, act, k_type):
res = BaseResponse() res = BaseResponse()
res.data = {} res.data = {}
times_key = "%s_%s_%s" % ('report', act, target) times_key = f"{k_type}_{act}_{target}"
if act == "sms": if act == "sms":
if is_valid_phone(target): if is_valid_phone(target):
if login_auth_failed("get", times_key): if login_auth_failed("get", times_key):
@ -592,7 +592,7 @@ class AuthorizationView(APIView):
if ext and ext.get('report'): if ext and ext.get('report'):
app_obj = Apps.objects.filter(app_id=ext.get('report')).first() app_obj = Apps.objects.filter(app_id=ext.get('report')).first()
if app_obj: if app_obj:
res = check_common_info(target, act) res = check_common_info(target, act, 'report')
else: else:
res.code = 1003 res.code = 1003
res.msg = '未授权,请重新提交' res.msg = '未授权,请重新提交'

@ -105,6 +105,13 @@ class WeChatLoginCheckView(APIView):
w_type = wx_ticket_data.get('w_type', '') w_type = wx_ticket_data.get('w_type', '')
to_user = wx_ticket_data.get('to_user', '') to_user = wx_ticket_data.get('to_user', '')
user = UserInfo.objects.filter(pk=wx_ticket_data['pk']).first() user = UserInfo.objects.filter(pk=wx_ticket_data['pk']).first()
wx_obj = ThirdWeChatUserInfo.objects.filter(user_id=user, openid=to_user,
enable_login=True).filter()
if not wx_obj:
ret.msg = "还未绑定用户,请通过手机或者邮箱登录账户之后进行绑定"
ret.code = 1005
return Response(ret.dict)
if user.is_active: if user.is_active:
if to_user and w_type: if to_user and w_type:
ret.data = {'uid': user.uid, 'to_user': to_user, 'w_type': w_type} ret.data = {'uid': user.uid, 'to_user': to_user, 'w_type': w_type}

@ -12,11 +12,16 @@ from rest_framework.response import Response
from rest_framework.views import APIView from rest_framework.views import APIView
from api.models import NotifyReceiver, ThirdWeChatUserInfo, NotifyConfig, UserInfo from api.models import NotifyReceiver, ThirdWeChatUserInfo, NotifyConfig, UserInfo
from api.utils.auth.util import AuthInfo
from api.utils.modelutils import PageNumber from api.utils.modelutils import PageNumber
from api.utils.response import BaseResponse from api.utils.response import BaseResponse
from api.utils.serializer import NotifyReceiverSerializer, NotifyConfigSerializer from api.utils.serializer import NotifyReceiverSerializer, NotifyConfigSerializer
from common.base.baseutils import get_choices_dict, get_choices_name_from_key from api.views.login import check_common_info
from common.base.baseutils import get_choices_dict, get_choices_name_from_key, is_valid_email, is_valid_phone
from common.core.auth import ExpiringTokenAuthentication from common.core.auth import ExpiringTokenAuthentication
from common.core.sysconfig import Config
from common.utils.caches import login_auth_failed
from common.utils.sendmsg import is_valid_sender_code
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -155,8 +160,23 @@ class NotifyReceiverView(APIView):
if wx_obj: if wx_obj:
data_info['weixin'] = wx_obj data_info['weixin'] = wx_obj
if email: if email:
if is_valid_email(email):
act = 'email'
elif is_valid_phone(email):
act = 'sms'
else:
res.code = 1001
res.msg = "邮箱或手机校验有误"
return Response(res.dict)
is_valid, target = is_valid_sender_code(act, data.get("auth_token", None),
data.get("seicode", None))
if is_valid and str(target) == str(email):
if login_auth_failed("get", email):
data_info['email'] = email data_info['email'] = email
try: try:
if not data_info.get('email') and not data_info.get('weixin'):
raise Exception('至少存在一个联系方式')
NotifyReceiver.objects.create(user_id=request.user, **data_info) NotifyReceiver.objects.create(user_id=request.user, **data_info)
if wx_obj: if wx_obj:
wx_obj.enable_notify = True wx_obj.enable_notify = True
@ -173,3 +193,53 @@ class NotifyReceiverView(APIView):
if pk: if pk:
NotifyReceiver.objects.filter(user_id=request.user, pk=pk).delete() NotifyReceiver.objects.filter(user_id=request.user, pk=pk).delete()
return Response(res.dict) return Response(res.dict)
class NotifyInfoView(APIView):
authentication_classes = [ExpiringTokenAuthentication, ]
def get(self, request):
response = BaseResponse()
response.data = {}
allow_f = Config.NOTIFY.get("enable")
if allow_f:
auth_obj = AuthInfo(Config.NOTIFY.get("captcha"), Config.NOTIFY.get("geetest"))
response.data['auth_rules'] = auth_obj.make_rules_info()
response.data['notify_type'] = Config.NOTIFY.get("notify_type")
response.data['enable'] = allow_f
return Response(response.dict)
def put(self, request):
response = BaseResponse()
user_id = request.data.get('user_id', None)
if user_id:
auth_obj = AuthInfo(Config.NOTIFY.get("captcha"), Config.NOTIFY.get("geetest"))
response.data = auth_obj.make_geetest_info(user_id, request.META.get('REMOTE_ADDR'))
else:
response.code = 1002
response.msg = '参数错误'
return Response(response.dict)
def post(self, request):
res = BaseResponse()
res.data = {}
target = request.data.get("target", None)
p_data = Config.NOTIFY
auth_obj = AuthInfo(p_data.get("captcha"), p_data.get("geetest"))
is_valid, msg = auth_obj.valid(request.data)
if not is_valid:
res.code = 1001
res.msg = msg
return Response(res.dict)
if is_valid_email(target):
act = 'email'
elif is_valid_phone(target):
act = 'sms'
else:
res.code = 1001
res.msg = "邮箱或手机校验有误"
return Response(res.dict)
res = check_common_info(target, act, 'notify')
return Response(res.dict)

@ -42,10 +42,10 @@ class TextXMLParser(XMLParser):
media_type = 'text/xml' # 微信解析的是 text/xml media_type = 'text/xml' # 微信解析的是 text/xml
def reply_login_msg(rec_msg, to_user, from_user, ): def reply_login_msg(rec_msg, to_user, from_user):
content = f'还未绑定用户,请通过手机或者邮箱登录账户之后进行绑定' content = f'还未绑定用户,请通过手机或者邮箱登录账户之后进行绑定'
u_data_id = -1 u_data_id = -1
wx_user_obj = ThirdWeChatUserInfo.objects.filter(openid=to_user).first() wx_user_obj = ThirdWeChatUserInfo.objects.filter(openid=to_user, enable_login=True).first()
wx_ticket_info = get_wx_ticket_login_info_cache(rec_msg.Ticket) wx_ticket_info = get_wx_ticket_login_info_cache(rec_msg.Ticket)
@ -219,7 +219,7 @@ class ValidWxChatToken(APIView):
elif rec_msg.Event == 'SCAN': elif rec_msg.Event == 'SCAN':
if rec_msg.Eventkey == 'web.login': # 已经关注,然后再次扫码,登录认证操作 if rec_msg.Eventkey == 'web.login': # 已经关注,然后再次扫码,登录认证操作
result = reply_login_msg(rec_msg, to_user, from_user, ) result = reply_login_msg(rec_msg, to_user, from_user)
elif rec_msg.Eventkey.startswith('web.bind.'): elif rec_msg.Eventkey.startswith('web.bind.'):
result = wx_bind_utils(rec_msg, to_user, from_user, content) result = wx_bind_utils(rec_msg, to_user, from_user, content)
else: else:

@ -18,6 +18,6 @@ def common_exception_handler(exc, context):
logger.error(f'{context["view"].__class__.__name__} ERROR: {exc} ret:{ret}') logger.error(f'{context["view"].__class__.__name__} ERROR: {exc} ret:{ret}')
if not ret: # drf内置处理不了,丢给django 的,我们自己来处理 if not ret: # drf内置处理不了,丢给django 的,我们自己来处理
return ApiResponse(msg='error', result=str(exc), code=500) return ApiResponse(msg='error', result=str(exc), code=5000)
else: else:
return ApiResponse(msg='error', status=ret.status_code, **ret.data, ) return ApiResponse(msg='error', status=ret.status_code, **ret.data, )

@ -197,6 +197,11 @@ class AuthConfCache(WechatConfCache):
def CHANGER(self): def CHANGER(self):
return super().get_value('CHANGER', AUTHCONF.CHANGER) return super().get_value('CHANGER', AUTHCONF.CHANGER)
@property
def NOTIFY(self):
# return super().get_value('NOTIFY', AUTHCONF.NOTIFY)
return AUTHCONF.NOTIFY
@property @property
def LOGIN(self): def LOGIN(self):
return super().get_value('LOGIN', AUTHCONF.LOGIN) return super().get_value('LOGIN', AUTHCONF.LOGIN)

@ -126,6 +126,16 @@ class AUTHCONF(object):
'email': True, # 邮件举报 'email': True, # 邮件举报
} }
} }
NOTIFY = {
"enable": True,
"captcha": False, # 是否开启注册字母验证码
"geetest": True, # 是否开启geetest验证,如要开启请先配置geetest
"notify_type": {
'sms': False, # 短信通知
'email': True, # 邮件通知
'weixin': True, # 微信通知
}
}
class STORAGEKEYCONF(object): class STORAGEKEYCONF(object):

@ -3,7 +3,6 @@
# project: 3月 # project: 3月
# author: NinEveN # author: NinEveN
# date: 2022/3/9 # date: 2022/3/9
import os import os
import django import django
@ -11,7 +10,7 @@ import django
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'fir_ser.settings') os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'fir_ser.settings')
django.setup() django.setup()
from xsign.utils.ctasks import auto_check_ios_developer_active # from xsign.utils.ctasks import auto_check_ios_developer_active
# userinfo = UserInfo.objects.first() # userinfo = UserInfo.objects.first()
# developer_obj_list = AppIOSDeveloperInfo.objects.all() # developer_obj_list = AppIOSDeveloperInfo.objects.all()
@ -22,7 +21,7 @@ from xsign.utils.ctasks import auto_check_ios_developer_active
# {'username': userinfo.first_name, 'developer_obj_list': aa}) # {'username': userinfo.first_name, 'developer_obj_list': aa})
# #
# send_ios_developer_active_status(userinfo, content) # send_ios_developer_active_status(userinfo, content)
auto_check_ios_developer_active() # auto_check_ios_developer_active()
# from common.libs.apple.appleapiv3 import AppStoreConnectApi # from common.libs.apple.appleapiv3 import AppStoreConnectApi
# from xsign.models import AppIOSDeveloperInfo # from xsign.models import AppIOSDeveloperInfo
# #
@ -34,3 +33,53 @@ auto_check_ios_developer_active()
# res=apple_obj.disabled_device('ZZ4F3RM9H2','iPhone13,2','00008101-001560D00A60001E') # res=apple_obj.disabled_device('ZZ4F3RM9H2','iPhone13,2','00008101-001560D00A60001E')
# print(res) # print(res)
# to_user = 'opTae6mrV-MY1UOLahIVXaCDJhUU'
# wx_user_obj = ThirdWeChatUserInfo.objects.filter(openid=to_user).first()
# res = WxTemplateMsg().download_times_not_enough_msg(to_user, wx_user_obj.nickname, wx_user_obj.user_id.first_name,
# wx_user_obj.user_id.download_times)
# print(res)
# developer_obj = AppIOSDeveloperInfo.objects.filter(issuer_id='4257ad34-8fe8-4200-a827-5b09d9888371').first()
# otherStyleTime = developer_obj.cert_expire_time.strftime("%Y年%m月%d")
#
# res = WxTemplateMsg().cert_expired_msg(to_user, wx_user_obj.nickname, developer_obj.issuer_id, developer_obj.certid, otherStyleTime)
# print(res)
#
# user_obj = UserInfo.objects.filter(uid='47ed855a8e6411ec83f100163e1bfc45').first()
# order_obj = Order.objects.filter(order_number='12022323155915437216374686').first()
# for wx_user_obj in ThirdWeChatUserInfo.objects.filter(subscribe=True, user_id=user_obj).all():
# res = WxTemplateMsg().pay_success_msg(wx_user_obj.openid, wx_user_obj.nickname,
# f'{order_obj.actual_download_times} 下载次数',
# f'{str(order_obj.actual_amount / 100)} 元',
# order_obj.get_payment_type_display(),
# order_obj.pay_time.strftime("%Y/%m/%d %H:%M:%S"),
# order_obj.order_number, order_obj.description)
from api.models import UserInfo, NotifyReceiver, NotifyConfig
# from common.notify.wx import check_apple_developer_devices
#
user_obj = UserInfo.objects.filter(uid='47ed855a8e6411ec83f100163e1bfc45').first()
# check_apple_developer_devices(user_obj)
notify_config_obj = NotifyConfig.objects.create(user_id=user_obj, message_type=0,
config_name='下载次数不足3323',
enable_email=True, enable_weixin=True, description='次数不足')
notify_config_obj.sender.set(NotifyReceiver.objects.filter(user_id=user_obj).all())
#
# developer_obj = AppIOSDeveloperInfo.objects.filter(issuer_id='69a6de96-c16e-47e3-e053-5b8c7c11a4d1').first()
#
# res = IosUtils.get_developer_cert_info(developer_obj)
# print(res)
# app_dev_pem = '/data/flyapps/fir_ser/supersign/459a0d8a2b80539f80613db0de775518/459a0d8a2b80539f80613db0de775518.pem'
# cer = load_certificate(FILETYPE_PEM, open(app_dev_pem, 'rb').read())
#
# not_after = datetime.datetime.strptime(cer.get_notAfter().decode('utf-8'), "%Y%m%d%H%M%SZ")
# print(not_after, hex(cer.get_serial_number()), cer.get_serial_number())
# x = '4257FF461CEEBC5CCC83225192AC5518'
# print(int(x, 16))
#
# udid_result_list = [1, 2, 3, 4, 5, 6, 7, 8]
# udid_developer_list = [2, 3, 4, 5, 6]
# udid_same = set(udid_result_list) & set(udid_developer_list)
# same_p = (len(udid_same) / len(udid_result_list) + len(udid_same) / len(udid_developer_list)) / 2
# print(same_p, same_p < 0.8)

Loading…
Cancel
Save