MemberController.php 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  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. $sid = input('sid', 0);
  65. if($sid){
  66. session('sid', input('sid', 0));
  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. /**
  214. * 举报用户列表
  215. * @return mixed
  216. */
  217. public function complain(){
  218. return $this->fetch();
  219. }
  220. /**
  221. * 举报用户
  222. * @return mixed
  223. */
  224. public function complainSubmit(){
  225. return $this->fetch();
  226. }
  227. /**
  228. * 用户建议
  229. * @return mixed|string
  230. */
  231. public function advice(){
  232. return $this->fetch();
  233. }
  234. }