修复开发者账户使用量显示

super_signature
nineven 5 years ago
parent 695c1c9ad1
commit 03c59c4fcf
  1. 35
      fir_client/src/components/FirSuperSignBase.vue
  2. 20
      fir_ser/api/views/supersign.py

@ -51,6 +51,13 @@
clearable
placeholder="输入用户APPID" />
<el-button type="primary" icon="el-icon-search" @click="handleCurrentChange(pagination.currentPage)">搜索</el-button>
<div style="width: 40%;margin-right: 30px;float:right">
<el-link :underline="false">总设备量{{ developer_used_info.all_usable_number}} 已经使用{{ developer_used_info.all_use_number}} 还剩{{ developer_used_info.now_can_use_number}} 可用</el-link>
<el-progress
type="line"
:color="developer_usedColor"
:text-inside="true" :stroke-width="18" :percentage="percentage" status="success"></el-progress>
</div>
<el-table
:data="app_developer_lists"
@ -292,11 +299,29 @@
isedit:false,
placeholder:"",
codeactiveVisible:false,
pagination:{"currentPage":1,"total":0,"pagesize":10}
pagination:{"currentPage":1,"total":0,"pagesize":10},
developer_used_info:{},
percentage:0,
}
},
methods: {
developer_usedColor(percentage){
if (percentage < 20) {
return '#6f7ad3';
} else if (percentage < 40) {
return '#1989fa';
} else if (percentage < 60) {
return '#5cb87a';
} else if (percentage < 80) {
return '#e6a23c';
} else if(percentage<90){
return '#E63918';
}else {
return '#F50346';
}
},
udidDeleteFun(scope){
this.iosdevicesudidFun('DELETE',{id:scope.row.id,aid:scope.row.app_id});
this.app_udid_lists=removeAaary(this.app_udid_lists,scope.row)
@ -432,8 +457,12 @@
if(data.code === 1000){
this.app_developer_lists = data.data;
this.pagination.total=data.count;
this.$store.dispatch("getUser",data.userinfo);
this.$store.dispatch('doucurrentapp', {});
this.developer_used_info=data.use_num;
if(this.developer_used_info.all_usable_number ===0){
this.percentage=0
}else {
this.percentage=parseInt(this.developer_used_info.all_use_number*100/this.developer_used_info.all_usable_number);
}
if(this.dialogaddDeveloperVisible){
this.canceledit();
this.$message.success("操作成功");

@ -12,6 +12,7 @@ from api.models import AppIOSDeveloperInfo,APPSuperSignUsedInfo,AppUDID
from api.utils.serializer import DeveloperSerializer, UserInfoSerializer,SuperSignUsedSerializer,DeviceUDIDSerializer
from rest_framework.pagination import PageNumberPagination
from api.utils.app.supersignutils import IosUtils
from django.db.models import Sum,F
@ -31,6 +32,21 @@ class DeveloperView(APIView):
appid = request.query_params.get("appid", None)
developer_obj = AppIOSDeveloperInfo.objects.filter(user_id=request.user)
use_number_obj = developer_obj.filter(is_actived=True)
if use_number_obj:
use_number_dict=use_number_obj.aggregate(usable_number=Sum('usable_number'),use_number=Sum('use_number'))
use_number_dict2=use_number_obj.filter(use_number__lt=F("usable_number")).aggregate(usable_number=Sum('usable_number'),use_number=Sum('use_number'))
now_can_use_number=0
if use_number_dict2 and use_number_dict2.get("usable_number",0) and use_number_dict2.get("use_number", 0):
now_can_use_number = use_number_dict2.get("usable_number",0)-use_number_dict2.get("use_number", 0)
res.use_num={
"all_usable_number":use_number_dict.get("usable_number", 0),
"all_use_number":use_number_dict.get("use_number", 0),
"now_can_use_number":now_can_use_number
}
if appid:
developer_obj=developer_obj.filter(email=appid)
@ -38,9 +54,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,)
userserializer = UserInfoSerializer(request.user)
res.userinfo = {}
res.userinfo = userserializer.data
res.data = Developer_serializer.data
res.count=developer_obj.count()
return Response(res.dict)

Loading…
Cancel
Save