UserInvestorAction.class.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  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 batch_content(){
  34. $id=$_REQUEST['id'];
  35. $implode_id = implode(',',(explode(',',$id)));
  36. $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)");
  37. //是否显示身份证号码
  38. $m_config = load_auto_cache("m_config");
  39. $show_identify_number = intval($m_config['is_show_identify_number']);
  40. $this->assign('show_identify_number',$show_identify_number);
  41. $this->assign('list',$user);
  42. $this->assign('implode_id',$implode_id);
  43. // $this->assign('show_bnt',$show_bnt);
  44. $this->display();
  45. }
  46. public function show_content(){
  47. $id=intval($_REQUEST['id']);
  48. $status=intval($_REQUEST['status']);
  49. $user=M("user")->getById($id);
  50. if($status==1){
  51. $user['do_info']='审核通过';
  52. }elseif($status==3){
  53. $user['do_info']='审核';
  54. $show_bnt=3;
  55. }else{
  56. $user['do_info']='审核不通过';
  57. }
  58. $user['is_investor_name']=get_investor($user['user_type']);
  59. $user['investor_status_name']=get_investor_status($user['is_authentication']);
  60. $user['identify_hold_image']=get_spec_image($user['identify_hold_image']);
  61. $user['identify_positive_image']=get_spec_image($user['identify_positive_image']);
  62. $user['identify_nagative_image']=get_spec_image($user['identify_nagative_image']);
  63. $data['order_type'] = 'shop';
  64. $data['order_status'] = 4;
  65. $data['viewer_id'] = $id;
  66. // if(define(DISTRIBUTION_MODULE) && DISTRIBUTION_MODULE == 1){
  67. // $order = M('goods_order')->where($data)->count('id');
  68. // $user['order'] = intval($order);
  69. // }
  70. //是否显示身份证号码
  71. $m_config = load_auto_cache("m_config");
  72. $show_identify_number = intval($m_config['is_show_identify_number']);
  73. //①用户认证状态为非默认状态(未认证) AND 身份证号码为空, 则不显示身份证号码
  74. if(intval($user['is_authentication'])!=0 && trim($user['identify_number'])==''){
  75. $show_identify_number = 0;
  76. }
  77. // //②用户认证状态为未通过(3)状态 AND 需要身份验证, 则显示身份验证
  78. // if(intval($user['is_authentication'])==3 && intval($m_config['is_show_identify_number'])==1){
  79. // $show_identify_number = 1;
  80. // }
  81. //查询有哪些家族 ljz
  82. if((defined('OPEN_FAMILY_JOIN')&&OPEN_FAMILY_JOIN==1)){
  83. $family = $GLOBALS['db']->getAll("select name,id,user_id from " . DB_PREFIX . "family");
  84. $family_bj = 0;//标记位,记录是否是族长
  85. //判断该成员是否是族长
  86. foreach ($family as $key => $val){
  87. if($id == $val['user_id']){
  88. $family = array();
  89. $family[] = array('id' => $val['id'],'name' => $val['name']);
  90. $family_bj = 1;
  91. }
  92. }
  93. if($family_bj == 0){
  94. $family = $GLOBALS['db']->getAll("select name,id,user_id,status from " . DB_PREFIX . "family where status=1");
  95. }
  96. //查询该成员的家族ID
  97. $user_family = $GLOBALS['db']->getOne("select family_id from ".DB_PREFIX."user where id=".$id);
  98. $this->assign('user_family',$user_family);
  99. $this->assign('family',$family);
  100. }else{
  101. $family = 0;
  102. $this->assign('family',$family);
  103. }
  104. //公会邀请码是否开启
  105. if(defined('OPEN_SOCIETY_MODULE') && OPEN_SOCIETY_MODULE && $m_config['society_pattern'] && $m_config['open_society_code']){
  106. $this->assign('open_code',1);
  107. }else {
  108. $this->assign('open_code',0);
  109. }
  110. $this->assign('user',$user);
  111. $this->assign('status',$status);
  112. $this->assign('show_bnt',$show_bnt);
  113. $this->assign('show_identify_number',$show_identify_number);
  114. $this->display();
  115. }
  116. public function investor_go_allow()
  117. {
  118. $id = $_REQUEST['id'];
  119. $status = intval($_REQUEST['is_authentication']);
  120. $v_explain = strim($_REQUEST['v_explain']);
  121. if ($_REQUEST['investor_send_info']) {
  122. $investor_send_info = strim($_REQUEST['investor_send_info']);
  123. }
  124. fanwe_require(APP_ROOT_PATH . 'mapi/lib/redis/BaseRedisService.php');
  125. fanwe_require(APP_ROOT_PATH . 'mapi/lib/redis/UserRedisService.php');
  126. $user_redis = new UserRedisService();
  127. $user = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "user where id in($id)");
  128. foreach ($user as $k => $v) {
  129. $authentication_type[$k]=$user[$k]['authentication_type'];
  130. $user_id[$k]=$user[$k]['id'];
  131. }
  132. if ($user) {
  133. for($i=0;$i<count($user);$i++) {
  134. //$user_data['id'] = $user['id'];
  135. $user_data['is_authentication'] = $status;
  136. if ($status == 3) {
  137. $m_config = load_auto_cache("m_config");
  138. $user_data['v_explain'] = '';
  139. $user_data['v_icon'] = '';
  140. $user_data['investor_time'] = get_gmtime() + $m_config['attestation_time'];
  141. } else {
  142. $user_data['v_explain'] = $v_explain;
  143. if($user_data['v_explain']==''){
  144. $user_data['v_explain'] =$authentication_type[$i];
  145. }
  146. $user_data['v_icon'] = get_spec_image(M('AuthentList')->where("name='" . trim($authentication_type[$i] . "'"))->getField("icon"));
  147. }
  148. //认证ID
  149. $user_data['authent_list_id'] = get_spec_image(M('AuthentList')->where("name='" . trim($authentication_type[$i] . "'"))->getField("id"));
  150. if ($investor_send_info) {
  151. $user_data['investor_send_info'] = $investor_send_info;
  152. } else {
  153. $user_data['investor_send_info'] = '';
  154. }
  155. //ljz
  156. if((defined('OPEN_FAMILY_JOIN')&&OPEN_FAMILY_JOIN==1)){
  157. $family_id = intval($_REQUEST['family']);//家族ID
  158. if($family_id){//更新家族ID
  159. $user_data['family_id'] = $family_id;
  160. }else{
  161. $user_data['family_id'] = 0;
  162. }
  163. }
  164. //公会邀请码ljz
  165. if(defined('OPEN_SOCIETY_MODULE') && OPEN_SOCIETY_MODULE){
  166. $m_config = load_auto_cache("m_config");
  167. if($m_config['society_pattern'] != 0 && $m_config['open_society_code'] == 1 && $status == 2 && strlen($user[$i]['society_code']) > 0){
  168. //查询用户是否已经有公会
  169. if($user[$i]['society_id'] > 0){
  170. $GLOBALS['db']->query("update ".DB_PREFIX."user set society_code=null where id=".$user_id[$i]);
  171. $user_data['society_code'] = null;
  172. //$this->error('抱歉你已有公会,公会邀请码失效');
  173. }else{
  174. //查询邀请码对应的公会
  175. $society_id = $GLOBALS['db']->getOne("select id from ".DB_PREFIX."society where status=1 and society_code='".$user[$i]['society_code']."'");
  176. if(!empty($society_id)){
  177. $oTime = time();//获取当前时间戳
  178. //$GLOBALS['db']->query("update ".DB_PREFIX."user set society_id=".$society_id." where id=".$user_id[$i]);
  179. //$user_data['society_id'] = $society_id;
  180. //$GLOBALS['db']->query("delete from " . DB_PREFIX . "society_apply where society_id=".$society_id." and apply_type=0 and user_id=".$user_id[$i]);
  181. //$GLOBALS['db']->autoExecute(DB_PREFIX . 'society_apply',array('society_id'=>$society_id,'user_id'=>$user_id[$i],'create_time'=>$oTime,'apply_type'=>0,'status'=>0));
  182. $GLOBALS['db']->autoExecute(DB_PREFIX . 'society_apply',array('society_id'=>$society_id,'user_id'=>$user_id[$i],'create_time'=>$oTime,'apply_type'=>0,'status'=>0));
  183. }else{
  184. $user_data['society_code'] = null;
  185. //$this->error('公会邀请码不存在');
  186. }
  187. }
  188. }else{
  189. $user_data['society_code'] = null;
  190. }
  191. }
  192. /*$list = M("User")->save($user_data);
  193. if ($list !== false){
  194. save_log($user_data['id']."审核操作成功",1);
  195. }else{
  196. save_log($user_data['id']."审核操作失败",0);
  197. }*/
  198. $where = "id=".intval($user_id[$i]);
  199. if ($GLOBALS['db']->autoExecute(DB_PREFIX . "user", $user_data, 'UPDATE', $where)) {
  200. save_log($user_id[$i] . "审核操作成功", 1);
  201. } else {
  202. save_log($user_id[$i] . "审核操作失败", 0);
  203. }
  204. //redis化
  205. $user_redis->update_db($user_id[$i], $user_data);
  206. //send_investor_status($user_data);
  207. }
  208. $this->success("操作成功");
  209. } else {
  210. $this->error("没有该会员信息");
  211. }
  212. }
  213. }
  214. ?>