Page.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | 海豚PHP框架 [ DolphinPHP ]
  4. // +----------------------------------------------------------------------
  5. // | 版权所有 2016~2017 河源市卓锐科技有限公司 [ http://www.zrthink.com ]
  6. // +----------------------------------------------------------------------
  7. // | 官方网站: http://dolphinphp.com
  8. // +----------------------------------------------------------------------
  9. // | 开源协议 ( http://www.apache.org/licenses/LICENSE-2.0 )
  10. // +----------------------------------------------------------------------
  11. namespace app\cms\model;
  12. use think\Model as ThinkModel;
  13. /**
  14. * 单页模型
  15. * @package app\cms\model
  16. */
  17. class Page extends ThinkModel
  18. {
  19. // 设置当前模型对应的完整数据表名称
  20. protected $table = '__CMS_PAGE__';
  21. // 自动写入时间戳
  22. protected $autoWriteTimestamp = true;
  23. /**
  24. * 获取单页标题列表
  25. * @author 蔡伟明 <314013107@qq.com>
  26. * @return array|mixed
  27. */
  28. public static function getTitleList()
  29. {
  30. $result = cache('cms_page_title_list');
  31. if (!$result) {
  32. $result = self::where('status', 1)->column('id,title');
  33. // 非开发模式,缓存数据
  34. if (config('develop_mode') == 0) {
  35. cache('cms_page_title_list', $result);
  36. }
  37. }
  38. return $result;
  39. }
  40. }