fix(plans): require price > 0 for subscription plans

This commit is contained in:
erio
2026-04-13 18:12:57 +08:00
parent 5277f33155
commit f5e386e330
3 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -1 +1 @@
0.1.110.35
0.1.110.36
@@ -19,8 +19,8 @@ func validatePlanRequired(name string, groupID int64, price float64, validityDay
if groupID <= 0 {
return infraerrors.BadRequest("PLAN_GROUP_REQUIRED", "group is required")
}
if price < 0 {
return infraerrors.BadRequest("PLAN_PRICE_INVALID", "price must be >= 0")
if price <= 0 {
return infraerrors.BadRequest("PLAN_PRICE_INVALID", "price must be > 0")
}
if validityDays <= 0 {
return infraerrors.BadRequest("PLAN_VALIDITY_REQUIRED", "validity days must be > 0")
@@ -103,7 +103,7 @@
<div><label class="input-label">{{ t('payment.admin.planDescription') }} <span class="text-red-500">*</span></label><textarea v-model="planForm.description" rows="2" class="input" required></textarea></div>
<div class="grid grid-cols-2 gap-4">
<div><label class="input-label">{{ t('payment.admin.price') }} <span class="text-red-500">*</span></label><input v-model.number="planForm.price" type="number" step="0.01" min="0" class="input" required /></div>
<div><label class="input-label">{{ t('payment.admin.price') }} <span class="text-red-500">*</span></label><input v-model.number="planForm.price" type="number" step="0.01" min="0.01" class="input" required /></div>
<div><label class="input-label">{{ t('payment.admin.originalPrice') }}</label><input v-model.number="planForm.original_price" type="number" step="0.01" min="0" class="input" /></div>
</div>
<div class="grid grid-cols-2 gap-4">