diff --git a/Application/Admin/Controller/AmericaIpForbitController.php b/Application/Admin/Controller/AmericaIpForbitController.php new file mode 100644 index 000000000..ec99c8154 --- /dev/null +++ b/Application/Admin/Controller/AmericaIpForbitController.php @@ -0,0 +1,118 @@ +where($map) + ->page($page,$row) + ->select(); + + $this->assgin('data',$data); + + $this->display(); + + } + + public function operateIp() { + + if (!I('id')) { + $this->ajaxReturn(['code'=>1,'msg'=>'ID未选择']); + } else { + $id = I('id'); + } + + if (I('status')) { + $status = I('status'); + } else { + $status = 0; + } + + + $map['id'] = ['in',$id]; + + + $is_change = M('forbit_ip','tab_')->where(['id'=>['in',$id]])->save(['status'=>$status]); + + if ($is_change) { + $this->ajaxReturn(['code'=>0]); + } else { + $this->ajaxReturn(['code'=>1]); + } + + } + + public function del() { + + if (!I('id')) { + $this->ajaxReturn(['code'=>1,'msg'=>'ID未选择']); + } else { + $id = I('id'); + } + + $is_del = $is_change = M('forbit_ip','tab_')->where(['id'=>['in',$id]])->delete(); + + if ($is_del) { + $this->ajaxReturn(['code'=>0]); + } else { + $this->ajaxReturn(['code'=>1]); + } + + } + + public function addUser() { + + $insert = []; + + $hav_user = M('user','tab_')->where(['account'=>I('user_account')])->find(); + + if (!$hav_user) { + $this->ajaxReturn(['msg'=>'用户不存在','code'=>1]); + } + + $insert['user_id'] = $hav_user['id']; + $insert['user_account'] = I('user_account'); + $insert['area'] = I('area'); + $insert['status'] = I('status'); + $insert['admin_id'] = I('admin_id'); + $insert['admin_account'] = I('admin_account'); + $insert['create_time'] = time(); + $insert['remarks'] = ''; + + $is_insert = M('forbit_ip','tab_')->add($insert); + + if ($is_insert) { + $this->ajaxReturn(['code'=>0]); + } else { + $this->ajaxReturn(['code'=>1]); + } + + + } + + +} \ No newline at end of file