cxhxy/app/store/controller/food/Statistics.php
test_service d3170b4d1c 1
2023-12-01 15:43:29 +08:00

1 line
1.1 KiB
PHP

<?php
namespace app\store\controller\food;
use app\store\controller\food\Controller;
use app\store\model\food\Order as OrderModel;
use app\store\model\food\Record as RecordModel;
use app\store\model\food\Shop as ShopModel;
use app\store\model\food\Pact as PactModel;
use think\facade\View;
/**
* 统计数据
*/
class Statistics extends Controller
{
public function opt()
{
$model = new ShopModel;
$shoplist = $model->getList(false);
return View::fetch('opt', compact('shoplist'));
}
public function index($shop_id='',$time_star,$time_end)
{
if($this->shop_mode == 10){
$shop_id = $this->shop_id;
}
$data['shop_id'] = $shop_id;
$data['star'] = strtotime($time_star . ' 00:00:00');
$data['end'] = strtotime($time_end . ' 23:59:59');
$count = array();
$count['order'] = OrderModel::getDateCount($data); //订单和收入统计
$count['record'] = RecordModel::getDateCount($data); //充值统计
$count['pact'] = PactModel::getDateCount($data); //预约统计
return View::fetch('index', compact('count'));
}
}