fix:代码块类目模块修改

This commit is contained in:
xjh 2023-06-29 22:32:20 +08:00
parent 0d7fed4c0c
commit b072ce49d2
2 changed files with 21 additions and 7 deletions

View File

@ -29,15 +29,19 @@ class CodeModuleCategory extends BaseController
*/
public function getCodeModuleCategoryList(Request $request): array
{
$params = $request->param();
$con = Tool::getOptionalQuery(
['cmc.code_module_category_name', 'LIKE'],
['cmc.code_module_category_ps', 'LIKE'],
['cmc.code_module_category_global_mode', '='],
['cmc.code_module_category_library_type', '='],
['cust.customer_name|cust.customer_account', 'LIKE', 'customer'],
['cmc.code_module_category_audit', '='],
);
if (isset($params['code_module_category_global_mode']) && $params['code_module_category_global_mode']) {
$con[] = ['cmc.code_module_category_global_mode', 'REGEXP', implode('|', $params['code_module_category_global_mode'])];
}
$tree_data = [];
//只针对主级类目进行的分页处理
$query = ModelCodeModuleCategory::alias('cmc')->leftjoin('customer cust', 'cmc.customer_guid = cust.customer_guid')
@ -203,11 +207,7 @@ class CodeModuleCategory extends BaseController
$this->validate($params, [
'code_module_category_guid|类目guid' => 'require',
]);
$find = ModelCodeModuleCategory::field(ModelCodeModuleCategory::Common_INFO_FIELDS)
->withAttr('code_module_category_global_mode', function (string $value): array {
return explode(',', $value);
})
->find($params['code_module_category_guid']);
$find = ModelCodeModuleCategory::field(ModelCodeModuleCategory::Common_INFO_FIELDS)->find($params['code_module_category_guid']);
if (!$find) {
throwErrorMsg("该类目不存在!");
}

View File

@ -115,7 +115,7 @@ class CodeModuleCategory extends BaseModel
}
/**
* 设置库类型
* 设置全局模式
*
* @param $value
* @return string
@ -128,6 +128,20 @@ class CodeModuleCategory extends BaseModel
return is_array($value) ? implode(',', $value) : $value;
}
/**
* 获取全局模式
*
* @param string $value
* @return array
* @date 2023-06-28
* @author xjh
* @since 1.0.0
*/
public function getCodeModuleCategoryGlobalModeAttr($value): array
{
return explode(',', $value);
}
/**
* 查询范围-主级类目
*