MemberController.php 4.4 KB

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