MemberController.php 4.6 KB

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