feat:代码块类目新增审核接口
This commit is contained in:
parent
84e32c7f24
commit
97c5d18eae
@ -47,27 +47,27 @@ class CodeModuleCategory extends BaseController
|
||||
$query = ModelCodeModuleCategory::alias('cmc')->leftjoin('customer cust', 'cmc.customer_guid = cust.customer_guid')
|
||||
->scope('master')->where($con);
|
||||
$module_category_guids = self::pageWrapper($query)->column('code_module_category_guid');
|
||||
//分页后的主级类目开始构建树形结构(此时才会获取到各个父级类目所包含的子级类目)
|
||||
if ($module_category_guids) {
|
||||
//分页后的主级类目开始构建树形结构(此时才会获取到各个父级类目所包含的子级类目)
|
||||
$data = ModelCodeModuleCategory::alias('cmc')
|
||||
$data = ModelCodeModuleCategory::alias('cmc')
|
||||
->whereOr([
|
||||
['cmc.code_module_category_guid', 'in', $module_category_guids],
|
||||
['cmc.code_module_category_parent_guid', 'in', $module_category_guids],
|
||||
])->field([
|
||||
'cmc.code_module_category_id',
|
||||
'cmc.code_module_category_guid',
|
||||
'cmc.customer_guid',
|
||||
'cmc.code_module_category_audit',
|
||||
'cmc.code_module_category_sort',
|
||||
'cmc.code_module_category_parent_guid',
|
||||
'cmc.code_module_category_name',
|
||||
'cmc.code_module_category_audit',
|
||||
'cmc.code_module_category_global_mode',
|
||||
'cmc.code_module_category_library_type',
|
||||
'cmc.code_module_category_ps',
|
||||
'cmcp.code_module_category_name' => "code_module_category_parent_name",
|
||||
'cust.customer_name',
|
||||
])
|
||||
'cmc.code_module_category_id',
|
||||
'cmc.code_module_category_guid',
|
||||
'cmc.customer_guid',
|
||||
'cmc.code_module_category_audit',
|
||||
'cmc.code_module_category_sort',
|
||||
'cmc.code_module_category_parent_guid',
|
||||
'cmc.code_module_category_name',
|
||||
'cmc.code_module_category_audit',
|
||||
'cmc.code_module_category_global_mode',
|
||||
'cmc.code_module_category_library_type',
|
||||
'cmc.code_module_category_ps',
|
||||
'cmcp.code_module_category_name' => "code_module_category_parent_name",
|
||||
'cust.customer_name',
|
||||
])
|
||||
->leftjoin('code_module_category cmcp', 'cmc.code_module_category_parent_guid = cmcp.code_module_category_guid')
|
||||
->leftjoin('customer cust', 'cmc.customer_guid = cust.customer_guid')
|
||||
->order('code_module_category_sort')
|
||||
@ -93,7 +93,7 @@ class CodeModuleCategory extends BaseController
|
||||
}
|
||||
|
||||
return msg(0, "获取代码块类目列表成功!", [
|
||||
'count' => $query->count(),
|
||||
'count' => $query->count(),
|
||||
'data' => $tree_data,
|
||||
]);
|
||||
}
|
||||
@ -112,7 +112,6 @@ class CodeModuleCategory extends BaseController
|
||||
$params = $request->param();
|
||||
$this->validate($params, [
|
||||
'code_module_category_name|类目名' => 'require',
|
||||
'code_module_category_ps|补充' => 'require',
|
||||
'code_module_category_sort|排序' => 'require',
|
||||
'code_module_category_global_mode|全局模式' => 'require',
|
||||
'code_module_category_library_type|库类型' => 'require',
|
||||
@ -120,7 +119,6 @@ class CodeModuleCategory extends BaseController
|
||||
|
||||
ModelCodeModuleCategory::create($params, [
|
||||
'code_module_category_name',
|
||||
'code_module_category_ps',
|
||||
'code_module_category_parent_guid',
|
||||
'code_module_category_sort',
|
||||
'code_module_category_global_mode',
|
||||
@ -148,17 +146,17 @@ class CodeModuleCategory extends BaseController
|
||||
$params = $request->param();
|
||||
$this->validate($params, [
|
||||
'code_module_category_name|类目名' => 'require',
|
||||
'code_module_category_ps|补充' => 'require',
|
||||
'code_module_category_parent_guid|父级guid' => 'require',
|
||||
'code_module_category_sort|排序' => 'require',
|
||||
'code_module_category_global_mode|全局模式' => 'require',
|
||||
'code_module_category_library_type|库类型' => 'require',
|
||||
]);
|
||||
$model = ModelCodeModuleCategory::where('code_module_category_guid', $params['code_module_category_guid'])->find();
|
||||
if (!$model) throwErrorMsg("该代码块类目不存在", 1);
|
||||
if (!$model) {
|
||||
throwErrorMsg("该代码块类目不存在", 1);
|
||||
}
|
||||
$model->allowField([
|
||||
'code_module_category_name',
|
||||
'code_module_category_ps',
|
||||
'code_module_category_parent_guid',
|
||||
'code_module_category_sort',
|
||||
'code_module_category_global_mode',
|
||||
@ -213,4 +211,33 @@ class CodeModuleCategory extends BaseController
|
||||
}
|
||||
return msg(0, '', ['data' => $find]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 审核代码类目接口
|
||||
*
|
||||
* @param Request $request
|
||||
* @return array
|
||||
* @date 2023-06-28
|
||||
* @author xjh
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function auditCodeModuleCategory(Request $request): array
|
||||
{
|
||||
$params = $request->param();
|
||||
$this->validate($params, [
|
||||
'code_module_category_guid|类目guid' => 'require',
|
||||
'code_module_category_audit|审核状态' => 'require|in:1,2,3',
|
||||
]);
|
||||
Db::startTrans();
|
||||
try {
|
||||
ModelCodeModuleCategory::where([
|
||||
'code_module_category_guid' => explode(',', $params['code_module_category_guid'])
|
||||
])->select()->update(['code_module_category_audit' => $params['code_module_category_audit']]);
|
||||
Db::commit();
|
||||
return msg('审核成功!');
|
||||
} catch (\Throwable $th) {
|
||||
Db::rollback();
|
||||
throw $th;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user