发布测试版 2.5.0

This commit is contained in:
2021-11-28 12:06:10 +08:00
parent 672cc966db
commit 8408038188
807 changed files with 94347 additions and 47563 deletions
+26 -1
View File
@@ -2,10 +2,11 @@
use DB;
use Gdoo\Index\Controllers\DefaultController;
use Gdoo\Index\Services\InfoService;
class WidgetController extends DefaultController
{
public $permission = ['birthday'];
public $permission = ['birthday', 'userCount'];
// 生日提醒
public function birthday()
@@ -15,4 +16,28 @@ class WidgetController extends DefaultController
'rows' => $rows,
));
}
/**
* 用户数量
*/
public function userCount()
{
$config = InfoService::getInfo('user');
$model = DB::table('user')->whereRaw('('.$config['sql'].')');
$model2 = DB::table('user')->whereRaw('('.$config['sql2'].')');
$count = $model->count();
$count2 = $model2->count();
$rate = 0;
if ($count2 > 0) {
$rate = ($count - $count2) / $count2 * 100;
$rate = number_format($rate, 2);
}
$res = [
'count' => $count,
'count2' => $count2,
'rate' => $rate,
];
return $this->json($res, true);
}
}