param(); //默认只查默认和公共库 $con = [ 'a.code_module_category_library_type' => [ModelCodeModuleCategory::LIBRARY_DEFAULT, ModelCodeModuleCategory::LIBRARY_COMMON] ]; //请求传入客户guid时则只查该客户的私有库 if (isset($params['customer_guid']) && $params['customer_guid']) { $con['a.code_module_category_library_type'] = ModelCodeModuleCategory::LIBRARY_PRIVATE; $con['a.customer_guid'] = $params['customer_guid']; } $query = ModelCodeModuleCategory::alias('a')->field([ 'a.code_module_category_guid' => 'guid', 'a.code_module_category_name' => 'name', 'a.code_module_category_ps' => 'tips', 'a.code_module_category_sort' => 'sort', 'a.code_module_category_global_mode', 'a.code_module_category_library_type', 'c.customer_guid' => 'customer_guid', 'c.customer_name' => 'customer_name', ]) ->append(['langHit', 'libraryType']) ->hidden(['code_module_category_global_mode', 'code_module_category_library_type']) ->leftjoin('customer c', 'a.customer_guid = c.customer_guid') ->where($con) ->scope('auditPass,master')->select(); return msg(0, "获取一级类目列表成功!", [ 'count' => $query->count(), 'data' => $query, ]); } /** * 获取当前一级类目的二级类目列表 */ public function getCodeModuleSecondCategoryList(Request $request) { $params = $request->param(); $this->validate($params, ['code_module_category_guid|当前类目guid' => 'require']); $query = ModelCodeModuleCategory::alias('a')->field([ 'a.code_module_category_guid' => 'guid', 'a.code_module_category_name' => 'name', 'a.code_module_category_ps' => 'tips', 'a.code_module_category_sort' => 'sort', // 'a.code_module_category_global_mode', // 'a.code_module_category_library_type', 'c.customer_guid' => 'customer_guid', 'c.customer_name' => 'customer_name', ]) // ->append(['langHit', 'libraryType']) // ->hidden(['code_module_category_global_mode', 'code_module_category_library_type']) ->leftjoin('customer c', 'a.customer_guid = c.customer_guid') ->scope('auditPass') ->where('code_module_category_parent_guid', $params['code_module_category_guid']) ->select(); return msg(0, "获取当前一级类目的二级类目列表成功!", [ 'count' => $query->count(), 'data' => $query, ]); } }