From 4fd00b9ddf3ba91b5c5c5b7d17c41f51808fbb64 Mon Sep 17 00:00:00 2001 From: evoxwht <442384644@qq.com> Date: Mon, 12 Jun 2023 15:02:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=BC=80=E6=BA=905.0.0?= =?UTF-8?q?=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../v1/statistic/BalanceStatistic.php | 72 --------- .../v1/statistic/OrderStatistic.php | 68 -------- .../v1/statistic/ProductStatistic.php | 106 ------------ .../v1/statistic/TradeStatistic.php | 74 --------- .../controller/v1/statistic/UserStatistic.php | 152 ------------------ 5 files changed, 472 deletions(-) delete mode 100644 crmeb/app/adminapi/controller/v1/statistic/BalanceStatistic.php delete mode 100644 crmeb/app/adminapi/controller/v1/statistic/OrderStatistic.php delete mode 100644 crmeb/app/adminapi/controller/v1/statistic/ProductStatistic.php delete mode 100644 crmeb/app/adminapi/controller/v1/statistic/TradeStatistic.php delete mode 100644 crmeb/app/adminapi/controller/v1/statistic/UserStatistic.php diff --git a/crmeb/app/adminapi/controller/v1/statistic/BalanceStatistic.php b/crmeb/app/adminapi/controller/v1/statistic/BalanceStatistic.php deleted file mode 100644 index fd1b229e..00000000 --- a/crmeb/app/adminapi/controller/v1/statistic/BalanceStatistic.php +++ /dev/null @@ -1,72 +0,0 @@ -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); - } -} diff --git a/crmeb/app/adminapi/controller/v1/statistic/OrderStatistic.php b/crmeb/app/adminapi/controller/v1/statistic/OrderStatistic.php deleted file mode 100644 index 0994e895..00000000 --- a/crmeb/app/adminapi/controller/v1/statistic/OrderStatistic.php +++ /dev/null @@ -1,68 +0,0 @@ -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); - } -} \ No newline at end of file diff --git a/crmeb/app/adminapi/controller/v1/statistic/ProductStatistic.php b/crmeb/app/adminapi/controller/v1/statistic/ProductStatistic.php deleted file mode 100644 index 167da551..00000000 --- a/crmeb/app/adminapi/controller/v1/statistic/ProductStatistic.php +++ /dev/null @@ -1,106 +0,0 @@ - -// +---------------------------------------------------------------------- - -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()); - } - } -} diff --git a/crmeb/app/adminapi/controller/v1/statistic/TradeStatistic.php b/crmeb/app/adminapi/controller/v1/statistic/TradeStatistic.php deleted file mode 100644 index 2cded8c9..00000000 --- a/crmeb/app/adminapi/controller/v1/statistic/TradeStatistic.php +++ /dev/null @@ -1,74 +0,0 @@ - -// +---------------------------------------------------------------------- - -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); - } - -} diff --git a/crmeb/app/adminapi/controller/v1/statistic/UserStatistic.php b/crmeb/app/adminapi/controller/v1/statistic/UserStatistic.php deleted file mode 100644 index b515d1fc..00000000 --- a/crmeb/app/adminapi/controller/v1/statistic/UserStatistic.php +++ /dev/null @@ -1,152 +0,0 @@ - -// +---------------------------------------------------------------------- - -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()); - } - } -}