From 022ad19939ee175f9932886500a925d7c0d5a4b2 Mon Sep 17 00:00:00 2001 From: wangxiaowei Date: Wed, 6 Nov 2024 10:43:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=A6=81=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E7=9A=84=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/logic/LocalStoreLogic.php | 41 ++++++++++++++++--------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/app/api/logic/LocalStoreLogic.php b/app/api/logic/LocalStoreLogic.php index 4268ed06..4d723736 100644 --- a/app/api/logic/LocalStoreLogic.php +++ b/app/api/logic/LocalStoreLogic.php @@ -14,7 +14,6 @@ use app\common\model\user\User; use app\common\server\UrlServer; use think\facade\Config; use think\facade\Db; -use app\common\model\localstore\LocalGoodsOrder; class LocalStoreLogic extends Logic { @@ -768,16 +767,18 @@ class LocalStoreLogic extends Logic public static function countData($post, $user_id) { +// ->where(['lso.state' => 1, 'lso.pay_shop_type' => 1, 'lso.lstore_id' => $data['lstore_id']]) + $where = [ ['lstore_id', '=', $post['lstore_id']], - ['user_id', '=', $user_id], + ['pay_shop_type', '=', 1], ['state', '=', 1] ]; - $model = new LocalGoodsOrder(); + $model = new LocalStoreOrder(); // 历史订单总和 - $history_total_amount = $model->where($where)->sum('goods_total_price'); + $history_total_amount = $model->where($where)->sum('total_amount'); // 本月业绩总和 $current_month_start = date('Y-m-01 00:00:00'); // 当月开始日期 @@ -785,9 +786,9 @@ class LocalStoreLogic extends Logic $current_month_total_amount = $model ->where($where) ->where([ - ['dtime', '>=', $current_month_start], - ['dtime', '<=', $current_month_end] - ])->sum('goods_total_price'); + ['create_time', '>=', $current_month_start], + ['create_time', '<=', $current_month_end] + ])->sum('total_amount'); // 上月业绩总和 $last_month_start = date('Y-m-01 00:00:00', strtotime('-1 month')); // 上月开始日期 @@ -795,9 +796,9 @@ class LocalStoreLogic extends Logic $last_month_total_amount = $model ->where($where) ->where([ - ['dtime', '>=', $last_month_start], - ['dtime', '<=', $last_month_end] - ])->sum('goods_total_price'); + ['create_time', '>=', $last_month_start], + ['create_time', '<=', $last_month_end] + ])->sum('total_amount'); // 当日营业额 $current_day_start = date('Y-m-d 00:00:00'); @@ -805,9 +806,9 @@ class LocalStoreLogic extends Logic $current_day_total_amount = $model ->where($where) ->where([ - ['dtime', '>=', $current_day_start], - ['dtime', '<=', $current_day_end] - ])->sum('goods_total_price'); + ['create_time', '>=', $current_day_start], + ['create_time', '<=', $current_day_end] + ])->sum('total_amount'); // 统计当日数据: 总共支付交易笔数 report = 1(日报) report = 2(月报) $trade_where = $where; @@ -827,17 +828,17 @@ class LocalStoreLogic extends Logic $filter_month_total_amount = $model ->where($where) ->where([ - ['dtime', '>=', $time_where['start']], - ['dtime', '<=', $time_where['end']] - ])->sum('goods_total_price'); + ['create_time', '>=', $time_where['start']], + ['create_time', '<=', $time_where['end']] + ])->sum('total_amount'); } // 总共交易笔数 $count_trade = $model ->where($trade_where) ->where([ - ['dtime', '>=', $time_where['start']], - ['dtime', '<=', $time_where['end']] + ['create_time', '>=', $time_where['start']], + ['create_time', '<=', $time_where['end']] ])->count(); // 支付成功交易笔数 @@ -845,8 +846,8 @@ class LocalStoreLogic extends Logic $success_trade = $model ->where($trade_where) ->where([ - ['dtime', '>=', $time_where['start']], - ['dtime', '<=', $time_where['end']] + ['create_time', '>=', $time_where['start']], + ['create_time', '<=', $time_where['end']] ])->count(); // 单笔均价