心理咨询网
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.

SitemapModel.php 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <?php
  2. /**
  3. * @copyright (C)2016-2099 Hnaoyun Inc.
  4. * @author XingMeng
  5. * @email hnxsh@foxmail.com
  6. * @date 2018年2月14日
  7. * Sitemap模型
  8. */
  9. namespace app\home\model;
  10. use core\basic\Model;
  11. class SitemapModel extends Model
  12. {
  13. // 分类栏目列表
  14. public function getSorts()
  15. {
  16. $fields = array(
  17. 'a.id',
  18. 'a.pcode',
  19. 'a.scode',
  20. 'a.name',
  21. 'a.filename',
  22. 'a.outlink',
  23. 'b.type',
  24. 'b.urlname'
  25. );
  26. $join = array(
  27. 'ay_model b',
  28. 'a.mcode=b.mcode',
  29. 'LEFT'
  30. );
  31. $where = [
  32. 'a.scode NOT IN(13,19,26)',
  33. 'a.pcode NOT IN(13,19,26)',
  34. ];
  35. $result = parent::table('ay_content_sort a')->field($fields)
  36. ->where('a.status=1')
  37. ->where("a.acode='" . get_lg() . "'")
  38. ->where($where)
  39. ->join($join)
  40. ->order('a.pcode,a.sorting,a.id')
  41. ->select();
  42. return $result;
  43. }
  44. // 指定列表内容
  45. public function getSortContent($scode)
  46. {
  47. $fields = array(
  48. 'a.id',
  49. 'a.filename',
  50. 'a.date',
  51. 'c.type',
  52. 'c.urlname',
  53. 'b.scode',
  54. 'b.scode as bscode',
  55. 'b.pcode as bpcode',
  56. 'b.filename as sortfilename'
  57. );
  58. $join = array(
  59. array(
  60. 'ay_content_sort b',
  61. 'a.scode=b.scode',
  62. 'LEFT'
  63. ),
  64. array(
  65. 'ay_model c',
  66. 'b.mcode=c.mcode',
  67. 'LEFT'
  68. )
  69. );
  70. $where = array(
  71. 'b.scode NOT IN(13,19,26)',
  72. 'b.pcode NOT IN(13,19,26)',
  73. 'a.status=1',
  74. 'c.type=2',
  75. "a.date<'" . date('Y-m-d H:i:s') . "'"
  76. );
  77. return parent::table('ay_content a')->field($fields)
  78. ->where("a.scode='$scode'")
  79. ->where($where)
  80. ->join($join)
  81. ->select();
  82. }
  83. }