MemberController.php 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  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. $openid = session('openid');
  17. $userInfo = Member::checkUserInfo($this->userId? $this->userId: $openid);
  18. $needRegProfile = isset($userInfo['is_reg_profile'])? $userInfo['is_reg_profile'] : 0;
  19. $userStatus = isset($userInfo['user_status']) ? intval($userInfo['user_status']) : 0;
  20. $agentType = isset($userInfo['agent_type']) ? intval($userInfo['agent_type']) : 0;
  21. $agentStatus = isset($userInfo['agent_status']) ? intval($userInfo['agent_status']) : 0;
  22. $action = request()->action();
  23. if($agentType == 1 && $agentStatus != 3 && ($needRegProfile != 1 || ($action != 'home' && $userStatus != 1))){
  24. $url = url('/weixin/market/index', '', '', true);
  25. header("location:{$url}");
  26. exit;
  27. }
  28. // 注销用户跳转
  29. if ($userStatus == -1) {
  30. ob_clean();
  31. header('location:https://mp.weixin.qq.com/mp/profile_ext?action=home&__biz=Mzg3ODEzNjMzMQ==&scene=124#wechat_redirect');
  32. exit;
  33. }
  34. // 验证用户是否完善资料
  35. $action = request()->action();
  36. if(!in_array($action, ['home','profile']) && $needRegProfile != 1){
  37. Wechat::redirectUrl(url('/weixin/index/entry', '', '', true));
  38. exit;
  39. }
  40. }
  41. /**
  42. * 用户中心
  43. * @author wesmiler
  44. * @return mixed
  45. */
  46. public function index()
  47. {
  48. return $this->fetch();
  49. }
  50. /**
  51. * 用户资料
  52. * @return mixed]
  53. */
  54. public function profile()
  55. {
  56. return $this->fetch();
  57. }
  58. /**
  59. * 个人主页
  60. * @return mixed
  61. */
  62. public function home()
  63. {
  64. return $this->fetch();
  65. }
  66. /**
  67. * 邀请页面
  68. * @return mixed
  69. */
  70. public function invite()
  71. {
  72. return $this->fetch();
  73. }
  74. /**
  75. * 我的活动
  76. * @return mixed
  77. */
  78. public function activity()
  79. {
  80. return $this->fetch();
  81. }
  82. /**
  83. * 隐私设置
  84. * @return mixed
  85. */
  86. public function secret()
  87. {
  88. return $this->fetch();
  89. }
  90. /**
  91. * 怦然心动
  92. * @return mixed
  93. */
  94. public function heartbeat()
  95. {
  96. return $this->fetch();
  97. }
  98. /**
  99. * 我的收藏
  100. * @return mixed
  101. */
  102. public function collect()
  103. {
  104. return $this->fetch();
  105. }
  106. /**
  107. * 我的消息
  108. * @return mixed
  109. */
  110. public function message()
  111. {
  112. return $this->fetch(':member/message/index');
  113. }
  114. /**
  115. * 我的消息详情
  116. * @return mixed
  117. */
  118. public function messageDetail()
  119. {
  120. return $this->fetch(':member/message/detail');
  121. }
  122. /**
  123. * 我的相册
  124. * @return mixed
  125. */
  126. public function albums()
  127. {
  128. return $this->fetch(':member/data/albums');
  129. }
  130. /**
  131. * 个人信息
  132. * @return mixed
  133. */
  134. public function info()
  135. {
  136. return $this->fetch(':member/data/info');
  137. }
  138. /**
  139. * 我的介绍
  140. * @return mixed
  141. */
  142. public function intro()
  143. {
  144. return $this->fetch(':member/data/intro');
  145. }
  146. /**
  147. * 家庭介绍
  148. * @return mixed
  149. */
  150. public function family()
  151. {
  152. return $this->fetch(':member/data/family');
  153. }
  154. /**
  155. * 兴趣爱好
  156. * @return mixed
  157. */
  158. public function hobby()
  159. {
  160. return $this->fetch(':member/data/hobby');
  161. }
  162. /**
  163. * 单身原因
  164. * @return mixed
  165. */
  166. public function cause()
  167. {
  168. return $this->fetch(':member/data/cause');
  169. }
  170. /**
  171. * 理想需求
  172. * @return mixed
  173. */
  174. public function purpose()
  175. {
  176. return $this->fetch(':member/data/purpose');
  177. }
  178. /**
  179. * 期待的生活
  180. * @return mixed
  181. */
  182. public function expect()
  183. {
  184. return $this->fetch(':member/data/expect');
  185. }
  186. /**
  187. * 个性标签
  188. * @return mixed
  189. */
  190. public function tags()
  191. {
  192. return $this->fetch(':member/data/tags');
  193. }
  194. /**
  195. * 隐私设置
  196. * @return mixed
  197. */
  198. public function privacy()
  199. {
  200. return $this->fetch();
  201. }
  202. /**
  203. * 充值
  204. * @return mixed
  205. */
  206. public function recharge(){
  207. return $this->fetch();
  208. }
  209. }