field('price_type, count(*) as cnt')->group('price_type')->select(); foreach ($dist as $d) { echo " {$d['price_type']}: {$d['cnt']}" . PHP_EOL; } echo "=== quote 模式的服务商品示例 ===" . PHP_EOL; $quotes = Db::name('service')->where('price_type', 'quote')->select(); foreach ($quotes as $q) { echo " ID: {$q['id']}, Name: {$q['name']}, base_price: {$q['base_price']}, service_types: {$q['service_types']}" . PHP_EOL; }