BxqUserInvestorAction.class.php 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. <?php
  2. class UserInvestorAction extends CommonAction{
  3. public function index(){
  4. if(intval($_REQUEST['id'])>0)
  5. {
  6. $map[DB_PREFIX.'user.id'].= intval($_REQUEST['id']);
  7. }
  8. if(trim($_REQUEST['nick_name'])!='')
  9. {
  10. $map[DB_PREFIX.'user.nick_name'] = array('like','%'.trim($_REQUEST['nick_name']).'%');
  11. }
  12. if(trim($_REQUEST['contact'])!='')
  13. {
  14. $map[DB_PREFIX.'user.contact'] = array('like','%'.trim($_REQUEST['contact']).'%');
  15. }
  16. if(trim($_REQUEST['mobile'])!='')
  17. {
  18. $map[DB_PREFIX.'user.mobile'] = array('like','%'.trim($_REQUEST['mobile']).'%');
  19. }
  20. $map[DB_PREFIX.'user.is_authentication'] = 1;
  21. $map[DB_PREFIX.'user.is_effect'] = 1;
  22. $map[DB_PREFIX.'user.is_robot'] = 0;
  23. if (method_exists ( $this, '_filter' )) {
  24. $this->_filter ( $map );
  25. }
  26. //$name=$this->getActionName();
  27. $model = D ('User');
  28. if (! empty ( $model )) {
  29. $this->_list ( $model, $map );
  30. }
  31. $this->display ();
  32. }
  33. public function show_content(){
  34. $id=intval($_REQUEST['id']);
  35. $status=intval($_REQUEST['status']);
  36. $user=M("user")->getById($id);
  37. if($status==1){
  38. $user['do_info']='审核通过';
  39. }elseif($status==3){
  40. $user['do_info']='审核';
  41. $show_bnt=3;
  42. }else{
  43. $user['do_info']='审核不通过';
  44. }
  45. $user['is_investor_name']=get_investor($user['user_type']);
  46. $user['investor_status_name']=get_investor_status($user['is_authentication']);
  47. $user['identify_hold_image']=get_spec_image($user['identify_hold_image']);
  48. $user['identify_positive_image']=get_spec_image($user['identify_positive_image']);
  49. $user['identify_nagative_image']=get_spec_image($user['identify_nagative_image']);
  50. $data['order_type'] = 'shop';
  51. $data['order_status'] = 4;
  52. $data['viewer_id'] = $id;
  53. // if(define(DISTRIBUTION_MODULE) && DISTRIBUTION_MODULE == 1){
  54. // $order = M('goods_order')->where($data)->count('id');
  55. // $user['order'] = intval($order);
  56. // }
  57. $this->assign('user',$user);
  58. $this->assign('status',$status);
  59. $this->assign('show_bnt',$show_bnt);
  60. $this->display();
  61. }
  62. public function batch_content(){
  63. $id=$_REQUEST['id'];
  64. $implode_id = implode(',',(explode(',',$id)));
  65. $user = $GLOBALS['db']->getAll("select id,authentication_name,identify_number,identify_positive_image,identify_nagative_image,identify_hold_image,is_authentication from ".DB_PREFIX."user where id in($implode_id)");
  66. $this->assign('list',$user);
  67. $this->assign('implode_id',$implode_id);
  68. // $this->assign('show_bnt',$show_bnt);
  69. $this->display();
  70. }
  71. public function investor_go_allow()
  72. {
  73. $id = $_REQUEST['id'];
  74. $status = intval($_REQUEST['is_authentication']);
  75. $v_explain = strim($_REQUEST['v_explain']);
  76. if ($_REQUEST['investor_send_info']) {
  77. $investor_send_info = strim($_REQUEST['investor_send_info']);
  78. }
  79. fanwe_require(APP_ROOT_PATH . 'mapi/lib/redis/BaseRedisService.php');
  80. fanwe_require(APP_ROOT_PATH . 'mapi/lib/redis/UserRedisService.php');
  81. $user_redis = new UserRedisService();
  82. $user = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "user where id in($id)");
  83. foreach ($user as $k => $v) {
  84. $authentication_type[$k]=$user[$k]['authentication_type'];
  85. $user_id[$k]=$user[$k]['id'];
  86. $recom[$k]=$user[$k]['family_recom'];
  87. $family_id[$k]=$user[$k]['family_id'];
  88. }
  89. if ($user) {
  90. for($i=0;$i<count($user);$i++) {
  91. $family_recom = $GLOBALS['db']->getOne("select id from " . DB_PREFIX . "family where family_recom='$recom[$i]'");
  92. //$user_data['id'] = $user['id'];
  93. $user_data['is_authentication'] = $status;
  94. if ($status == 3) {
  95. $m_config = load_auto_cache("m_config");
  96. $user_data['v_explain'] = '';
  97. $user_data['v_icon'] = '';
  98. $user_data['investor_time'] = get_gmtime() + $m_config['attestation_time'];
  99. } else {
  100. $user_data['v_explain'] = $v_explain;
  101. if($user_data['v_explain']==''){
  102. $user_data['v_explain'] =$authentication_type[$i];
  103. }
  104. $user_data['v_icon'] = get_spec_image(M('AuthentList')->where("name='" . trim($authentication_type[$i] . "'"))->getField("icon"));
  105. if($family_recom&&$family_id[$i]==0){
  106. $data['family_id'] = $family_recom;
  107. $data['user_id'] = $user_id[$i];
  108. $data['create_time'] = NOW_TIME;//获取当前时间
  109. $data['status'] = 1;
  110. $data['memo'] = $user_id[$i] . "通过认证加入家族";
  111. $GLOBALS['db']->autoExecute(DB_PREFIX . "family_join", $data, "INSERT");
  112. $GLOBALS['db']->query("update " . DB_PREFIX . "user set family_id = " . $family_recom . ",family_chieftain = 0 where id=" . $user_id[$i]);
  113. $user_redis->update_db($user_id[$i], array('family_id' => $family_recom, 'family_chieftain' => 0));
  114. }
  115. }
  116. //认证ID
  117. $user_data['authent_list_id'] = get_spec_image(M('AuthentList')->where("name='" . trim($authentication_type[$i] . "'"))->getField("id"));
  118. if ($investor_send_info) {
  119. $user_data['investor_send_info'] = $investor_send_info;
  120. } else {
  121. $user_data['investor_send_info'] = '';
  122. }
  123. /*$list = M("User")->save($user_data);
  124. if ($list !== false){
  125. save_log($user_data['id']."审核操作成功",1);
  126. }else{
  127. save_log($user_data['id']."审核操作失败",0);
  128. }*/
  129. $where = "id=".intval($user_id[$i]);
  130. if ($GLOBALS['db']->autoExecute(DB_PREFIX . "user", $user_data, 'UPDATE', $where)) {
  131. save_log($user_id[$i] . "审核操作成功", 1);
  132. } else {
  133. save_log($user_id[$i] . "审核操作失败", 0);
  134. }
  135. //redis化
  136. $user_redis->update_db($user_id[$i], $user_data);
  137. //send_investor_status($user_data);
  138. }
  139. $this->success("操作成功");
  140. } else {
  141. $this->error("没有该会员信息");
  142. }
  143. }
  144. }
  145. ?>