优化代码

qrnn
youngS 3 years ago
parent 205505cb0e
commit def6c9dfc8
  1. 33
      fir_client/src/components/base/AppleDeveloperBindApp.vue
  2. 3
      fir_client/src/components/user/FirSuperSignBase.vue
  3. 15
      fir_client/src/utils/index.js
  4. 17
      fir_ser/api/views/supersign.py

@ -4,6 +4,7 @@
<div style="text-align: center">
<el-transfer
v-model="choices_data"
v-loading="loadings"
:button-texts="['', '']"
:data="app_developer_lists"
:format="{
@ -83,7 +84,8 @@
</template>
<script>
import {developerBindAppFun, iosdeveloper} from "@/restful";
import {developerBindAppFun} from "@/restful";
import {sort_compare} from "@/utils";
export default {
name: 'AppleDeveloperBindApp',
@ -110,7 +112,8 @@ export default {
choices_data_list: [],
s_props: {},
s_titles: [],
app_private_used_number: 100
app_private_used_number: 100,
loadings: false
};
},
mounted() {
@ -169,7 +172,7 @@ export default {
disabled: 'is_disabled'
}
this.s_titles = ['可分配签名开发者账户', '已分配签名开发者账户']
this.iosdeveloperFun()
this.getBindInfo({act: 'developer'})
}
this.getBindInfo({})
},
@ -187,23 +190,8 @@ export default {
data: {'app_id': this.app_id, 'issuer_id': this.issuer_id, 'choices_data': this.choices_data}
})
},
iosdeveloperFun() {
this.loadingfun = this.$loading({
lock: true,
text: '执行中,请耐心等待...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
iosdeveloper(data => {
if (data.code === 1000) {
this.app_developer_lists = data.data;
}
this.loadingfun.close()
}
,
{"methods": 'GET', "data": {app_id: this.app_id, issuer_id: this.issuer_id, size: 1000}})
},
getBindInfo(params) {
this.loadings = true
if (this.issuer_id) {
params.issuer_id = this.issuer_id
}
@ -212,18 +200,21 @@ export default {
}
developerBindAppFun(data => {
if (data.code === 1000) {
if (params.act === 'apps') {
if (params.act === 'apps' || params.act === 'developer') {
this.app_developer_lists = data.data
if (params.act === 'developer') {
this.app_developer_lists.sort(sort_compare('developer_used_number'))
}
this.get_choice_data_from_key(this.choices_data)
} else {
this.choices_data_list = data.data;
this.choices_data = this.format_data(data.data)
this.get_choice_data_from_key(this.choices_data)
this.$message.success("数据获取成功")
}
} else {
this.$message.error("数据获取失败" + data.msg)
}
this.loadings = false
}, {methods: 'GET', data: params})
},
format_data(data) {

@ -75,7 +75,8 @@
type="danger"
@click="cleandevices">清理签名数据
</el-button>
<el-button v-if="isedit && editdeveloperinfo.is_actived || editdeveloperinfo.certid" size="small" @click="syncdevices">同步设备信息
<el-button v-if="isedit && editdeveloperinfo.is_actived || editdeveloperinfo.certid" size="small"
@click="syncdevices">同步设备信息
</el-button>
<el-tooltip content="发布证书只能创建两个,请谨慎操作">
<el-button v-if="isedit && !editdeveloperinfo.certid"

@ -673,3 +673,18 @@ export function upspeed(start_time, file_size, percent) {
const now_time = Date.now();
return diskSize(file_size * percent * 10 / (now_time - start_time))
}
export function sort_compare(propertyName) {
return function (object1, object2) {
let value1 = object1[propertyName];
let value2 = object2[propertyName];
if (value2 < value1) {
return 1;
} else if (value2 > value1) {
return -1;
} else {
return 0;
}
}
}

@ -38,14 +38,10 @@ class DeveloperView(APIView):
permission_classes = [SuperSignPermission, ]
def get(self, request):
res = BaseResponse()
issuer_id = request.query_params.get("issuer_id", '')
app_id = request.query_params.get("app_id", '')
developer_choice = request.query_params.get("developer_choice", None)
developer_obj = AppIOSDeveloperInfo.objects.filter(user_id=request.user)
if developer_choice and developer_choice in ['private', 'public']:
if developer_choice == 'public':
developer_obj = developer_obj.exclude(appledevelopertoappuse__developerid__isnull=False)
@ -60,7 +56,7 @@ class DeveloperView(APIView):
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, context={'app_id': app_id})
developer_serializer = DeveloperSerializer(app_page_serializer, many=True)
res.data = developer_serializer.data
res.count = developer_obj.count()
@ -433,14 +429,14 @@ class DeviceUsedRankInfoView(APIView):
def get(self, request):
res = BaseResponse()
page_obj = PageNumber()
appnamesearch = request.query_params.get("appnamesearch")
search_key = request.query_params.get("appnamesearch")
start_time = request.query_params.get("start_time")
end_time = request.query_params.get("end_time")
app_used_sign_objs = APPSuperSignUsedInfo.objects.filter(user_id=request.user)
if appnamesearch:
if search_key:
app_used_sign_objs = app_used_sign_objs.filter(
Q(app_id__name=appnamesearch) | Q(app_id__bundle_id=appnamesearch) | Q(
developerid__issuer_id=appnamesearch))
Q(app_id__name=search_key) | Q(app_id__bundle_id=search_key) | Q(
developerid__issuer_id=search_key))
if end_time and start_time:
try:
start_time = datetime.date.fromtimestamp(int(start_time) / 1000)
@ -480,6 +476,9 @@ class AppleDeveloperBindAppsView(APIView):
apps_obj_list = Apps.objects.filter(user_id=request.user, type=1).all()
app_serializer = AppleDeveloperToAppUseAppsSerializer(apps_obj_list, many=True,
context={'issuer_id': issuer_id})
elif act == 'developer':
developer_obj = AppIOSDeveloperInfo.objects.filter(user_id=request.user).all()
app_serializer = DeveloperSerializer(developer_obj, many=True, context={'app_id': app_id})
else:
apple_to_app_obj = AppleDeveloperToAppUse.objects.filter(app_id__user_id=request.user)
if issuer_id:

Loading…
Cancel
Save