This commit is contained in:
devil_gong
2018-12-18 11:10:53 +08:00
parent 9e44b316b7
commit baf80871ab
147 changed files with 1236 additions and 1538 deletions

View File

@ -210,7 +210,7 @@ class Article extends Common
// 是否ajax请求
if(!IS_AJAX)
{
$this->error(lang('common_unauthorized_access'));
$this->error('非法访问');
}
// 数据处理
@ -259,9 +259,9 @@ class Article extends Common
// 数据添加
if($m->add())
{
$this->ajaxReturn(lang('common_operation_add_success'));
$this->ajaxReturn('新增成功');
} else {
$this->ajaxReturn(lang('common_operation_add_error'), -100);
$this->ajaxReturn('新增失败', -100);
}
} else {
$this->ajaxReturn($m->getError(), -1);
@ -299,9 +299,9 @@ class Article extends Common
// 数据更新
if($m->where(array('id'=>I('id')))->save())
{
$this->ajaxReturn(lang('common_operation_edit_success'));
$this->ajaxReturn('编辑成功');
} else {
$this->ajaxReturn(lang('common_operation_edit_error'), -100);
$this->ajaxReturn('编辑失败或数据未改变', -100);
}
} else {
$this->ajaxReturn($m->getError(), -1);
@ -340,7 +340,7 @@ class Article extends Common
// 是否ajax请求
if(!IS_AJAX)
{
$this->error(lang('common_unauthorized_access'));
$this->error('非法访问');
}
// 删除数据
@ -349,12 +349,12 @@ class Article extends Common
// 更新
if(db('Article')->delete(I('id')))
{
$this->ajaxReturn(lang('common_operation_delete_success'));
$this->ajaxReturn('删除成功');
} else {
$this->ajaxReturn(lang('common_operation_delete_error'), -100);
$this->ajaxReturn('删除失败或资源不存在', -100);
}
} else {
$this->ajaxReturn(lang('common_param_error'), -1);
$this->ajaxReturn('参数错误', -1);
}
}
@ -370,15 +370,15 @@ class Article extends Common
// 参数
if(empty($_POST['id']) || !isset($_POST['state']))
{
$this->ajaxReturn(lang('common_param_error'), -1);
$this->ajaxReturn('参数错误', -1);
}
// 数据更新
if(db('Article')->where(array('id'=>I('id')))->save(array('is_enable'=>I('state'))))
{
$this->ajaxReturn(lang('common_operation_edit_success'));
$this->ajaxReturn('编辑成功');
} else {
$this->ajaxReturn(lang('common_operation_edit_error'), -100);
$this->ajaxReturn('编辑失败或数据未改变', -100);
}
}
@ -394,15 +394,15 @@ class Article extends Common
// 参数
if(empty($_POST['id']) || !isset($_POST['state']))
{
$this->ajaxReturn(lang('common_param_error'), -1);
$this->ajaxReturn('参数错误', -1);
}
// 数据更新
if(db('Article')->where(array('id'=>I('id')))->save(array('is_home_recommended'=>I('state'))))
{
$this->ajaxReturn(lang('common_operation_edit_success'));
$this->ajaxReturn('编辑成功');
} else {
$this->ajaxReturn(lang('common_operation_edit_error'), -100);
$this->ajaxReturn('编辑失败或数据未改变', -100);
}
}
}