| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 | <?phpnamespace app\admin\controller;use app\admin\common\AdminController;use app\common\api\CompanyApi;/** * Description of Company * * @author sgq */class Company extends AdminController {    /**     * @auth {{/company}}     * @return type     */    function index() {        return view();    }    /**     * @auth {{/company/list}}     * @return type     */    function list() {        $result = CompanyApi::getList($this->request->param());        return json($result);    }    /**     * @auth {{/company/add}}     * @return type     */    function add() {        if ($this->request->isPost()) {            CompanyApi::edit($this->request->param());            return json(["code" => 200, "msg" => "添加单位成功"]);        }        return view();    }    /**     * @auth {{/company/update}}     * @return type     */    function edit() {        if ($this->request->isPost()) {            CompanyApi::edit($this->request->param());            return json(["code" => 200, "msg" => "编辑单位成功"]);        }        $id = $this->request->param("id");        $info = CompanyApi::getOne($id);        return view("", ["info" => $info]);    }    /**     * @auth {{/company/delete}}     * @return type     */    function delete() {        $id = $this->request->param("id");        CompanyApi::delete($id);        return json(["code" => 200, "msg" => "删除成功"]);    }    /**     * @auth {{/company/select}}     * @return type     */    function view() {        $id = $this->request->param("id");        $info = CompanyApi::getOne($id);        return view("", ["info" => $info]);    }}
 |