mirror of
https://github.com/v2board/v2board.git
synced 2024-11-10 09:39:10 +08:00
more optimization && add plan user count
This commit is contained in:
parent
ffd13fbc64
commit
b5a9b3e68c
@ -16,8 +16,23 @@ class PlanController extends Controller
|
|||||||
{
|
{
|
||||||
public function fetch(Request $request)
|
public function fetch(Request $request)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
$counts = User::select(
|
||||||
|
DB::raw("plan_id"),
|
||||||
|
DB::raw("count(*) as count")
|
||||||
|
)
|
||||||
|
->where('plan_id', '!=', NULL)
|
||||||
|
->groupBy("plan_id")
|
||||||
|
->get();
|
||||||
|
$plans = Plan::orderBy('sort', 'ASC')->get();
|
||||||
|
foreach ($plans as $k => $v) {
|
||||||
|
$plans[$k]->count = 0;
|
||||||
|
foreach ($counts as $kk => $vv) {
|
||||||
|
if ($plans[$k]->id === $counts[$kk]->plan_id) $plans[$k]->count = $counts[$kk]->count;
|
||||||
|
}
|
||||||
|
}
|
||||||
return response([
|
return response([
|
||||||
'data' => Plan::orderBy('sort', 'ASC')->get()
|
'data' => $plans
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ class TelegramController extends Controller
|
|||||||
$commands = [
|
$commands = [
|
||||||
'/bind 订阅地址 - 绑定你的' . config('v2board.app_name', 'V2Board') . '账号',
|
'/bind 订阅地址 - 绑定你的' . config('v2board.app_name', 'V2Board') . '账号',
|
||||||
'/traffic - 查询流量信息',
|
'/traffic - 查询流量信息',
|
||||||
'/getLatestUrl - 获取最新的' . config('v2board.app_name', 'V2Board') . '网址'
|
'/getlatesturl - 获取最新的' . config('v2board.app_name', 'V2Board') . '网址'
|
||||||
];
|
];
|
||||||
$text = implode(PHP_EOL, $commands);
|
$text = implode(PHP_EOL, $commands);
|
||||||
$telegramService->sendMessage($msg->chat_id, "你可以使用以下命令进行操作:\n\n$text", 'markdown');
|
$telegramService->sendMessage($msg->chat_id, "你可以使用以下命令进行操作:\n\n$text", 'markdown');
|
||||||
|
2
public/assets/admin/umi.js
vendored
2
public/assets/admin/umi.js
vendored
File diff suppressed because one or more lines are too long
2
public/assets/user/umi.js
vendored
2
public/assets/user/umi.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user