MemberAuth.php 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <?php
  2. namespace app\admin\controller;
  3. use think\facade\View;
  4. use think\facade\Lang;
  5. use PHPExcel;
  6. /**
  7. * ============================================================================
  8. *
  9. * ============================================================================
  10. *
  11. * ----------------------------------------------------------------------------
  12. *
  13. * ============================================================================
  14. * 控制器
  15. */
  16. class MemberAuth extends AdminControl {
  17. const EXPORT_SIZE = 1000;
  18. public function initialize() {
  19. parent::initialize();
  20. Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/member.lang.php');
  21. Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/member_auth.lang.php');
  22. }
  23. public function index() {
  24. $member_model = model('member');
  25. $search_field_value = input('search_field_value');
  26. $search_field_name = input('search_field_name');
  27. $condition = '1=1';
  28. $filtered=0;
  29. $default_condition = array();
  30. if ($search_field_value != '') {
  31. switch ($search_field_name) {
  32. case 'member_name':
  33. $condition.=' AND member_name LIKE "%' . trim($search_field_value) . '%"';
  34. $filtered=1;
  35. break;
  36. case 'member_email':
  37. $condition.=' AND member_email LIKE "%' . trim($search_field_value) . '%"';
  38. $filtered=1;
  39. break;
  40. case 'member_mobile':
  41. $condition.=' AND member_mobile LIKE "%' . trim($search_field_value) . '%"';
  42. $filtered=1;
  43. break;
  44. case 'member_truename':
  45. $condition.=' AND member_truename LIKE "%' . trim($search_field_value) . '%"';
  46. $filtered=1;
  47. break;
  48. }
  49. }
  50. $search_state = input('search_state');
  51. switch ($search_state) {
  52. case 'check':
  53. $condition.=' AND member_auth_state=1';
  54. $filtered=1;
  55. break;
  56. case 'pass':
  57. $condition.=' AND member_auth_state=3';
  58. $filtered=1;
  59. break;
  60. case 'fail':
  61. $condition.=' AND member_auth_state=2';
  62. $filtered=1;
  63. break;
  64. default:
  65. $condition.=' AND member_auth_state IN (1,2,3)';
  66. }
  67. $member_list = $member_model->getMemberList($condition, '*', 10, 'member_id desc');
  68. //整理会员信息
  69. if (is_array($member_list) && !empty($member_list)) {
  70. foreach ($member_list as $k => $v) {
  71. $member_list[$k]['member_addtime'] = $v['member_addtime'] ? date('Y-m-d H:i:s', $v['member_addtime']) : '';
  72. }
  73. }
  74. View::assign('search_field_name', trim($search_field_name));
  75. View::assign('search_field_value', trim($search_field_value));
  76. View::assign('member_list', $member_list);
  77. View::assign('show_page', $member_model->page_info->render());
  78. View::assign('filtered', $filtered); //是否有查询条件
  79. $this->setAdminCurItem('index');
  80. return View::fetch();
  81. }
  82. public function verify(){
  83. $member_id = input('param.member_id');
  84. $state = input('param.state');
  85. $message = input('param.message');
  86. $member_id_array = ds_delete_param($member_id);
  87. if ($member_id_array == FALSE || !in_array($state, array(1,2))) {
  88. ds_json_encode(10001, lang('param_error'));
  89. }
  90. if($state==1){
  91. $update=array('member_auth_state'=>3);
  92. }else{
  93. $update=array('member_auth_state'=>2);
  94. }
  95. if(!model('member')->editMember(array(array('member_auth_state','=',1),array('member_id','in',$member_id_array)),$update)){
  96. ds_json_encode(10001, lang('ds_common_op_fail'));
  97. }
  98. if($message){
  99. //添加短消息
  100. $message_model = model('message');
  101. $insert_arr = array();
  102. $insert_arr['from_member_id'] = 0;
  103. $insert_arr['member_id'] = "," . implode(',', $member_id_array) . ",";
  104. $insert_arr['msg_content'] = lang('member_auth_fail').':'.$message;
  105. $insert_arr['message_type'] = 1;
  106. $insert_arr['message_ismore'] = 1;
  107. $message_model->addMessage($insert_arr);
  108. }
  109. ds_json_encode(10000, lang('ds_common_op_succ'));
  110. }
  111. /**
  112. * 获取卖家栏目列表,针对控制器下的栏目
  113. */
  114. protected function getAdminItemList() {
  115. $menu_array = array(
  116. array(
  117. 'name' => 'index',
  118. 'text' => lang('ds_list'),
  119. 'url' => (string)url('MemberAuth/index')
  120. ),
  121. );
  122. return $menu_array;
  123. }
  124. }