From c047cc9bf6e4ceb64bb2d8fae955c72725fc2111 Mon Sep 17 00:00:00 2001 From: lccsw <1127794702@qq.com> Date: Wed, 25 Aug 2021 19:02:16 +0800 Subject: [PATCH] edit-admin-liche-cms --- admin/controllers/app/liche/Cms.php | 27 ++++++++++++++++++++++++--- admin/views/app/liche/cms/edit.php | 20 ++++++++++++++++++-- 2 files changed, 42 insertions(+), 5 deletions(-) diff --git a/admin/controllers/app/liche/Cms.php b/admin/controllers/app/liche/Cms.php index d744ca41..1cb949f5 100755 --- a/admin/controllers/app/liche/Cms.php +++ b/admin/controllers/app/liche/Cms.php @@ -71,7 +71,19 @@ class Cms extends HD_Controller $row['btn_type'] = $json['btn_type'] ? $json['btn_type'] : 1; $row['bg_img'] = $json['bg_img'] ? $json['bg_img'] : ''; $row['bg_img_src'] = $json['bg_img'] ? build_qiniu_image_url($json['bg_img']) : ''; - $row['cfrom_id'] = $json['cfrom_id'] ? $json['cfrom_id']:0; + $cfrom_id2 = $cfrom_id = 0; + if($json['cfrom_id']){ + $c_row = $this->clues_cfrom_model->get(['id'=>$json['cfrom_id']],'id,pid'); + if($c_row['pid']){ + $f_row = $this->clues_cfrom_model->get(['id'=>$c_row['pid']],'id'); + $cfrom_id = $f_row['id']; + $cfrom_id2 = $c_row['id']; + }else{ + $cfrom_id = $json['cfrom_id']; + } + } + $row['cfrom_id'] = $cfrom_id; + $row['cfrom_id2'] = $cfrom_id2; $row['link'] = $row['url']; $row['s_time'] = date('Y-m-d H:i:s', $row['s_time']); $row['e_time'] = date('Y-m-d H:i:s', $row['e_time']); @@ -79,13 +91,13 @@ class Cms extends HD_Controller $title = "编辑{$row['title']}"; } else { - $row = array('position' => '', 'type' => 1,'btn_type'=>1,'cfrom_id' => 0); + $row = array('position' => '', 'type' => 1,'btn_type'=>1,'cfrom_id' => 0,'cfrom_id2'=>0); $opration = 'add'; $title = '添加推送信息'; $covers = array(); } //列表 - $this->data['cfroms'] = $this->clues_cfrom_model->select(['status'=>1],'id desc','','','id,title'); + $this->data['cfroms'] = $this->clues_cfrom_model->select(['status'=>1,'pid'=>0],'id desc','','','id,title'); $this->data['app_id'] = 3; $this->data['info'] = $row; $this->data['pos_arr'] = $this->pos_arr; @@ -125,6 +137,7 @@ class Cms extends HD_Controller $json = array(); $input['cfrom_id'] && $json['cfrom_id'] = $input['cfrom_id']; + $input['cfrom_id2'] && $json['cfrom_id'] = $input['cfrom_id2']; $input['btn_type'] && $json['btn_type'] = $input['btn_type']; $input['bg_img'] && $json['bg_img'] = $input['bg_img']; if($json){ @@ -158,6 +171,7 @@ class Cms extends HD_Controller $input['btn_type'] && $json['btn_type'] = $input['btn_type']; $input['bg_img'] && $json['bg_img'] = $input['bg_img']; $input['cfrom_id'] && $json['cfrom_id'] = $input['cfrom_id']; + $input['cfrom_id2'] && $json['cfrom_id'] = $input['cfrom_id2']; $upd = [ 'title' => $input['title'] ? $input['title'] : '', 'url' => $input['link'] ? $input['link'] : '', @@ -210,4 +224,11 @@ class Cms extends HD_Controller $this->data['data'] = $info; return $this->show_json(SYS_CODE_SUCCESS); } + + public function get_cfroms(){ + $id = $this->input->get('id'); + $rows = $this->clues_cfrom_model->select(['pid'=>$id,'status'=>1],'id desc','','','id,title'); + $this->data['data'] = $rows; + return $this->show_json(SYS_CODE_SUCCESS); + } } diff --git a/admin/views/app/liche/cms/edit.php b/admin/views/app/liche/cms/edit.php index 2b680fe3..c69a5661 100755 --- a/admin/views/app/liche/cms/edit.php +++ b/admin/views/app/liche/cms/edit.php @@ -45,13 +45,19 @@
-
- +
@@ -356,6 +362,7 @@ covers:[], app_id:0, cfroms:[], + cfroms2:[], }, mounted: function(){ var that = this; @@ -365,8 +372,17 @@ that.covers = ; that.app_id = ; that.cfroms = ; + that.getCfroms() }, methods: { + getCfroms: function(){ + var that = this + if(that.info.cfrom_id){ + $.get('/app/liche/cms/get_cfroms',{'id':that.info.cfrom_id},function(result){ + that.cfroms2 = result.data.data + }); + } + }, saveEdit: function () { if (loading) { return;