Commit 277d5847 authored by Davve's avatar Davve

修改明星错误

parent cce80f95
...@@ -52,19 +52,15 @@ class CelebrityUpdateOrCreate(APIView): ...@@ -52,19 +52,15 @@ class CelebrityUpdateOrCreate(APIView):
def post(self, request): def post(self, request):
id = request.POST.get('id', '') id = request.POST.get('id', '')
print(request.POST, '----')
gender = request.POST.get('gender') gender = request.POST.get('gender')
group_ids = list(set(map(lambda x: x.split(":")[0], json.loads(request.POST.get('groups', '[]')))))
updates = { updates = {
'group_ids': '',
'gender': '' 'gender': ''
} }
if not id: if not id:
group_ids = list(set(map(lambda x: x.split(":")[0], json.loads(request.POST.get('groups', '[]')))))
updates['group_ids'] = group_ids
updates['gender'] = int(gender) updates['gender'] = int(gender)
else: else:
updates['group_ids'] = list(set(json.loads(request.POST.get('groups', '[]'))))
if gender == '男': if gender == '男':
updates['gender'] = 0 updates['gender'] = 0
elif gender == '女': elif gender == '女':
...@@ -77,7 +73,7 @@ class CelebrityUpdateOrCreate(APIView): ...@@ -77,7 +73,7 @@ class CelebrityUpdateOrCreate(APIView):
'is_online': int(request.POST.get('is_online')), 'is_online': int(request.POST.get('is_online')),
'desc': request.POST.get('description'), 'desc': request.POST.get('description'),
'portrait': request.POST.get('avatar')[:-2], 'portrait': request.POST.get('avatar')[:-2],
'group_ids': updates['group_ids'], 'group_ids': group_ids,
} }
try: try:
self.rpc['venus/sun/celebrity/edit'](id=id, data=data).unwrap() self.rpc['venus/sun/celebrity/edit'](id=id, data=data).unwrap()
......
...@@ -387,7 +387,7 @@ ...@@ -387,7 +387,7 @@
fetchStarRelatedGroup(this.listQuery).then(response => { fetchStarRelatedGroup(this.listQuery).then(response => {
let rep = response.data.data.data; let rep = response.data.data.data;
for (let i = 0; i < rep.length; i++){ for (let i = 0; i < rep.length; i++){
this.group_ids.push(rep[i].id) this.group_ids.push(rep[i].id + ':' + rep[i].name)
} }
this.tableData = response.data.data.data this.tableData = response.data.data.data
this.total = response.data.data.total this.total = response.data.data.total
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment