Member.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. namespace app\user\controller;
  3. use think\Validate;
  4. use think\Lang;
  5. class Member extends UserControl
  6. {
  7. public function _initialize()
  8. {
  9. parent::_initialize();
  10. Lang::load(APP_PATH . 'admin/lang/' . config('default_lang') . '/member.lang.php');
  11. }
  12. /**
  13. * 用户
  14. * @return mixed
  15. */
  16. public function index()
  17. {
  18. $user_info = $this->getAdminInfo();
  19. if (request()->isPost()) {
  20. $user_name = input('post.user_name');
  21. $company = input('post.company');
  22. $trade = input('post.trade');
  23. $address = input('post.address');
  24. $update_info = array(
  25. 'user_name' => $user_name,
  26. 'company' => $company,
  27. 'trade' => $trade,
  28. 'address' => $address
  29. );
  30. //print_r($update_info);
  31. $res = db('user')->where('user_id', $user_info['user_id'])->update($update_info);
  32. if($res == 1){
  33. $this->success('用户信息修改成功');
  34. }else{
  35. $this->success('用户信息修改失败');
  36. }
  37. //return $this->redirect('User/Member/index');
  38. }else{
  39. $user = db('user')->where('user_email',$user_info['user_email'])->find();
  40. if($user['user_status'] ==1){
  41. $user['user_status'] = '已实名认证';
  42. }
  43. if($user['user_status'] ==-1){
  44. $user['user_status'] = '未实名认证';
  45. }
  46. if($user['user_status'] ==2){
  47. $user['user_status'] = '实名认证中';
  48. }
  49. if($user['user_status'] ==3){
  50. $user['user_status'] = '实名认证失败';
  51. }
  52. if($user['user_type'] ==1){
  53. $user['user_type'] = '个人用户';
  54. }
  55. if($user['user_type'] ==2){
  56. $user['user_type'] = '企业用户';
  57. }
  58. $this->assign('user', $user);
  59. return $this->fetch();
  60. }
  61. }
  62. }