Commit e599782b by 李洋

1、改返回的错误码

parent 26db6e8a
Showing with 10 additions and 10 deletions
......@@ -407,7 +407,7 @@ class MessageApiController extends Controller
}
$parent_id_path = $db->table('lie_msg_classify')->select('id_path')->where('cls_id',$parent_id)->first();
if (!$parent_id_path) {
$this->Export(111, '未查找到根分类!');
$this->Export(12001, '未查找到根分类!');
}
return $parent_id_path->id_path;
}
......@@ -417,7 +417,7 @@ class MessageApiController extends Controller
if ($classify_model['depth']==1) {
$root_id = $db->table('lie_msg_classify')->insertGetId($classify_model);
if (!$root_id) {
$this->Export(111, '创建根分类失败!');
$this->Export(12002, '创建根分类失败!');
}
$this->Export(0, '创建根分类成功');
} else {
......@@ -427,18 +427,18 @@ class MessageApiController extends Controller
try {//添加一级/二级分类
$new_cls_id = $db->table('lie_msg_classify')->insertGetId($classify_model);
if (!$new_cls_id) {
$this->Export(111, '创建分类失败!');
$this->Export(12003, '创建分类失败!');
}else {//补充id路径
$id_path = $parent_id_path.','.strval($new_cls_id);
$res = $db->table('lie_msg_classify')->where('cls_id',$new_cls_id)->update(['id_path'=>$id_path]);
if (!$res) {
$this->Export(111, '更新分类id路径失败!');
$this->Export(12004, '更新分类id路径失败!');
}
}
$db->commit();
} catch (Exception $e) {
$db->rollback();
$this->Export(111, '新增分类失败');
$this->Export(12005, '新增分类失败');
}
}
}
......@@ -449,7 +449,7 @@ class MessageApiController extends Controller
$cls_id = $in_data['sel_edit_sub_classify'];
$res = $db->table('lie_msg_classify')->where('cls_id',$cls_id)->update(['name'=>$in_data['edit_classify']]);
if (!$res && $res !== 0){
$this->Export(111, '编辑子分类失败');
$this->Export(12006, '编辑子分类失败');
}
}else {
$cls_id = $in_data['sel_edit_classify'];
......@@ -457,16 +457,16 @@ class MessageApiController extends Controller
try {
$res = $db->table('lie_msg_classify')->where('cls_id',$cls_id)->update(['name'=>$in_data['edit_classify']]);
if (!$res && $res !== 0){
$this->Export(111, '编辑子分类失败');
$this->Export(12007, '编辑子分类失败');
}
$res = $db->table('lie_msg_classify')->where('parent_id',$cls_id)->update(['parent_name'=>$in_data['edit_classify']]);
if (!$res && $res !== 0){
$this->Export(111, '编辑子分类失败');
$this->Export(12008, '编辑子分类失败');
}
$db->commit();
} catch (Exception $e) {
$db->rollback();
$this->Export(111, '编辑子分类失败');
$this->Export(12009, '编辑子分类失败');
}
}
}
......@@ -501,7 +501,7 @@ class MessageApiController extends Controller
$parent_name = $db->table('lie_msg_classify')->select('name')->where('cls_id',$classify_model['parent_id'])->first();
$classify_model['parent_name'] = $parent_name->name;
}else {
$this->Export(111, '参数错误');
$this->Export(12010, '参数错误');
}
return $classify_model;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment