控制台应用,yzncms本身基于tp5.1框架,里面的队列用不了,bug,坑
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Category.php 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | Yzncms [ 御宅男工作室 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2018 http://yzncms.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  8. // +----------------------------------------------------------------------
  9. // | Author: 御宅男 <530765310@qq.com>
  10. // +----------------------------------------------------------------------
  11. // +----------------------------------------------------------------------
  12. // | 栏目模型
  13. // +----------------------------------------------------------------------
  14. namespace app\cms\model;
  15. use think\Model;
  16. /**
  17. * 模型
  18. */
  19. class Category extends Model
  20. {
  21. //刷新栏目索引缓存
  22. public function category_cache()
  23. {
  24. $data = self::order("listorder DESC")->select();
  25. $CategoryIds = array();
  26. foreach ($data as $r) {
  27. $CategoryIds[$r['id']] = array(
  28. 'id' => $r['id'],
  29. 'catdir' => $r['catdir'],
  30. 'parentid' => $r['parentid'],
  31. );
  32. }
  33. cache("Category", $CategoryIds);
  34. return $CategoryIds;
  35. }
  36. }