更新开源5.0.0版本

This commit is contained in:
evoxwht 2023-06-12 15:02:41 +08:00
parent 36ce0fef97
commit 4fd00b9ddf
5 changed files with 0 additions and 472 deletions

View File

@ -1,72 +0,0 @@
<?php
namespace app\adminapi\controller\v1\statistic;
use app\adminapi\controller\AuthController;
use app\services\user\UserMoneyServices;
use think\facade\App;
class BalanceStatistic extends AuthController
{
/**
* @param App $app
* @param UserMoneyServices $services
*/
public function __construct(App $app, UserMoneyServices $services)
{
parent::__construct($app);
$this->services = $services;
}
/**
* 余额统计基础信息
* @return mixed
*/
public function getBasic()
{
$where = $this->request->getMore([
['time', '']
]);
$data = $this->services->getBasic($where);
return app('json')->success($data);
}
/**
* 余额统计趋势图
* @return mixed
*/
public function getTrend()
{
$where = $this->request->getMore([
['time', '']
]);
$data = $this->services->getTrend($where);
return app('json')->success($data);
}
/**
* 余额来源
* @return mixed
*/
public function getChannel()
{
$where = $this->request->getMore([
['time', '']
]);
$data = $this->services->getChannel($where);
return app('json')->success($data);
}
/**
* 余额类型
* @return mixed
*/
public function getType()
{
$where = $this->request->getMore([
['time', '']
]);
$data = $this->services->getType($where);
return app('json')->success($data);
}
}

View File

@ -1,68 +0,0 @@
<?php
namespace app\adminapi\controller\v1\statistic;
use app\adminapi\controller\AuthController;
use app\services\statistic\OrderStatisticServices;
use think\facade\App;
class OrderStatistic extends AuthController
{
public function __construct(App $app, OrderStatisticServices $services)
{
parent::__construct($app);
$this->services = $services;
}
/**
* 订单统计基础信息
* @return mixed
*/
public function getBasic()
{
$where = $this->request->getMore([
['time', '']
]);
$data = $this->services->getBasic($where);
return app('json')->success($data);
}
/**
* 订单统计趋势图
* @return mixed
*/
public function getTrend()
{
$where = $this->request->getMore([
['time', '']
]);
$data = $this->services->getTrend($where);
return app('json')->success($data);
}
/**
* 订单来源
* @return mixed
*/
public function getChannel()
{
$where = $this->request->getMore([
['time', '']
]);
$data = $this->services->getChannel($where);
return app('json')->success($data);
}
/**
* 订单类型
* @return mixed
*/
public function getType()
{
$where = $this->request->getMore([
['time', '']
]);
$data = $this->services->getType($where);
return app('json')->success($data);
}
}

View File

@ -1,106 +0,0 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\adminapi\controller\v1\statistic;
use app\adminapi\controller\AuthController;
use app\services\statistic\ProductStatisticServices;
use think\facade\App;
/**
* Class ProductStatistic
* @package app\adminapi\controller\v1\statistic
*/
class ProductStatistic extends AuthController
{
/**
* ProductStatistic constructor.
* @param App $app
* @param ProductStatisticServices $services
*/
public function __construct(App $app, ProductStatisticServices $services)
{
parent::__construct($app);
$this->services = $services;
}
/**
* 商品基础
* @return mixed
*/
public function getBasic()
{
$where = $this->request->getMore([
['data', '', '', 'time']
]);
return app('json')->success($this->services->getBasic($where));
}
/**
* 商品趋势
* @return mixed
*/
public function getTrend()
{
$where = $this->request->getMore([
['data', '', '', 'time']
]);
$where['time'] = $this->getDay($where['time']);
return app('json')->success($this->services->getTrend($where));
}
/**
* 商品排行
* @return mixed
*/
public function getProductRanking()
{
$where = $this->request->getMore([
['data', '', '', 'time'],
['sort', '']
]);
$where['time'] = $this->getDay($where['time']);
return app('json')->success($this->services->getProductRanking($where));
}
/**
* 导出
* @return mixed
*/
public function getExcel()
{
$where = $this->request->getMore([
['data', '', '', 'time']
]);
$where['time'] = $this->getDay($where['time']);
return app('json')->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 00:00:00", strtotime("-30 days", time())) . '-' . date("Y/m/d 23:59:59", time());
} else {
return date('Y/m/d 00:00:00', strtotime($startTime)).'-'.date('Y/m/d 23:59:59', strtotime($endTime));
}
} else {
return date("Y/m/d 00:00:00", strtotime("-30 days", time())) . '-' . date("Y/m/d 23:59:59", time());
}
}
}

View File

@ -1,74 +0,0 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\adminapi\controller\v1\statistic;
use app\adminapi\controller\AuthController;
use app\services\statistic\TradeStatisticServices;
use think\facade\App;
/**
* Class TradeStatistic
* @package app\controller\admin\v1\statistic
*/
class TradeStatistic extends AuthController
{
/**
* TradeStatistic constructor.
* @param App $app
* @param TradeStatisticServices $services
*/
public function __construct(App $app, TradeStatisticServices $services)
{
parent::__construct($app);
$this->services = $services;
}
/**
* 顶部数据
* @return mixed
*/
public function topTrade()
{
$leftToday = $this->services->getTopLeftTrade(['time' => 'today']);
$leftyestoday = $this->services->getTopLeftTrade(['time' => 'yestoday']);
$rightOne = $this->services->getTopRightOneTrade();
$rightTwo = $this->services->getTopRightTwoTrade();
$right = ['today' => $rightOne, 'month' => $rightTwo];
$totalleft = [$leftToday, $leftyestoday];
$left = [];
foreach ($totalleft as $k => $v) {
$left['name'] = "当日订单金额";
$left['x'] = $v['curve']['x'];
$left['series'][$k]['money'] = round($v['total_money'], 2);
$left['series'][$k]['value'] = array_values($v['curve']['y']);
}
$data['left'] = $left;
$data['right'] = $right;
return app('json')->success($data);
}
/**
* 底部数据
* @return mixed
*/
public function bottomTrade()
{
$day = $this->request->getMore([
['data', ""],
]);
$bottom = $this->services->getBottomTrade($day);
return app('json')->success($bottom);
}
}

View File

@ -1,152 +0,0 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\adminapi\controller\v1\statistic;
use app\adminapi\controller\AuthController;
use app\services\statistic\UserStatisticServices;
use think\facade\App;
/**
* Class UserStatistic
* @package app\adminapi\controller\v1\statistic
*/
class UserStatistic extends AuthController
{
/**
* UserStatistic constructor.
* @param App $app
* @param UserStatisticServices $services
*/
public function __construct(App $app, UserStatisticServices $services)
{
parent::__construct($app);
$this->services = $services;
}
/**
* 用户基础信息
* @return mixed
*/
public function getBasic()
{
$where = $this->request->getMore([
['channel_type', ''],
['data', '', '', 'time']
]);
return app('json')->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 app('json')->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 app('json')->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 app('json')->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 app('json')->success($this->services->getRegion($where));
}
/**
* 用户性别
* @return mixed
*/
public function getSex()
{
$where = $this->request->getMore([
['channel_type', ''],
['data', '', '', 'time']
]);
$where['time'] = $this->getDay($where['time']);
return app('json')->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 app('json')->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 00:00:00", strtotime("-30 days", time())) . '-' . date("Y/m/d 23:59:59", time());
} else {
return date('Y/m/d 00:00:00', strtotime($startTime)).'-'.date('Y/m/d 23:59:59', strtotime($endTime));
}
} else {
return date("Y/m/d 00:00:00", strtotime("-30 days", time())) . '-' . date("Y/m/d 23:59:59", time());
}
}
}