fix(coupon): correct knows issues
Some checks are pending
Docker Build and Publish / build (push) Waiting to run

This commit is contained in:
xboard 2025-01-23 16:14:18 +08:00
parent 8f88e11403
commit caade5c791
6 changed files with 41 additions and 10 deletions

View File

@ -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')]);
}

View File

@ -114,7 +114,8 @@ class PlanService
*/
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;
}
/**

File diff suppressed because one or more lines are too long

View File

@ -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": {

View File

@ -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": {

View File

@ -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": {