<?php
namespace app\admin\controller;
use app\admin\logic\CollectionLogic;
use think\Db;
class Collection extends AdminBase
{
    //显示付款的渠道
     public function lists(){
        if ($this->request->isAjax()) {
            $get = $this->request->get();
            $lists =CollectionLogic::lists($get);
            $this->_success('获取数据成功',$lists);
        }
        return $this->fetch();
     }

    //增加付款的渠道

    public function add(){
        if ($this->request->isAjax()) {
            $post = $this->request->post();
            $post['create_time']=time();
            $insert=Db::name('collection')->data($post)->insert();
            $this->_success('添加成功！');
        }
        return $this->fetch();
     }

     //编辑付款渠道
     public function edit($id){
        if ($this->request->isAjax()) {
            $post = $this->request->post();
            $lists =CollectionLogic::edit($post);
            $this->_success('修改数据成功',$lists);
        }
        $info=Db::name('collection')->where('id',$id)->find();
        $this->assign('info',$info);
        return $this->fetch();
     }
    
     //删除付款的渠道
     public function del($id){
        $del=Db::name('collection')->where('id',$id)->delete();
        $this->_success('删除付款渠道成功');

     }

    


}
?>