<?php
namespace app\controller\merchant\agreement;
use crmeb\basic\BaseController;
use think\facade\Db;


class Agreement extends BaseController
{

    /*列表*/
    public  function lst(){
        $where2['mer_id']=$this->request->merId();
        $count = Db::name("enterprise_agreement")->where($where2)->count();
        $list = Db::name("enterprise_agreement")->where($where2)->select();
        $data= compact('count', 'list');
        return app("json")->success($data);
    }

    /*详情*/
    public function  detail($id){
        $data=  Db::name("enterprise_agreement")->where(['agreement_id'=>$id])->find();
        return app("json")->success($data);
    }
    /*修改*/
    public  function update($id){
        $data = $this->request->params(['content','title','status']);
        if(!$data['title']){
            return app("json")->fail('请输入标题');
        }
        Db::name("enterprise_agreement")->where(['agreement_id'=>$id])->update($data);
        return app("json")->success('修改成功');
    }

}
