chore: 添加静态资源文件和版本配置文件
添加大量图片、字体、音频等静态资源文件,包括用户界面图片、模板文件和安装界面素材 添加系统版本配置文件(.version)和常量定义文件(.constant) 更新供应商依赖文件,包括Symfony VarDumper组件和相关许可证文件 添加验证码配置文件(captcha.php)和.gitignore规则
This commit is contained in:
152
app/controller/admin/v1/statistic/UserStatistic.php
Normal file
152
app/controller/admin/v1/statistic/UserStatistic.php
Normal file
@@ -0,0 +1,152 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\controller\admin\v1\statistic;
|
||||
|
||||
|
||||
use app\controller\admin\AuthController;
|
||||
use app\services\statistic\UserStatisticServices;
|
||||
use think\annotation\Inject;
|
||||
|
||||
/**
|
||||
* Class UserStatistic
|
||||
* @package app\controller\admin\v1\statistic
|
||||
*/
|
||||
class UserStatistic extends AuthController
|
||||
{
|
||||
|
||||
/**
|
||||
* @var UserStatisticServices
|
||||
*/
|
||||
#[Inject]
|
||||
protected UserStatisticServices $services;
|
||||
|
||||
/**
|
||||
* 用户基础信息
|
||||
* @return mixed
|
||||
*/
|
||||
public function getBasic()
|
||||
{
|
||||
$where = $this->request->getMore([
|
||||
['channel_type', ''],
|
||||
['data', '', '', 'time']
|
||||
]);
|
||||
$where['time'] = $this->getDay($where['time']);
|
||||
return $this->success($this->services->getBasic($where));
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户趋势
|
||||
* @return mixed
|
||||
*/
|
||||
public function getTrend()
|
||||
{
|
||||
$where = $this->request->getMore([
|
||||
['channel_type', ''],
|
||||
['data', '', '', 'time']
|
||||
]);
|
||||
$where['time'] = $this->getDay($where['time']);
|
||||
return $this->success($this->services->getTrend($where));
|
||||
}
|
||||
|
||||
/**
|
||||
* 微信用户信息
|
||||
* @return mixed
|
||||
*/
|
||||
public function getWechat()
|
||||
{
|
||||
$where = $this->request->getMore([
|
||||
['channel_type', ''],
|
||||
['data', '', '', 'time']
|
||||
]);
|
||||
$where['time'] = $this->getDay($where['time']);
|
||||
return $this->success($this->services->getWechat($where));
|
||||
}
|
||||
|
||||
/**
|
||||
* 微信用户趋势
|
||||
* @return mixed
|
||||
*/
|
||||
public function getWechatTrend()
|
||||
{
|
||||
$where = $this->request->getMore([
|
||||
['channel_type', ''],
|
||||
['data', '', '', 'time']
|
||||
]);
|
||||
$where['time'] = $this->getDay($where['time']);
|
||||
return $this->success($this->services->getWechatTrend($where));
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户地域
|
||||
* @return mixed
|
||||
*/
|
||||
public function getRegion()
|
||||
{
|
||||
$where = $this->request->getMore([
|
||||
['channel_type', ''],
|
||||
['data', '', '', 'time'],
|
||||
['sort', 'allNum']
|
||||
]);
|
||||
$where['time'] = $this->getDay($where['time']);
|
||||
return $this->success($this->services->getRegionV1($where));
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户性别
|
||||
* @return mixed
|
||||
*/
|
||||
public function getSex()
|
||||
{
|
||||
$where = $this->request->getMore([
|
||||
['channel_type', ''],
|
||||
['data', '', '', 'time']
|
||||
]);
|
||||
$where['time'] = $this->getDay($where['time']);
|
||||
return $this->success($this->services->getSex($where));
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户统计导出
|
||||
* @return mixed
|
||||
*/
|
||||
public function getExcel()
|
||||
{
|
||||
$where = $this->request->getMore([
|
||||
['channel_type', ''],
|
||||
['data', '', '', 'time']
|
||||
]);
|
||||
$where['time'] = $this->getDay($where['time']);
|
||||
return $this->success($this->services->getTrend($where, true));
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化时间
|
||||
* @param $time
|
||||
* @return string
|
||||
*/
|
||||
public function getDay($time)
|
||||
{
|
||||
if (strstr($time, '-') !== false) {
|
||||
[$startTime, $endTime] = explode('-', $time);
|
||||
if (!$startTime && !$endTime) {
|
||||
return date("Y/m/d", strtotime("-30 days", time())) . '-' . date("Y/m/d 23:59:59", time());
|
||||
} else {
|
||||
if (strtotime($endTime) == strtotime(date('Y-m-d', strtotime($endTime)))) {
|
||||
$endTime = $endTime . ' 23:59:59';
|
||||
}
|
||||
return $startTime . '-' . $endTime;
|
||||
}
|
||||
} else {
|
||||
return date("Y/m/d", strtotime("-30 days", time())) . '-' . date("Y/m/d 23:59:59", time());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user