1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- <?php
- /**
- * 小梦科技资源nanodreamtech.com
- *
- * ==========================================================================
- * @link https://www.nanodreamtech.com/
- * @copyright Copyright (c) 2015 liofis.com.
- * @license https://www.nanodreamtech.com/license.html License
- * ==========================================================================
- *
- * @author fish
- *
- */
- namespace Seller\Controller;
- use Admin\Model\BlogModel;
- class BlogController extends CommonController{
-
- protected function _initialize(){
- parent::_initialize();
- $this->breadcrumb1='帮助列表';
- $this->breadcrumb2='帮助列表';
- $this->blog_type = array('question' => '常见帮助');
- //'pinjie' => '拼团介绍',
- }
-
- public function index(){
- $model=new BlogModel();
-
- $data=$model->show_blog_page();
-
- $this->assign('empty',$data['empty']);// 赋值数据集
- $this->assign('list',$data['list']);// 赋值数据集
- $this->assign('page',$data['page']);// 赋值分页输出
- /**/
- $this->display();
- }
- function add(){
-
- if(IS_POST){
-
- $model=new BlogModel();
- $data=I('post.');
- $return=$model->add_blog($data);
- //echo json_encode($return);
- //die();
-
- $this->osc_alert($return);
- }
- $this->action=U('Blog/add');
- $this->crumbs='新增';
- $this->display('edit');
- }
-
- function edit(){
-
- $model=new BlogModel();
-
- if(IS_POST){
-
- $data=I('post.');
- $return=$model->edit_blog($data);
- //echo json_encode($return);
- //die();
- $this->osc_alert($return);
- }
- $this->crumbs='编辑';
- $this->action=U('Blog/edit');
- $this->blog_content=M('blog_content')->where(array('blog_id'=>I('id')))->find();
-
- $this->blog=$model->get_blog_data(I('id'));
-
- $this->blog_images=$model->get_blog_image_data(I('id'));
-
- $this->blog_categories=$model->get_blog_category_data(I('id'));
-
- $this->display('edit');
- }
-
- function del(){
- $model=new BlogModel();
- $return=$model->del_blog(I('get.id'));
- $this->osc_alert($return);
- }
- }
- ?>
|