AreaTraitModel.php 711 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: Mead
  5. * Date: 2019/9/4
  6. * Time: 9:36 AM
  7. */
  8. namespace App\Models;
  9. trait AreaTraitModel
  10. {
  11. // public static $redis = new \Redis();
  12. private static $redis_areas_tags = 'areas';
  13. public function byAreaIdGetArea($area_id)
  14. {
  15. $area = $this->redis->hget(self::$redis_areas_tags, $area_id);
  16. if ($area) {
  17. $area = unserialize($area);
  18. $area['area_fence'] = json_decode($area['area_fence'], true);
  19. $area['area_centre'] = json_decode($area['area_centre'], true);
  20. $area['area_fushe_fence'] = json_decode($area['area_fushe_fence'], true);
  21. return $area;
  22. }
  23. return false;
  24. }
  25. }