浏览代码

修复未使用套餐列表月份显示问题

locky 4 年之前
父节点
当前提交
dda5adcebd
共有 1 个文件被更改,包括 5 次插入2 次删除
  1. 5 2
      Controller/CloudStorage.py

+ 5 - 2
Controller/CloudStorage.py

@@ -1380,9 +1380,12 @@ class CloudStorageView(View):
         if has_unused == 1:
             unuseds = Unused_Uid_Meal.objects.filter(uid=uid).annotate(unused_id=F('id')) \
                 .values("unused_id","uid","bucket__content","num","bucket__id","expire")
+            month = 'month' if lang != 'cn' else '个月'
             for ub in unuseds:
-                storage_time = ub['num'] *  ub['expire']
-                storage = "{storage_time}个月".format(storage_time=storage_time)
+                storage_time = ub['num'] * ub['expire']
+                if lang != 'cn' and storage_time > 1:   # 英文大于一个月使用复数
+                    month += 's'
+                storage = "{storage_time}{month}".format(storage_time=storage_time, month=month)
                 unused_dict = {
                     "id":ub['unused_id'],
                     "uid":ub['uid'],