fetch(); } /* * 创建form表单 * */ public function create($uid =0) { if ($uid) $vipinfo = UserModel::get($uid); $field[] = Form::input('off', '拒绝理由', isset($vipinfo) ? $vipinfo->off: '')->col(Form::col(24)); $form = Form::make_post_form('添加拒绝理由', $field, Url::buildUrl('save', ['uid' => $uid]), 2); $this->assign(compact('form')); return $this->fetch('public/form-builder'); } /* * 审核/拒绝 * @param $uid 审核的用户uid * @return json * */ public function save($uid = 0) { $data = UtilService::postMore([ ['off', ''], ]); if (!$data['off']) return JsonService::fail('请输入拒绝理由'); if($data['off']){ // 查询是否已审核 $res1=UserModel::where(['uid' => $uid])->find(); if($res1['is_auth']==0||$res1['is_auth']==2){ return JsonService::fail('该信息已审核!不可操作'); } $res=UserModel::where(['uid' => $uid])->update(['reason' =>$data['off'],'is_auth'=>"0"]); if($res>0){ return JsonService::successful('审核成功'); }else{ return JsonService::fail('该信息已审核!不可重复'); } } } /* * 审核通过 * @param int $id * */ //9db06bcff9248837f86d1a6bcf41c9e75c5b46740f277f2c87dd023e960c5cfc public function pass($uid = 0,$id,$name){ if($uid){ // 查询是否已审核 $res1=UserModel::where(['uid' => $uid])->find(); if($res1['is_auth']==0||$res1['is_auth']==2){ return JsonService::fail('该信息已审核!不可操作'); } $res=UserModel::where(['uid' => $uid])->update(['is_auth' =>2,'reason'=>'审核通过']); if($res>0){ // 取出用户名和密码放到后台管理员中 $salt= substr(md5(rand(1, 999999)), 0, 6); $pwd= md5($res1['password'] . md5($salt)); $data = ['account' =>$res1['user'], 'pwd' =>$pwd,'salt'=>$salt,'status'=>1,'mer_id'=>$id,'roles'=>7,'real_name'=>$name,'add_time'=>time(),'level'=>2]; $rslut=Admin::insert($data); if($rslut){ return JsonService::successful('审核成功'); } }else{ return JsonService::fail('审核失败'); } } return JsonService::fail('参数错误!'); } /* * 获取列表 * @param int page * @param int limit * */ public function get_system_user_list() { $where =UtilService::getMore([ ['page', 1], ['limit', 20], ['is_auth',0] ]); return JsonService::successlayui(UserModel::authlist($where)); } }