1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- <?php
- namespace 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);
- }
- function selectAll() {
- $result = CompanyApi::getAll();
- 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]);
- }
- function detail() {
- $id = $this->request->param("id");
- $info = CompanyApi::getOne($id);
- return json($info);
- }
- }
|