|
@@ -251,13 +251,19 @@ class UnicomComboView(View):
|
|
|
1:-1].split(',') # '[1,2]' -> ['1','2']
|
|
|
price = request_dict.get('price', None)
|
|
|
remark = request_dict.get('remark', None)
|
|
|
- updated_time = request_dict.get('updatedTime', None)
|
|
|
- created_time = request_dict.get('createdTime', None)
|
|
|
is_show = request_dict.get('show', None)
|
|
|
|
|
|
- if not all([combo_id]):
|
|
|
+ if not all([pay_type, price, combo_name]):
|
|
|
return response.json(444)
|
|
|
- unicom_combo_qs = UnicomCombo.objects.filter(id=combo_id).values()
|
|
|
+ combo_id = int(combo_id)
|
|
|
+ flow_total = int(flow_total)
|
|
|
+ expiration_days = int(expiration_days)
|
|
|
+ expiration_type = int(expiration_type)
|
|
|
+ status = int(status)
|
|
|
+ combo_type = int(combo_type)
|
|
|
+ is_show = int(is_show)
|
|
|
+
|
|
|
+ unicom_combo_qs = UnicomCombo.objects.all()
|
|
|
|
|
|
try:
|
|
|
with transaction.atomic():
|
|
@@ -271,14 +277,14 @@ class UnicomComboView(View):
|
|
|
'expiration_type': expiration_type,
|
|
|
'price': price,
|
|
|
'remark': remark,
|
|
|
- 'updated_time': updated_time,
|
|
|
- 'created_time': created_time,
|
|
|
'is_show': is_show
|
|
|
}
|
|
|
- if unicom_combo_qs.exists():
|
|
|
+ if unicom_combo_qs.filter(id=combo_id).exists():
|
|
|
+ re_data['updated_time'] = int(time.time())
|
|
|
UnicomCombo.objects.filter(id=combo_id).update(**re_data)
|
|
|
UnicomCombo.objects.get(id=combo_id).pay_type.set(pay_type)
|
|
|
else:
|
|
|
+ re_data['updated_time'] = int(time.time())
|
|
|
UnicomCombo.objects.filter(id=combo_id).update(**re_data)
|
|
|
UnicomCombo.objects.get(id=combo_id).pay_type.set(pay_type)
|
|
|
UnicomCombo.objects.create(**re_data).pay_type.set(pay_type)
|