From 5d81a253db978779f6ed31b5504f06456ba4b033 Mon Sep 17 00:00:00 2001 From: zhengyongxing Date: Fri, 13 Mar 2020 19:09:06 +0800 Subject: [PATCH] =?UTF-8?q?ip=E9=99=90=E5=88=B6=E6=8E=A7=E5=88=B6=E5=99=A8?= =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/AmericaIpForbitController.php | 118 ++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 Application/Admin/Controller/AmericaIpForbitController.php 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