From 0ecea494715a6bcdad8e054b4611ac3d2aafb10f Mon Sep 17 00:00:00 2001 From: zengchaoxin Date: Tue, 5 Nov 2019 00:11:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DBUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/models/SysIpT.php | 1 - frontend/controllers/SystemController.php | 44 +++--- frontend/views/insurer-type/index.php | 14 +- frontend/views/pay-type/edit.php | 2 +- frontend/views/system/edit.php | 48 ------- frontend/views/system/ip-edit.php | 68 ++++++++++ frontend/views/system/ip.php | 158 ++++++++++++---------- 7 files changed, 193 insertions(+), 142 deletions(-) delete mode 100644 frontend/views/system/edit.php create mode 100644 frontend/views/system/ip-edit.php diff --git a/common/models/SysIpT.php b/common/models/SysIpT.php index 7a2fc79..57e65ed 100644 --- a/common/models/SysIpT.php +++ b/common/models/SysIpT.php @@ -57,7 +57,6 @@ class SysIpT extends \common\models\Base static public function getIpArray(){ $list = self::find() - ->where('status = 1') ->orderBy('id ASC') ->all(); diff --git a/frontend/controllers/SystemController.php b/frontend/controllers/SystemController.php index 4bda3eb..97a6ec6 100644 --- a/frontend/controllers/SystemController.php +++ b/frontend/controllers/SystemController.php @@ -19,7 +19,8 @@ class SystemController extends \yii\web\Controller { public $my = null; public $web = null; - private $_STATE = 1; + public $enableCsrfValidation = false; + public $layout = 'blue-main'; public function init() { @@ -94,21 +95,27 @@ class SystemController extends \yii\web\Controller * @author liukangle * */ - public function actionIp(){ + public function actionIp() { + return $this->render('ip'); + } + public function actionIpJson(){ + Yii::$app->response->format = Response::FORMAT_JSON; $request = Yii::$app->request; - $name = $request->get('name'); - $ips = SysIpT::find(); - if($name != ''){ - $ips = $ips->andWhere(['like','city_name',$name]); + + $ips = SysIpT::find()->orderBy('id ASC'); + $total = $ips->count(); + $items = $ips->all(); + + $data = []; + $data['total'] = $total; + $data['rows'] = []; + foreach($items as $item) { + $row = $item->toArray(); + $data['rows'][] = $row; } - $ips = $ips->andWhere('status ='.$this->_STATE); - $data = $ips->orderBy('id ASC')->all(); - return $this->render('ip',[ - 'info' => $data, - 'name' => $name, - ]); + return $data; } /** @@ -119,7 +126,7 @@ class SystemController extends \yii\web\Controller * @author liukangle * */ - public function actionEdit() + public function actionIpEdit() { $request = Yii::$app->request; @@ -129,7 +136,7 @@ class SystemController extends \yii\web\Controller } else { $info = new SysIpT(); } - return $this->render('edit',[ + return $this->render('ip-edit',[ 'info' => $info, ]); } @@ -181,7 +188,7 @@ class SystemController extends \yii\web\Controller * @author liukangle * */ - public function actionDel() + public function actionIpDelete() { Yii::$app->response->format = Response::FORMAT_JSON; $request = Yii::$app->request; @@ -194,11 +201,12 @@ class SystemController extends \yii\web\Controller $id = $request->post('id'); if($id > 0){ $row = SysIpT::findOne(['id'=>$id]); - $row->status = 0; - $row->save(); + if($row) { + $row->delete(); + } $result['success'] = true; - $result['msg'] = '保存成功'; + $result['msg'] = '删除成功'; } return $result; diff --git a/frontend/views/insurer-type/index.php b/frontend/views/insurer-type/index.php index 2118666..00702ef 100644 --- a/frontend/views/insurer-type/index.php +++ b/frontend/views/insurer-type/index.php @@ -47,12 +47,14 @@ use \common\libs\MyLib; - - - diff --git a/frontend/views/system/ip-edit.php b/frontend/views/system/ip-edit.php new file mode 100644 index 0000000..4cdab31 --- /dev/null +++ b/frontend/views/system/ip-edit.php @@ -0,0 +1,68 @@ + +beginBlock('header_css'); ?> + +endBlock(); ?> + +
+
+
+
+
+
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+ +beginBlock('footer_js'); ?> + +endBlock('footer_js'); ?> diff --git a/frontend/views/system/ip.php b/frontend/views/system/ip.php index 99ca925..0066e48 100644 --- a/frontend/views/system/ip.php +++ b/frontend/views/system/ip.php @@ -1,76 +1,98 @@ - - - - + + + - - - - - - -
- 名称: - - -
- - - - - - - - - $item){ - ?> - - - - - - - - - 没有查到数据 - -
序列号城市IP操作
city_name ?>ip ?> - [修改] - [删除] -
+ + $(function() { + search(); + }); + +endBlock(); ?>