order-food-admin/app/Http/Controllers/BigScreenController.php

31 lines
1.0 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<?php
namespace App\Http\Controllers;
use Carbon\Carbon;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Support\Facades\Redis;
class BigScreenController extends Controller
{
public function number(Request $request){
$hash_prefix = "milk_tea_order_number_at_";
$date = Carbon::now()->toDateString();
// Redis 哈希表的命名larabbs_last_actived_at_2017-10-21
$hash = $hash_prefix . $date;
$number_list = Redis::lrange($hash, 0, -1);
return $this->success(array_reverse($number_list));
}
public function notice(Request $request){
$hash_prefix = "milk_tea_number_notice_at_";
$date = Carbon::now()->toDateString();
// Redis 哈希表的命名larabbs_last_actived_at_2017-10-21
$hash = $hash_prefix . $date;
$number_notice = Redis::lpop($hash);
return $this->success(['notice'=> $number_notice !== false ?$number_notice:'']);
}
}