feat: add CPP growth deceleration prediction admin panel (admincpp)
This commit is contained in:
40
application/admincpp/controller/Dashboard.php
Normal file
40
application/admincpp/controller/Dashboard.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
namespace app\admincpp\controller;
|
||||
|
||||
use app\admincpp\common\Base;
|
||||
use think\Db;
|
||||
|
||||
class Dashboard extends Base
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
return $this->view->fetch("dashboard/index");
|
||||
}
|
||||
|
||||
public function getStatistics()
|
||||
{
|
||||
try {
|
||||
$userCount = Db::name("wechat_user")->count();
|
||||
$todayUserCount = Db::name("wechat_user")
|
||||
->where("create_time", ">=", date("Y-m-d") . " 00:00:00")
|
||||
->count();
|
||||
$recordCount = Db::name("cpp_calculate_record")->count();
|
||||
$infoCount = Db::name("wechat_real_time_info")->count();
|
||||
$lastCalculate = Db::name("cpp_calculate_record")
|
||||
->order("create_time desc")->value("create_time");
|
||||
|
||||
return json([
|
||||
"status" => 1,
|
||||
"data" => [
|
||||
"user_count" => $userCount,
|
||||
"today_user_count" => $todayUserCount,
|
||||
"total_calculate_count" => $recordCount,
|
||||
"info_count" => $infoCount,
|
||||
"last_calculate_time" => $lastCalculate ?: "暂无",
|
||||
]
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
return json(["status" => 0, "msg" => $e->getMessage()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user