News.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. namespace app\common\model;
  3. use think\Cache;
  4. use think\Db;
  5. use think\Config;
  6. /**
  7. * 新闻资讯表
  8. * @author Administrator
  9. */
  10. class News extends \think\Model
  11. {
  12. protected $pk = 'id';
  13. protected $table = 'cy_article';
  14. protected $dateFormat = false; //时间戳格式不自动转换
  15. protected $connection = 'database_slave'; //官网使用从库
  16. private $catgList = array(
  17. array('id'=>1, 'name'=>'新游资讯'),
  18. array('id'=>4, 'name'=>'新游攻略'),
  19. );
  20. private $_catgMapList = array(
  21. 1 => '新游资讯',
  22. 2 => '麻花网络资讯',
  23. 3 => '新游评测',
  24. 4 => '新游攻略',
  25. 5 => '精彩视频',
  26. );
  27. private $position = array(
  28. '首页资讯' => 'a',
  29. '首页攻略' => 'b',
  30. '新游评测' => 'c',
  31. '新闻热点' => 'd',
  32. '新游视频' => 'e',
  33. );
  34. private $mobileCatgList = array(
  35. array('id'=>1, 'name'=>'资讯'),
  36. array('id'=>4, 'name'=>'攻略'),
  37. );
  38. private $_mobileCatgMapList = array(
  39. 1 => '资讯',
  40. 4 => '攻略',
  41. );
  42. public function getPosition($name) {
  43. return $this->position[$name];
  44. }
  45. public function getCatgList() {
  46. return $this->catgList;
  47. }
  48. public function getCatgName($type) {
  49. return $this->_catgMapList[$type];
  50. }
  51. public function getMobileCatgList() {
  52. return $this->mobileCatgList;
  53. }
  54. public function getMobileCatgName($type) {
  55. return $this->_mobileCatgMapList[$type];
  56. }
  57. }