diff --git a/fir_client/src/components/FirAppInfosBase.vue b/fir_client/src/components/FirAppInfosBase.vue index 75b7614..4a3622c 100644 --- a/fir_client/src/components/FirAppInfosBase.vue +++ b/fir_client/src/components/FirAppInfosBase.vue @@ -12,6 +12,7 @@ {{ appinfos.count_hits }} BundleID  {{ appinfos.bundle_id }} {{ master_release.minimum_os_version }}  或者高版本 + 已经开启超级签
@@ -33,7 +34,7 @@ 应用合并 - + 设备列表 @@ -111,7 +112,11 @@ }, devices(){ this.setfunactive('devices',57); - this.$router.push({name: 'FirAppInfosdevices'}); + if(this.appinfos.issupersign){ + this.$router.push({"name":'FirSuperSignBase', params: {act: "useddevices"},query:{bundleid:this.appinfos.bundle_id}}) + }else { + this.$router.push({name: 'FirAppInfosdevices'}); + } }, }, created() { diff --git a/fir_client/src/components/FirAppInfossecurity.vue b/fir_client/src/components/FirAppInfossecurity.vue index 0984e3f..f379fb3 100644 --- a/fir_client/src/components/FirAppInfossecurity.vue +++ b/fir_client/src/components/FirAppInfossecurity.vue @@ -84,7 +84,8 @@ }, methods: { clean_app(){ - this.saveappinfo({"clean":true}) + this.saveappinfo({"clean":true}); + this.currentapp.count = 0; }, saveappinfo(data) { updateapp(data => { diff --git a/fir_client/src/components/FirApps.vue b/fir_client/src/components/FirApps.vue index d3a89aa..6c9c9e8 100644 --- a/fir_client/src/components/FirApps.vue +++ b/fir_client/src/components/FirApps.vue @@ -9,13 +9,13 @@ :visible.sync="willDeleteApp" width="50%"> - 请先在权限管理页面关闭超级签名 + 该应用开启了超级签名,执行删除操作,将会删除相关开发者账户下的证书等数据,可能会导致已经下载的APP闪退,并且删除后不可恢复,请谨慎操作 删除后不可恢复,请谨慎操作 取 消 - 确 定 - 确 定 + + 确 定 @@ -651,11 +651,6 @@ this.$store.dispatch("getUser", data.userinfo); this.searchapps(); - let upload_domain = data.hdata.upload_domain; - if (!upload_domain) { - upload_domain = location.origin; - } - // this.$store.dispatch('doucurrentapp', {'firapps':1}); } else { diff --git a/fir_client/src/components/FirHeader.vue b/fir_client/src/components/FirHeader.vue index b65853f..09cd619 100644 --- a/fir_client/src/components/FirHeader.vue +++ b/fir_client/src/components/FirHeader.vue @@ -53,12 +53,6 @@ import {logout} from '../restful' appName: '', } }, methods: { - handleSelect() { - - }, - checkUrl() { - - }, handleCommand(command) { if (command === 'userinfo') { this.$router.push({name: 'FirUserProfileInfo'}) @@ -67,7 +61,8 @@ import {logout} from '../restful' }else if (command === 'storage') { this.$router.push({name: 'FirUserProfileStorage'}) }else if (command === 'supersign') { - this.$router.push({name: 'FirSuperSignBase'}) + this.$router.push({"name":'FirSuperSignBase', params: {act: "iosdeveloper"}}) + } else if(command === 'exit'){ logout(data => { diff --git a/fir_client/src/components/FirSuperSignBase.vue b/fir_client/src/components/FirSuperSignBase.vue index b15638a..885e947 100644 --- a/fir_client/src/components/FirSuperSignBase.vue +++ b/fir_client/src/components/FirSuperSignBase.vue @@ -45,6 +45,13 @@ + + 搜索 + 删除 + @click="handleDeleteDeveloper(scope.row)">删除 @@ -112,6 +119,23 @@ 添加开发者 + + + + 搜索 + - 搜索 + 搜索 + + 删除 + @click="udidDeleteFun(scope)">删除 +
+ + +
@@ -235,7 +272,8 @@ diff --git a/fir_client/src/router/index.js b/fir_client/src/router/index.js index a3084e8..ff29bcb 100644 --- a/fir_client/src/router/index.js +++ b/fir_client/src/router/index.js @@ -123,7 +123,7 @@ const router = new VueRouter({ component: FirAppBase, children: [ { - path: '', + path: ':act', name: 'FirSuperSignBase', component: FirSuperSignBase, } diff --git a/fir_client/src/utils/index.js b/fir_client/src/utils/index.js index 05d03b8..8dd7978 100644 --- a/fir_client/src/utils/index.js +++ b/fir_client/src/utils/index.js @@ -176,4 +176,24 @@ import {uploadstorage} from '../restful' export function uploadlocalstorage(file,certinfo,app,successcallback,processcallback) { uploadstorage(certinfo,file,successcallback,processcallback) +} + +export function removeAaary(_arr, _obj) { + var length = _arr.length; + for (var i = 0; i < length; i++) { + if (_arr[i] == _obj) { + if (i == 0) { + _arr.shift(); //删除并返回数组的第一个元素 + return _arr; + } + else if (i == length - 1) { + _arr.pop(); //删除并返回数组的最后一个元素 + return _arr; + } + else { + _arr.splice(i, 1); //删除下标为i的元素 + return _arr; + } + } + } } \ No newline at end of file diff --git a/fir_ser/api/models.py b/fir_ser/api/models.py index b047a0f..d4bc8e8 100644 --- a/fir_ser/api/models.py +++ b/fir_ser/api/models.py @@ -114,7 +114,7 @@ class Apps(models.Model): indexes = [models.Index(fields=['app_id']),models.Index(fields=['id','user_id','type'])] def __str__(self): - return "%s %s" % (self.name,self.get_type_display()) + return "%s %s-%s %s %s" % (self.name,self.get_type_display(),self.short,self.has_combo,self.issupersign) class AppReleaseInfo(models.Model): diff --git a/fir_ser/api/utils/app/supersignutils.py b/fir_ser/api/utils/app/supersignutils.py index 5790d75..23870ac 100644 --- a/fir_ser/api/utils/app/supersignutils.py +++ b/fir_ser/api/utils/app/supersignutils.py @@ -197,12 +197,14 @@ class IosUtils(object): } #更新已经完成签名状态,设备消耗记录,和开发者已消耗数量 AppUDID.objects.filter(app_id=self.app_obj, udid=self.udid_info.get('udid')).update(**newdata) + + if APPSuperSignUsedInfo.objects.filter(udid__udid=self.udid_info.get('udid'),developerid=self.developer_obj).count() == 0: + developer_obj = self.developer_obj + developer_obj.use_number=developer_obj.use_number + 1 + developer_obj.save() + APPSuperSignUsedInfo.objects.create(app_id=self.app_obj, user_id=self.user_obj, developerid=self.developer_obj, udid=AppUDID.objects.filter(app_id=self.app_obj,udid=self.udid_info.get('udid')).first()) - developer_obj = AppIOSDeveloperInfo.objects.filter(user_id=self.user_obj, is_actived=True, - use_number__lte=F("usable_number")).first() - developer_obj.use_number=self.developer_obj.use_number + 1 - developer_obj.save() # 生成新的ipa,然后替换release,或许,binary_file 这个字段已经无用 # AppReleaseInfo.objects.filter(app_id=self.app_obj,is_master=True).update(release_id=random_file_name) @@ -211,7 +213,7 @@ class IosUtils(object): #创建 - apptodev_obj=APPToDeveloper.objects.filter(developerid=developer_obj,app_id=self.app_obj).first() + apptodev_obj=APPToDeveloper.objects.filter(developerid=self.developer_obj,app_id=self.app_obj).first() if apptodev_obj: storage = Storage(self.user_obj) storage.delete_file(apptodev_obj.binary_file, release_obj.release_type) @@ -220,7 +222,7 @@ class IosUtils(object): apptodev_obj.save() else: - APPToDeveloper.objects.create(developerid=developer_obj,app_id=self.app_obj,binary_file=random_file_name) + APPToDeveloper.objects.create(developerid=self.developer_obj,app_id=self.app_obj,binary_file=random_file_name) @staticmethod def disable_udid(udid_obj,app_id): @@ -235,8 +237,8 @@ class IosUtils(object): } # 需要判断该设备在同一个账户下 的多个应用,若存在,则不操作 - udid_lists=APPSuperSignUsedInfo.objects.values_list("udid__udid").filter(developerid=developer_obj) - if len(udid_lists) == len(set(udid_lists)): + udid_lists=list(APPSuperSignUsedInfo.objects.values_list("udid__udid").filter(developerid=developer_obj)) + if udid_lists.count((udid_obj.udid,)) == 1: app_api_obj = AppDeveloperApi(**auth) app_api_obj.set_device_status("disable",udid_obj.udid) @@ -257,29 +259,30 @@ class IosUtils(object): APPToDeveloper.objects.filter(developerid=developer_obj,app_id_id=app_id).delete() @staticmethod - def clean_udid_by_app_obj(app_obj): - for SuperSignUsed_obj in APPSuperSignUsedInfo.objects.filter(app_id=app_obj): - udid_obj = SuperSignUsed_obj.udid - developer_obj=SuperSignUsed_obj.developerid + def clean_udid_by_app_obj(app_obj,developer_obj): - auth = { - "username": developer_obj.email, - "password": developer_obj.password, - "certid": developer_obj.certid - } + auth = { + "username": developer_obj.email, + "password": developer_obj.password, + "certid": developer_obj.certid + } - # 需要判断该设备在同一个账户下 的多个应用,若存在,则不操作 - udid_lists = APPSuperSignUsedInfo.objects.values_list("udid__udid").filter(developerid=developer_obj) - if len(udid_lists) == len(set(udid_lists)): + + # 需要判断该设备在同一个账户下 的多个应用,若存在,则不操作 + udid_lists = list(APPSuperSignUsedInfo.objects.values_list("udid__udid").filter(developerid=developer_obj)) + + for SuperSignUsed_obj in APPSuperSignUsedInfo.objects.filter(app_id=app_obj, developerid=developer_obj): + udid_obj = SuperSignUsed_obj.udid + + if udid_lists.count((udid_obj.udid,)) == 1: app_api_obj = AppDeveloperApi(**auth) app_api_obj.set_device_status("disable", udid_obj.udid) - if developer_obj.use_number > 0: - developer_obj.use_number = developer_obj.use_number - 1 - developer_obj.save() - - udid_obj.delete() + if developer_obj.use_number > 0: + developer_obj.use_number = developer_obj.use_number - 1 + developer_obj.save() + udid_obj.delete() SuperSignUsed_obj.delete() @@ -299,7 +302,7 @@ class IosUtils(object): IosUtils.clean_app_by_developer_obj(app_obj,developer_obj) APPToDeveloper.objects.filter(developerid=developer_obj,app_id=app_obj).delete() - IosUtils.clean_udid_by_app_obj(app_obj) + IosUtils.clean_udid_by_app_obj(app_obj,developer_obj) @staticmethod def clean_app_by_developer_obj(app_obj,developer_obj): auth = { @@ -319,18 +322,27 @@ class IosUtils(object): :param developer_obj: :return: ''' - auth = { - "username": developer_obj.email, - "password": developer_obj.password, - "certid": developer_obj.certid - } - for SuperSignUsed_obj in APPSuperSignUsedInfo.objects.filter(developerid=developer_obj): - app_obj = SuperSignUsed_obj.app_id - app_api_obj = AppDeveloperApi(**auth) - app_api_obj.del_profile(app_obj.bundle_id, app_obj.app_id) - app_api_obj2 = AppDeveloperApi(**auth) - app_api_obj2.del_app(app_obj.bundle_id,app_obj.app_id) + # auth = { + # "username": developer_obj.email, + # "password": developer_obj.password, + # "certid": developer_obj.certid + # } + + for APPToDeveloper_obj in APPToDeveloper.objects.filter(developerid=developer_obj): + app_obj=APPToDeveloper_obj.app_id + IosUtils.clean_app_by_developer_obj(app_obj, developer_obj) APPToDeveloper.objects.filter(developerid=developer_obj, app_id=app_obj).delete() + IosUtils.clean_udid_by_app_obj(app_obj, developer_obj) + + + # for SuperSignUsed_obj in APPSuperSignUsedInfo.objects.filter(developerid=developer_obj): + # + # app_obj = SuperSignUsed_obj.app_id + # app_api_obj = AppDeveloperApi(**auth) + # app_api_obj.del_profile(app_obj.bundle_id, app_obj.app_id) + # app_api_obj2 = AppDeveloperApi(**auth) + # app_api_obj2.del_app(app_obj.bundle_id,app_obj.app_id) + # APPToDeveloper.objects.filter(developerid=developer_obj, app_id=app_obj).delete() @staticmethod def active_developer(developer_obj,code=None): diff --git a/fir_ser/api/views/apps.py b/fir_ser/api/views/apps.py index 261f81c..1663918 100644 --- a/fir_ser/api/views/apps.py +++ b/fir_ser/api/views/apps.py @@ -118,6 +118,9 @@ class AppInfoView(APIView): if app_id: apps_obj = Apps.objects.filter(user_id=request.user, app_id=app_id).first() if apps_obj: + if apps_obj.issupersign: + IosUtils.clean_app_by_user_obj(apps_obj, request.user) + storage = Storage(request.user) has_combo = apps_obj.has_combo if has_combo: diff --git a/fir_ser/api/views/supersign.py b/fir_ser/api/views/supersign.py index 8ff7093..d187058 100644 --- a/fir_ser/api/views/supersign.py +++ b/fir_ser/api/views/supersign.py @@ -29,19 +29,20 @@ class DeveloperView(APIView): res = BaseResponse() + appid = request.query_params.get("appid", None) developer_obj = AppIOSDeveloperInfo.objects.filter(user_id=request.user) + if appid: + developer_obj=developer_obj.filter(email=appid) page_obj = AppsPageNumber() app_page_serializer = page_obj.paginate_queryset(queryset=developer_obj.order_by("-updated_time"), request=request, view=self) - Developer_serializer = DeveloperSerializer(app_page_serializer, many=True,) userserializer = UserInfoSerializer(request.user) res.userinfo = {} - res.has_next = {} res.userinfo = userserializer.data res.data = Developer_serializer.data - res.has_next = page_obj.page.has_next() + res.count=developer_obj.count() return Response(res.dict) def put(self,request): @@ -49,9 +50,6 @@ class DeveloperView(APIView): email=data.get("email",None) if email: developer_obj = AppIOSDeveloperInfo.objects.filter(user_id=request.user,email=email).first() - - - if developer_obj: act = data.get("act", None) if act: @@ -101,19 +99,41 @@ class DeveloperView(APIView): return self.get(request) + def delete(self,request): + email=request.query_params.get("email",None) + if email: + developer_obj = AppIOSDeveloperInfo.objects.filter(user_id=request.user,email=email).first() + if developer_obj: + IosUtils.clean_developer(developer_obj) + developer_obj.delete() + + return self.get(request) class SuperSignUsedView(APIView): authentication_classes = [ExpiringTokenAuthentication, ] def get(self, request): res = BaseResponse() - developer_obj = APPSuperSignUsedInfo.objects.filter(user_id=request.user) + + udid = request.query_params.get("udid", None) + bundleid = request.query_params.get("bundleid", None) + developerid = request.query_params.get("appid", None) + + SuperSignUsed_obj = APPSuperSignUsedInfo.objects.filter(user_id=request.user,) + + if developerid: + SuperSignUsed_obj=SuperSignUsed_obj.filter(developerid__email=developerid) + if udid: + SuperSignUsed_obj = SuperSignUsed_obj.filter(udid__udid=udid) + if bundleid: + SuperSignUsed_obj = SuperSignUsed_obj.filter(app_id__bundle_id=bundleid) + page_obj = AppsPageNumber() - app_page_serializer = page_obj.paginate_queryset(queryset=developer_obj.order_by("-created_time"), request=request, + app_page_serializer = page_obj.paginate_queryset(queryset=SuperSignUsed_obj.order_by("-created_time"), request=request, view=self) app_serializer = SuperSignUsedSerializer(app_page_serializer, many=True, ) res.data = app_serializer.data - res.has_next = page_obj.page.has_next() + res.count=SuperSignUsed_obj.count() return Response(res.dict) class AppUDIDUsedView(APIView): @@ -124,27 +144,25 @@ class AppUDIDUsedView(APIView): udid = request.query_params.get("udid", None) bundleid = request.query_params.get("bundleid", None) - if udid and bundleid: - developer_obj = AppUDID.objects.filter(app_id__user_id_id=request.user,app_id__bundle_id=bundleid,udid=udid) - elif udid: - developer_obj = AppUDID.objects.filter(app_id__user_id_id=request.user,udid=udid) - elif bundleid: - developer_obj = AppUDID.objects.filter(app_id__user_id_id=request.user,app_id__bundle_id=bundleid) - else: - developer_obj = AppUDID.objects.filter(app_id__user_id_id=request.user) + AppUDID_obj = AppUDID.objects.filter(app_id__user_id_id=request.user) + if udid: + AppUDID_obj = AppUDID_obj.filter(udid=udid) + if bundleid: + AppUDID_obj = AppUDID_obj.filter(app_id__bundle_id=bundleid) page_obj = AppsPageNumber() - app_page_serializer = page_obj.paginate_queryset(queryset=developer_obj.order_by("-created_time"), request=request, + app_page_serializer = page_obj.paginate_queryset(queryset=AppUDID_obj.order_by("-created_time"), request=request, view=self) app_serializer = DeviceUDIDSerializer(app_page_serializer, many=True,) res.data = app_serializer.data - res.has_next = page_obj.page.has_next() + res.count=AppUDID_obj.count() return Response(res.dict) def delete(self,request): + res = BaseResponse() id = request.query_params.get("id", None) app_id = request.query_params.get("aid", None) app_udid_obj=AppUDID.objects.filter(app_id__user_id_id=request.user,pk=id) IosUtils.disable_udid(app_udid_obj.first(),app_id) app_udid_obj.delete() - return self.get(request) + return Response(res.dict) diff --git a/fir_ser/tests/postudid.py b/fir_ser/tests/postudid.py new file mode 100644 index 0000000..7ec262b --- /dev/null +++ b/fir_ser/tests/postudid.py @@ -0,0 +1,45 @@ + +import requests +import random +short=["bgql","wjbu","vnfg","bgql"] + +udid_lists=[ + "f55df38afe5c1242b8bc478d0182bbd0d7d08929", + "f55df38afe5c1242b8bc478d0182bbd0d7d08929", + "f55df38afe5c1242b8bc478d0182bbd0d7d08922", + "f55df38afe5c1242b8bc478d0182bbd0d7d01129", + "f55df38afe5c1242b8bc478d0182bbd0d723929", + "f55df38afe5c1242b8bc478d0182bbd0d7d118929", + "f55df38afe5c1242b8bc478d0182bbd0d7d08929", + "f55df38afe5c1242b8bc478d0182bbd0daed08929", + "f55df38afe5c1242b8bc478d0182bbd0d7d08929", + "f55df38afe5c1242b8bc478d0182bbdfsdfe7d08929", + "f55df38afe5c1242b8bc478d0182bbdfsdfe7d08929", + "f55df38afe5c1242b8bc478d0182bbdfsdfe7d08929", + "f55df38afe5c1242b8bc478d0182dsfsdd7d08929", + "f55df38afe5c1242b8bc478d0182dsfsdd7d08929", + "f55df38afe5c1242b8bc478d0182dsfsdd7d08929", + "f55df38afe5c1242b8bc478d0182bbdsdfsadf8929", + "f55df38afe5c1242b8bc478d01sdsdfsdd0d7d08929", + "f55df38afe5c1242b8bc478sdfsdffsdafd7d08929", + "f55df38afe5c1242b8bc478sdfsdffsdafd7d08929", + "f55df38afe5c1242b8bc478sdfsdffsdafd7d08929", + "f55df38afe5c1242b8bc478d0182bbd0d7d08929", + "f55df38afe5c1242b8bc478dsdfeasdfbbd0d7d08929", + "f55df38afe5c1242b8bc478dfsdfseasbd0d7d08929", + "f55df38afe5c1242b8bc478d0sdfseafsdbbd0d7d08929", + "f55df38afe5c1242b8asdfae8ds2bbd0d7d118929", + "f55df38afe5c1242b8bc47sfsdf2bbd0d7dd18929", + "f55df38afe5c1242b8bc478d0182bbd0d7d0ae8929", + "f55df38afe5c1242b8bc478d0182bbd0d7dsfe08929", +] + + + + +for udid in udid_lists: + data='\n\n\n\n\tPRODUCT\n\tiPhone9,1\n\tSERIAL\n\tF71YD58GHG74\n\tUDID\n\t%s\n\tVERSION\n\t17E262\n\n\n' %(udid) + uri = "https://fly.harmonygames.cn/udid/%s" % (random.choice(short)) + # uri = "https://fly.harmonygames.cn/udid/%s" % ("bgql") + req=requests.post(uri,data=data ) + print(req.status_code) \ No newline at end of file