MemberController.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <?php
  2. /**
  3. * 会员中心模块
  4. * @author wesmiler
  5. */
  6. namespace app\weixin\controller;
  7. use app\weixin\model\Member;
  8. use app\weixin\model\Wechat;
  9. use app\weixin\validate\MemberValidate;
  10. use think\Request;
  11. class MemberController extends BaseController
  12. {
  13. public function __construct()
  14. {
  15. parent::__construct();
  16. $userStatus = isset($this->userInfo['user_status']) ? intval($this->userInfo['user_status']) : 0;
  17. $agentType = isset($this->userInfo['agent_type']) ? intval($this->userInfo['agent_type']) : 0;
  18. $agentStatus = isset($this->userInfo['agent_status']) ? intval($this->userInfo['agent_status']) : 0;
  19. $needRegProfile = isset($this->userInfo['is_reg_profile'])? $this->userInfo['is_reg_profile'] : 0;
  20. var_dump($this->userInfo);
  21. if($agentType == 1 && $agentStatus != 3 && $needRegProfile != 1){
  22. $url = url('/weixin/market/index', '', '', true);
  23. header("location:{$url}");
  24. exit;
  25. }
  26. // 注销用户跳转
  27. if ($userStatus == -1) {
  28. ob_clean();
  29. header('location:https://mp.weixin.qq.com/mp/profile_ext?action=home&__biz=Mzg3ODEzNjMzMQ==&scene=124#wechat_redirect');
  30. exit;
  31. }
  32. // 验证用户是否完善资料
  33. $action = request()->action();
  34. if(!in_array($action, ['home','profile']) && $needRegProfile != 1){
  35. Wechat::redirectUrl(url('/weixin/index/entry', '', '', true));
  36. exit;
  37. }
  38. }
  39. /**
  40. * 用户中心
  41. * @author wesmiler
  42. * @return mixed
  43. */
  44. public function index()
  45. {
  46. return $this->fetch();
  47. }
  48. /**
  49. * 用户资料
  50. * @return mixed]
  51. */
  52. public function profile()
  53. {
  54. return $this->fetch();
  55. }
  56. /**
  57. * 个人主页
  58. * @return mixed
  59. */
  60. public function home()
  61. {
  62. return $this->fetch();
  63. }
  64. /**
  65. * 邀请页面
  66. * @return mixed
  67. */
  68. public function invite()
  69. {
  70. return $this->fetch();
  71. }
  72. /**
  73. * 怦然心动
  74. * @return mixed
  75. */
  76. public function heartbeat()
  77. {
  78. return $this->fetch();
  79. }
  80. /**
  81. * 团队邀请
  82. * @return mixed
  83. */
  84. public function team_invite()
  85. {
  86. return $this->fetch();
  87. }
  88. /**
  89. * 我的团队
  90. * @return mixed
  91. */
  92. public function team()
  93. {
  94. return $this->fetch();
  95. }
  96. /**
  97. * 我的收藏
  98. * @return mixed
  99. */
  100. public function collect()
  101. {
  102. return $this->fetch();
  103. }
  104. /**
  105. * 我的消息
  106. * @return mixed
  107. */
  108. public function message()
  109. {
  110. return $this->fetch(':member/message/index');
  111. }
  112. }