|
@@ -84,6 +84,11 @@ class RestaurantTableController extends Curd
|
|
|
return $model;
|
|
|
}
|
|
|
|
|
|
+ public function statistics(Request $request)
|
|
|
+ {
|
|
|
+// $total =
|
|
|
+ }
|
|
|
+
|
|
|
public function insert(Request $request): Response
|
|
|
{
|
|
|
$uid = JwtToken::getCurrentId();
|
|
@@ -309,34 +314,34 @@ class RestaurantTableController extends Curd
|
|
|
$query->where('dept_id', $user->join_user_dept_id)->orWhere('dept_super_id', $user->join_user_dept_id);
|
|
|
})->first();
|
|
|
|
|
|
- $tables = SysDept::where('dept_super_id',$restaurant->dept_id)
|
|
|
- ->where('dept_category','桌台')
|
|
|
- ->where('dept_status','<>','DISABLED')
|
|
|
+ $tables = SysDept::where('dept_super_id', $restaurant->dept_id)
|
|
|
+ ->where('dept_category', '桌台')
|
|
|
+ ->where('dept_status', '<>', 'DISABLED')
|
|
|
->get()
|
|
|
->toArray();
|
|
|
$zip = new \ZipArchive();
|
|
|
- $filename = public_path().'/storage/qrcode/zip/'.$restaurant->dept_name.'-桌台.zip';
|
|
|
- if (file_exists($filename)){
|
|
|
+ $filename = public_path() . '/storage/qrcode/zip/' . $restaurant->dept_name . '-桌台.zip';
|
|
|
+ if (file_exists($filename)) {
|
|
|
unlink($filename);
|
|
|
}
|
|
|
|
|
|
if ($zip->open($filename, \ZipArchive::CREATE) !== TRUE) {
|
|
|
return json_fail("创建压缩文件失败");
|
|
|
}
|
|
|
- foreach ($tables as $table){
|
|
|
- $fileName = $restaurant->dept_name.'-'.$table['dept_name'];
|
|
|
+ foreach ($tables as $table) {
|
|
|
+ $fileName = $restaurant->dept_name . '-' . $table['dept_name'];
|
|
|
$url = getenv('TABLE_QRCODE_DOMAIN') . "/qr?tid=" . $table['dept_id'];
|
|
|
$qrcode = new Qrcode();
|
|
|
$qrcode->setLabel($restaurant->dept_name . "(" . $table['dept_name'] . ")");
|
|
|
$qrcode = $qrcode->create($url, $fileName);
|
|
|
if ($qrcode !== false) {
|
|
|
- $zip->addFile(public_path().'/storage/qrcode/' . $fileName . '.png',$fileName . '.png');
|
|
|
+ $zip->addFile(public_path() . '/storage/qrcode/' . $fileName . '.png', $fileName . '.png');
|
|
|
// return json_success('success', ['url' => getenv('STORAGE_DOMAIN') . '/storage/qrcode/' . $fileName . '.png']);
|
|
|
}
|
|
|
}
|
|
|
$zip->close();
|
|
|
|
|
|
- return json_success('success', ['url' => getenv('STORAGE_DOMAIN') . '/storage/qrcode/zip/' . $restaurant->dept_name.'-桌台.zip']);
|
|
|
+ return json_success('success', ['url' => getenv('STORAGE_DOMAIN') . '/storage/qrcode/zip/' . $restaurant->dept_name . '-桌台.zip']);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -356,7 +361,7 @@ class RestaurantTableController extends Curd
|
|
|
$restaurant = SysDept::where('dept_super_id', $premise->dept_id)->where('dept_category', '餐厅')->where('dept_status', 'ACTIVED')->first();
|
|
|
}
|
|
|
|
|
|
- $tables = SysDept::where('dept_super_id', $restaurant->dept_id)->where('dept_category', '桌台')->orderBy('dept_sort','ASC')->get()->toArray();
|
|
|
+ $tables = SysDept::where('dept_super_id', $restaurant->dept_id)->where('dept_category', '桌台')->orderBy('dept_sort', 'ASC')->get()->toArray();
|
|
|
|
|
|
foreach ($tables as $table) {
|
|
|
$tableList[] = [
|