Index.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. namespace app\index\controller;
  3. use app\common\controller\Frontend;
  4. use think\Db;
  5. class Index extends Frontend
  6. {
  7. protected $noNeedLogin = '*';
  8. protected $noNeedRight = '*';
  9. protected $layout = '';
  10. public function index()
  11. {
  12. return $this->view->fetch();
  13. }
  14. /**
  15. * 获取网站配置信息
  16. */
  17. public function info() {
  18. $params = $this->request->request("params"); //内容
  19. $this->view->assign('info',config("site.".$params));
  20. return $this->view->fetch();
  21. }
  22. //邀请页面
  23. public function invite() {
  24. $code = input('code', '', 'trim');
  25. if (!$code) {
  26. $this->error('邀请码不存在');
  27. }
  28. $count = Db::name('user')->where(['invite_no' => $code])->count();
  29. if (!$count) {
  30. $this->error('邀请码不存在');
  31. }
  32. $is_wechat = strpos($this->request->server('HTTP_USER_AGENT'), 'MicroMessenger') !== false;
  33. if($is_wechat) {
  34. $is_wechat = 1;
  35. } else {
  36. $is_wechat = 0;
  37. }
  38. $this->view->assign('code', $code);
  39. $this->view->assign('is_wechat', $is_wechat);
  40. return $this->view->fetch();
  41. }
  42. }