Index.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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 = ['index','Index'];
  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. 'isLogin'=>$this->auth->id,
  50. 'cats' => $cats,
  51. 'index_order'=>$index_order,
  52. 'artist'=>$artist,
  53. 'title'=>$sinfo['name'],
  54. ]);
  55. return $this->fetch();
  56. }
  57. function artistdetail()
  58. {
  59. $id = input('id');
  60. $noticeinfo = db('article')->where(['id' => $id, 'status' => 1])->find();
  61. if (empty($noticeinfo)) {
  62. $noticeinfo = [];
  63. }
  64. $this->view->assign('info', $noticeinfo);
  65. return $this->fetch();
  66. }
  67. function noticedetail()
  68. {
  69. $id = input('id');
  70. $noticeinfo = db('article')->where(['id' => $id, 'status' => 1])->find();
  71. if (empty($noticeinfo)) {
  72. $noticeinfo = [];
  73. }
  74. $this->view->assign('info', $noticeinfo);
  75. return $this->fetch();
  76. }
  77. function notice()
  78. {
  79. #轮播
  80. $slideshow = db('ads')->where(['status' => 1])->select();
  81. if (empty($slideshow)) {
  82. $slideshow = [];
  83. }
  84. $this->view->assign([
  85. 'slideshow' => $slideshow,
  86. ]);
  87. return $this->fetch();
  88. }
  89. function kefu()
  90. {
  91. $noticeinfo = db('article')->where(['catid' => 4, 'status' => 1])->find();
  92. if (empty($noticeinfo)) {
  93. $noticeinfo = [];
  94. }
  95. $this->view->assign('info', $noticeinfo);
  96. return $this->fetch();
  97. }
  98. function qyjs()
  99. {
  100. $noticeinfo = db('article')->where(['catid' => 3, 'status' => 1])->find();
  101. if (empty($noticeinfo)) {
  102. $noticeinfo = [];
  103. }
  104. $this->view->assign('info', $noticeinfo);
  105. return $this->fetch();
  106. }
  107. function xszn()
  108. {
  109. $noticeinfo = db('article')->where(['catid' => 2, 'status' => 1])->find();
  110. if (empty($noticeinfo)) {
  111. $noticeinfo = [];
  112. }
  113. $this->view->assign('info', $noticeinfo);
  114. return $this->fetch();
  115. }
  116. }