MemberAuth.php 5.2 KB

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