<?php
/**
 * Created by PhpStorm.
 * User: yckj_lzj
 * Date: 2020-05-21
 * Time: 11:45
 */

namespace app\index\controller;


class Demo extends IndexBase
{
    public function index(){
        $demoM=new \app\common\model\Demo();
        $res=$demoM->getList();
        if($res['code']>0){
            $this->error($res['code'],$res['msg']);
        }
        $this->success($res['data']);
    }

    public function add(){
        $demoM=new \app\common\model\Demo();
        $res=$demoM->add();
        if($res['code']>0){
            $this->error($res['code'],$res['msg']);
        }
        $this->success($res['data']);
    }

    public function edit(){
        $demoM=new \app\common\model\Demo();
        $res=$demoM->edit();
        if($res['code']>0){
            $this->error($res['code'],$res['msg']);
        }
        $this->success($res['data']);
    }

    public function detail(){
        $demoM=new \app\common\model\Demo();
        $res=$demoM->detail();
        if($res['code']>0){
            $this->error($res['code'],$res['msg']);
        }
        $this->success($res['data']);
    }

    public function del(){
        $demoM=new \app\common\model\Demo();
        $res=$demoM->del();
        if($res['code']>0){
            $this->error($res['code'],$res['msg']);
        }
        $this->success($res['data']);
    }

}