mkm e7cf36928f feat: 添加或修改API以支持新的订单创建功能;
fix: 修复在处理生鲜产品订单时的异常;
refactor: 重构代码以优化性能和可读性;
style: 代码风格调整,增加空格、格式化、修复缺失的分号等;
test: 添加测试以验证新订单创建功能的正确性;
docs: 更新相关文档,如README;
build: 更新项目依赖或版本;
ops: 更新基础设施、部署、备份和恢复等操作性组件;
chore: 修改.gitignore等;
2024-07-17 11:19:56 +08:00

35 lines
1.6 KiB
PHP

<?php
namespace app\statistics\logic;
use app\common\logic\BaseLogic;
use app\common\model\store_order\StoreOrder;
use app\common\model\store_visit\StoreVisit;
use app\common\model\user_recharge\UserRecharge;
class UserLogic extends BaseLogic
{
public static function userCount($where,$dates)
{
$data = [];
foreach ($dates as $k=>$date) {
$data[$k]['newUserCount']=UserRecharge::whereDay('create_time', $date)->where($where)->where('paid',1)->where('recharge_type','INDUSTRYMEMBERS')->count();
$data[$k]['viewUserCount']=StoreVisit::whereDay('create_time', $date)->where($where)->group('uid')->count();
$data[$k]['totalUserCount']=UserRecharge::where('create_time','<',strtotime($date) )->where($where)->where('paid',1)->where('recharge_type','INDUSTRYMEMBERS')->count();
}
$data['list']=$data;
return $data;
}
public static function TradeCount($where,$dates)
{
$data = [];
foreach ($dates as $k=>$date) {
$data[$k]['date']=$date;
$data[$k]['visitUser']=StoreVisit::whereDay('create_time', $date)->where($where)->cache('statistics_store_visit_count_' . $date, 300)->group('uid')->count();
$data[$k]['orderUser']=StoreOrder::whereDay('create_time', $date)->where($where)->cache('statistics_store_order_count_' . $date, 300)->group('uid')->count();
$data[$k]['payOrderUser']=StoreOrder::whereDay('create_time', $date)->where($where)->where('paid',1)->cache('statistics_store_order_pay_count_' . $date, 300)->group('uid')->count();
}
return $data;
}
}