Index.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <?php
  2. namespace app\shop\controller;
  3. use app\api\controller\Token;
  4. use app\common\controller\Frontend;
  5. use app\common\model\Config;
  6. class Index extends Frontend
  7. {
  8. protected $noNeedLogin = [''];
  9. protected $noNeedRight = '*';
  10. protected $layout = '';
  11. public function index()
  12. {
  13. $sinfo=db('studio')->where(['title'=>$this->auth->login_studio])->find();
  14. #轮播
  15. $slideshow = db('ads')->where(['status' => 1,'studio'=>$this->auth->login_studio])->select();
  16. if (empty($slideshow)) {
  17. $slideshow = [];
  18. }
  19. $index_order=config('site')['index_order'];
  20. $artist = db('article')->where(['catid' => 2, 'status' => 1])->select();
  21. if(!$artist)
  22. {
  23. $artist=[];
  24. }
  25. $cats = db('goods_cats')->where(['status'=>1])->order('id asc')->select();
  26. foreach ($cats as $k=>$v)
  27. {
  28. $start=strtotime(date("Y-m-d {$v['start']}"));
  29. $end=strtotime(date("Y-m-d {$v['end']}"));
  30. /*未开始*/
  31. if(time()<$start)
  32. {
  33. $cats[$k]['jctime1']=$start-time();
  34. $cats[$k]['flag']=1;
  35. }elseif(time()>=$start && time()<$end)
  36. {
  37. $cats[$k]['jctime1']=$end-time();
  38. $cats[$k]['flag']=2;
  39. }else{
  40. $cats[$k]['flag']=0;
  41. $cats[$k]['jctime1']=0;
  42. }
  43. }
  44. $config = Config::getConfigByGroup('basic');
  45. $indexVideo = isset($config['index_video'])? $config['index_video']['value'] : '';
  46. $this->view->assign([
  47. 'indexVideo'=>$indexVideo,
  48. 'slideshow'=>$slideshow,
  49. 'cats' => $cats,
  50. 'index_order'=>$index_order,
  51. 'artist'=>$artist,
  52. 'title'=>$sinfo['name'],
  53. ]);
  54. return $this->fetch();
  55. }
  56. function artistdetail()
  57. {
  58. $id = input('id');
  59. $noticeinfo = db('article')->where(['id' => $id, 'status' => 1])->find();
  60. if (empty($noticeinfo)) {
  61. $noticeinfo = [];
  62. }
  63. $this->view->assign('info', $noticeinfo);
  64. return $this->fetch();
  65. }
  66. function noticedetail()
  67. {
  68. $id = input('id');
  69. $noticeinfo = db('article')->where(['id' => $id, 'status' => 1])->find();
  70. if (empty($noticeinfo)) {
  71. $noticeinfo = [];
  72. }
  73. $this->view->assign('info', $noticeinfo);
  74. return $this->fetch();
  75. }
  76. function notice()
  77. {
  78. #轮播
  79. $slideshow = db('ads')->where(['status' => 1])->select();
  80. if (empty($slideshow)) {
  81. $slideshow = [];
  82. }
  83. $this->view->assign([
  84. 'slideshow' => $slideshow,
  85. ]);
  86. return $this->fetch();
  87. }
  88. function kefu()
  89. {
  90. $noticeinfo = db('article')->where(['catid' => 4, 'status' => 1])->find();
  91. if (empty($noticeinfo)) {
  92. $noticeinfo = [];
  93. }
  94. $this->view->assign('info', $noticeinfo);
  95. return $this->fetch();
  96. }
  97. function qyjs()
  98. {
  99. $noticeinfo = db('article')->where(['catid' => 3, 'status' => 1])->find();
  100. if (empty($noticeinfo)) {
  101. $noticeinfo = [];
  102. }
  103. $this->view->assign('info', $noticeinfo);
  104. return $this->fetch();
  105. }
  106. function xszn()
  107. {
  108. $noticeinfo = db('article')->where(['catid' => 2, 'status' => 1])->find();
  109. if (empty($noticeinfo)) {
  110. $noticeinfo = [];
  111. }
  112. $this->view->assign('info', $noticeinfo);
  113. return $this->fetch();
  114. }
  115. }