MemberAuth.php 5.4 KB

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