Index.php 4.2 KB

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