public function save($id = 0, $type = 1)
{
$post = parent::postMore([
['title', ''],
['pid', ''],
['sort', 0],
]);
if (!$post['title']) return Json::fail('请输入分类名称');
if ($id) {
$cate = TestPaperCategoryModel::get($id);
if (!$cate['pid'] && $post['pid'] && TestPaperCategoryModel::be(['pid' => $id, 'type' => $type, 'is_del' => 0])) return Json::fail('无法移动有下级的分类');
$res = TestPaperCategoryModel::edit($post, $id);
if ($res)
return Json::successful('修改成功');
else
return Json::fail('修改失败');
} else {
$post['add_time'] = time();
$post['type'] = $type;
$res = TestPaperCategoryModel::set($post);
if ($res)
return Json::successful('添加成功');
else
return Json::fail('添加失败');
}
}
699
{{like_count}}
{{collect_count}}
{{item.user_info.nickname ? item.user_info.nickname : item.user_name}}
作者 管理员 企业
{{itemf.name}}
{{itemc.user_info.nickname}}
{{itemc.user_name}}
回复 {{itemc.comment_user_info.nickname}}
{{itemf.name}}