Skip to content

Commit

Permalink
feat: better cron error handling & add more empty value detection
Browse files Browse the repository at this point in the history
#1879

I can't believe I have to spend time on this stupid "problem".
  • Loading branch information
M1Screw committed Jul 10, 2023
1 parent a75bcaa commit d7ae771
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions resources/views/tabler/admin/product/create.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -103,20 +103,20 @@
</div>
</div>
<div class="form-group mb-3 row">
<label class="form-label col-3 col-form-label">用户分组</label>
<label class="form-label col-3 col-form-label required">用户分组</label>
<div class="col">
<input id="node_group" type="text" class="form-control" value="">
</div>
</div>
<div class="form-group mb-3 row">
<label class="form-label col-3 col-form-label">速率限制 (Mbps)</label>
<label class="form-label col-3 col-form-label required">速率限制 (Mbps)</label>
<div class="col">
<input id="speed_limit" type="text" class="form-control"
value="">
</div>
</div>
<div class="form-group mb-3 row">
<label class="form-label col-3 col-form-label">同时连接IP限制</label>
<label class="form-label col-3 col-form-label required">同时连接IP限制</label>
<div class="col">
<input id="ip_limit" type="text" class="form-control"
value="">
Expand Down
6 changes: 3 additions & 3 deletions src/Command/Cron.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@ public function boot(): void
// 如果用户账户中没有已激活的订单,且有等待激活的订单,则激活最早的等待激活订单
if ($activated_order === null && count($pending_activation_orders) > 0) {
$order = $pending_activation_orders[0];
$order->status = 'activated';
$order->update_time = time();
$order->save();
// 获取订单内容准备激活
$content = json_decode($order->product_content);
// 激活商品
Expand All @@ -85,6 +82,9 @@ public function boot(): void
$user->node_speedlimit = $content->speed_limit;
$user->node_iplimit = $content->ip_limit;
$user->save();
$order->status = 'activated';
$order->update_time = time();
$order->save();
echo "订单 #{$order->id} 已激活。\n";
continue;
}
Expand Down

0 comments on commit d7ae771

Please sign in to comment.