mirror of
https://github.com/crmeb/CRMEB.git
synced 2026-10-28 21:40:50 +00:00
fix(用户服务): 增加时长输入验证,确保为大于0的整数
This commit is contained in:
parent
81b9a78ff1
commit
409d6aa1f1
@ -256,7 +256,11 @@ class UserController extends AuthController
|
||||
list($days) = $this->request->postMore([
|
||||
['days', 0],
|
||||
], true);
|
||||
return app('json')->success($this->services->saveGiveLevelTime((int)$id, (int)$days) ? '赠送成功' : '赠送失败');
|
||||
$days = filter_var($days, FILTER_VALIDATE_INT, ['options' => ['min_range' => 1]]);
|
||||
if ($days === false) {
|
||||
return app('json')->fail('增加时长必须为大于0的整数');
|
||||
}
|
||||
return app('json')->success($this->services->saveGiveLevelTime((int)$id, $days) ? '赠送成功' : '赠送失败');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -1047,7 +1047,7 @@ class UserServices extends BaseService
|
||||
$field[] = Form::input('time_diff', '到期时间', $timeDiff)->readonly(true);
|
||||
if ($userInfo['is_ever_level'] == 0) {
|
||||
$field[] = Form::input('day_diff', '剩余天数', $dayDiff)->readonly(true);
|
||||
$field[] = Form::number('days', '增加时长(天)')->precision(0)->required();
|
||||
$field[] = Form::number('days', '增加时长(天)')->min(1)->precision(0)->required();
|
||||
}
|
||||
return create_form('赠送付费会员时长', $field, Url::buildUrl('/user/save_give_level_time/' . $id), 'PUT');
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user