Skip to content

Commit

Permalink
fix(coupon): correct knows issues
Browse files Browse the repository at this point in the history
  • Loading branch information
xboard committed Jan 23, 2025
1 parent 8f88e11 commit caade5c
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 10 deletions.
10 changes: 5 additions & 5 deletions app/Http/Controllers/V1/User/CouponController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ class CouponController extends Controller
{
public function check(Request $request)
{
$request->validate([
'code' => 'required|string',
'plan_id' => 'required|integer',
'period' => 'nullable|string',
]);
// $request->validate([
// 'code' => 'required|string',
// 'plan_id' => 'required|integer',
// 'period' => 'nullable|string',
// ]);
if (empty($request->input('code'))) {
return $this->fail([422,__('Coupon cannot be empty')]);
}
Expand Down
3 changes: 2 additions & 1 deletion app/Services/PlanService.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ public static function getPeriodKey(string $period): string
*/
public static function convertToLegacyPeriod(string $period): string
{
return Plan::LEGACY_PERIOD_MAPPING[$period] ?? $period;
$flippedMapping = array_flip(Plan::LEGACY_PERIOD_MAPPING);
return $flippedMapping[$period] ?? $period;
}

/**
Expand Down
8 changes: 4 additions & 4 deletions public/assets/admin/assets/index.js

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions public/assets/admin/locales/en-US.js
Original file line number Diff line number Diff line change
Expand Up @@ -1219,6 +1219,16 @@ window.XBOARD_TRANSLATIONS['en-US'] = {
"error": {
"saveFailed": "Failed to save coupon"
}
},
"period": {
"monthly": "Monthly",
"quarterly": "Quarterly",
"half_yearly": "Half Yearly",
"yearly": "Yearly",
"two_yearly": "Two Yearly",
"three_yearly": "Three Yearly",
"onetime": "One Time",
"reset_traffic": "Reset Traffic"
}
},
"notice": {
Expand Down
10 changes: 10 additions & 0 deletions public/assets/admin/locales/ko-KR.js
Original file line number Diff line number Diff line change
Expand Up @@ -1219,6 +1219,16 @@ window.XBOARD_TRANSLATIONS['ko-KR'] = {
"error": {
"saveFailed": "쿠폰 저장 실패"
}
},
"period": {
"monthly": "월별",
"quarterly": "분기별",
"half_yearly": "반년별",
"yearly": "연간",
"two_yearly": "두 년",
"three_yearly": "세 년",
"onetime": "한 번",
"reset_traffic": "트래픽 재설정"
}
},
"notice": {
Expand Down
10 changes: 10 additions & 0 deletions public/assets/admin/locales/zh-CN.js
Original file line number Diff line number Diff line change
Expand Up @@ -1211,6 +1211,16 @@ window.XBOARD_TRANSLATIONS['zh-CN'] = {
"error": {
"saveFailed": "保存优惠券失败"
}
},
"period": {
"monthly": "月",
"quarterly": "季度",
"half_yearly": "半年",
"yearly": "年",
"two_yearly": "两年",
"three_yearly": "三年",
"onetime": "一次性",
"reset_traffic": "重置流量"
}
},
"notice": {
Expand Down

0 comments on commit caade5c

Please sign in to comment.