MemberController.php 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  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 wechat()
  63. {
  64. return $this->fetch();
  65. }
  66. /**
  67. * 个人主页
  68. * @return mixed
  69. */
  70. public function home()
  71. {
  72. $sid = input('sid', 0);
  73. if($sid){
  74. session('sid', input('sid', 0));
  75. }
  76. return $this->fetch();
  77. }
  78. /**
  79. * 邀请页面
  80. * @return mixed
  81. */
  82. public function invite()
  83. {
  84. return $this->fetch();
  85. }
  86. /**
  87. * 我的活动
  88. * @return mixed
  89. */
  90. public function activity()
  91. {
  92. return $this->fetch();
  93. }
  94. /**
  95. * 隐私设置
  96. * @return mixed
  97. */
  98. public function secret()
  99. {
  100. return $this->fetch();
  101. }
  102. /**
  103. * 怦然心动
  104. * @return mixed
  105. */
  106. public function heartbeat()
  107. {
  108. return $this->fetch();
  109. }
  110. /**
  111. * 我的收藏
  112. * @return mixed
  113. */
  114. public function collect()
  115. {
  116. return $this->fetch();
  117. }
  118. /**
  119. * 我的消息
  120. * @return mixed
  121. */
  122. public function message()
  123. {
  124. return $this->fetch(':member/message/index');
  125. }
  126. /**
  127. * 我的消息详情
  128. * @return mixed
  129. */
  130. public function messageDetail()
  131. {
  132. return $this->fetch(':member/message/detail');
  133. }
  134. /**
  135. * 我的访客
  136. * @return mixed
  137. */
  138. public function access()
  139. {
  140. return $this->fetch(':member/access/index');
  141. }
  142. /**
  143. * 我的相册
  144. * @return mixed
  145. */
  146. public function albums()
  147. {
  148. return $this->fetch(':member/data/albums');
  149. }
  150. /**
  151. * 个人信息
  152. * @return mixed
  153. */
  154. public function info()
  155. {
  156. return $this->fetch(':member/data/info');
  157. }
  158. /**
  159. * 我的介绍
  160. * @return mixed
  161. */
  162. public function intro()
  163. {
  164. return $this->fetch(':member/data/intro');
  165. }
  166. /**
  167. * 家庭介绍
  168. * @return mixed
  169. */
  170. public function family()
  171. {
  172. return $this->fetch(':member/data/family');
  173. }
  174. /**
  175. * 兴趣爱好
  176. * @return mixed
  177. */
  178. public function hobby()
  179. {
  180. return $this->fetch(':member/data/hobby');
  181. }
  182. /**
  183. * 单身原因
  184. * @return mixed
  185. */
  186. public function cause()
  187. {
  188. return $this->fetch(':member/data/cause');
  189. }
  190. /**
  191. * 理想需求
  192. * @return mixed
  193. */
  194. public function purpose()
  195. {
  196. return $this->fetch(':member/data/purpose');
  197. }
  198. /**
  199. * 期待的生活
  200. * @return mixed
  201. */
  202. public function expect()
  203. {
  204. return $this->fetch(':member/data/expect');
  205. }
  206. /**
  207. * 个性标签
  208. * @return mixed
  209. */
  210. public function tags()
  211. {
  212. return $this->fetch(':member/data/tags');
  213. }
  214. /**
  215. * 隐私设置
  216. * @return mixed
  217. */
  218. public function privacy()
  219. {
  220. return $this->fetch();
  221. }
  222. /**
  223. * 充值
  224. * @return mixed
  225. */
  226. public function recharge(){
  227. return $this->fetch();
  228. }
  229. /**
  230. * 举报用户列表
  231. * @return mixed
  232. */
  233. public function complain(){
  234. return $this->fetch();
  235. }
  236. /**
  237. * 举报用户
  238. * @return mixed
  239. */
  240. public function complainSubmit(){
  241. return $this->fetch();
  242. }
  243. /**
  244. * 用户建议
  245. * @return mixed|string
  246. */
  247. public function advice(){
  248. return $this->fetch();
  249. }
  250. /**
  251. * 签到
  252. * @return mixed]
  253. */
  254. public function signs()
  255. {
  256. return $this->fetch();
  257. }
  258. }