Index.php 4.1 KB

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