123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <?php
- // +----------------------------------------------------------------------
- // | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
- // +----------------------------------------------------------------------
- // | Copyright (c) 2017~2021 https://www.yiovo.com All rights reserved.
- // +----------------------------------------------------------------------
- // | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
- // +----------------------------------------------------------------------
- // | Author: 萤火科技 <admin@yiovo.com>
- // +----------------------------------------------------------------------
- declare (strict_types = 1);
- namespace app\store\model;
- use app\common\model\StoreDailySalesSt as StoreStModel;
- /**
- * 门店销售数据每日统计模型
- * Class ShopsDailySalesSt
- * @package app\common\model
- */
- class StoreDailySalesSt extends StoreStModel
- {
- /**
- * 商城销售额按天统计
- * @param $from
- * @param $to
- * @return StoreDailySalesSt[]|array|\think\Collection
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\DbException
- * @throws \think\db\exception\ModelNotFoundException
- */
- public function listAMonthSt($from,$to){
- return self::where('st_time','between',[$from,$to])
- ->field('sale_volume,order_count,st_time,st_month,right(st_month,2) as int_month,right(st_time,2) as st_day')
- ->order('st_time asc')->select();
- }
- /**
- * 商城销售额按月统计
- * @param $from
- * @param $to
- * @return mixed
- */
- public function listTwoMonthSt($from,$to){
- return self::where('st_time','between',[$from,$to])
- ->field('sum(sale_volume) as sale_volume,right(st_month,2) as int_month,left(st_month,4) as st_year')
- ->group('st_month')
- ->order('st_month asc')->select();
- }
- }
|