fix table bug
This commit is contained in:
@@ -16,6 +16,7 @@ use \App\Http\Controllers\Customer\FundController;
|
||||
use App\Http\Controllers\Site\ReportController;
|
||||
use App\Services\ConfigService;
|
||||
use App\Services\ProductPriceService;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
|
||||
class ProductController extends SuperController
|
||||
@@ -46,11 +47,17 @@ class ProductController extends SuperController
|
||||
->initSearch($this->search)
|
||||
->select($this->select)
|
||||
->export($query_table);
|
||||
$query_table['auto_open_at'] = Product::selectRaw(
|
||||
'SEC_TO_TIME(AVG(TIME_TO_SEC(TIME(auto_open_at)))) as avg_time'
|
||||
)->value('avg_time'); $query_table['auto_close_at'] = Product::selectRaw(
|
||||
'SEC_TO_TIME(AVG(TIME_TO_SEC(TIME(auto_close_at)))) as avg_time'
|
||||
)->value('avg_time');
|
||||
|
||||
if (Schema::hasColumn((new Product)->getTable(), 'auto_open_at')) {
|
||||
$query_table['auto_open_at'] = Product::selectRaw(
|
||||
'SEC_TO_TIME(AVG(TIME_TO_SEC(TIME(auto_open_at)))) as avg_time'
|
||||
)->value('avg_time');
|
||||
}
|
||||
if (Schema::hasColumn((new Product)->getTable(), 'auto_close_at')) {
|
||||
$query_table['auto_close_at'] = Product::selectRaw(
|
||||
'SEC_TO_TIME(AVG(TIME_TO_SEC(TIME(auto_close_at)))) as avg_time'
|
||||
)->value('avg_time');
|
||||
}
|
||||
|
||||
// $query_table['11'] = $avgDuration;
|
||||
// $query_table['11'] = Product::avg('auto_open_at');
|
||||
|
||||
Reference in New Issue
Block a user