fix: more bug

This commit is contained in:
Tokumeikoi 2020-11-07 15:44:57 +08:00
parent 34b8b666f4
commit 1d92d6b2f9
4 changed files with 8 additions and 7 deletions

View File

@ -94,12 +94,12 @@ class CouponController extends Controller
private function multiGenerate(CouponGenerate $request)
{
$coupons = [];
$coupon = $request->validated();
$coupon['limit_plan_ids'] = json_encode($coupon['limit_plan_ids']);
$coupon['created_at'] = $coupon['updated_at'] = time();
unset($coupon['generate_count']);
for ($i = 0;$i < $request->input('generate_count');$i++) {
$coupon = $request->validated();
$coupon['limit_plan_ids'] = json_encode($coupon['limit_plan_ids']);
$coupon['code'] = Helper::randomChar(8);
$coupon['created_at'] = $coupon['updated_at'] = time();
unset($coupon['generate_count']);
array_push($coupons, $coupon);
}
DB::beginTransaction();

View File

@ -30,7 +30,8 @@ class MailService
private function remindTrafficIsWarnValue($ud, $transfer_enable)
{
if ($ud <= 0) return false;
$percentage = $ud / $transfer_enable * 100;
if (!$transfer_enable) return false;
$percentage = ($ud / $transfer_enable) * 100;
if ($percentage < 80) return false;
if ($percentage >= 100) return false;
return true;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long