123456789101112131415161718192021222324252627 |
- <?php
- namespace App\Models;
- use App\Maps\CacheMap;
- use Carbon\Carbon;
- use Illuminate\Support\Facades\Cache;
- class Box extends Model
- {
- const STATUS_OK = 1;
- const STATUS_PAUSE = 0;
- public static $statusMaps = [
- self::STATUS_OK => '正常',
- self::STATUS_PAUSE => '暂停'
- ];
- protected $table = 'box_binding';
- protected $guarded = [];
- public static function byBoxNoGetAutoCloseTime($box_no)
- {
- return Cache::remember('byBoxNoGetAutoCloseTime:' . $box_no, Carbon::now()->addSeconds(CacheMap::CACHE_TIME), function () use ($box_no) {
- return self::where('box_no', $box_no)->value('vibfilterremindt') ?? 30;
- });
- }
- }
|