MemberController.php 4.6 KB

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