49 lines
1.3 KiB
PHP
49 lines
1.3 KiB
PHP
<?php
|
|
|
|
|
|
namespace app\admin\controller;
|
|
|
|
|
|
class Relation extends Common
|
|
{
|
|
//获取列表
|
|
public function get_list()
|
|
{
|
|
$page = input('page', 1);
|
|
$page_limit = input('limit', 10);
|
|
return model('admin/Relation')->get_list($page, $page_limit);
|
|
}
|
|
//添加
|
|
public function add()
|
|
{
|
|
$name = input('name', '');
|
|
$color = input('color', '');
|
|
$day = input('day', 0);
|
|
$result = model('admin/Relation')->add($name, $color, $day);
|
|
ajaxReturn($result['code'], $result['msg'], $result['data']);
|
|
}
|
|
//获取信息
|
|
public function get_info()
|
|
{
|
|
$id = input('id', 0);
|
|
$result = model('admin/Relation')->get_info($id);
|
|
ajaxReturn($result['code'], $result['msg'], $result['data']);
|
|
}
|
|
//编辑
|
|
public function edit()
|
|
{
|
|
$id = input('id', 0);
|
|
$name = input('name', '');
|
|
$color = input('color', '');
|
|
$day = input('day', 0);
|
|
$result = model('admin/Relation')->edit($id, $name, $color, $day);
|
|
ajaxReturn($result['code'], $result['msg'], $result['data']);
|
|
}
|
|
//删除
|
|
public function del()
|
|
{
|
|
$id = input('id', 0);
|
|
$result = model('admin/Relation')->del($id);
|
|
ajaxReturn($result['code'], $result['msg'], $result['data']);
|
|
}
|
|
} |