drag-create-api/app/api/controller/Code/CodeModuleCategory.php

79 lines
2.8 KiB
PHP

<?php
namespace app\api\controller\Code;
use app\BaseController;
use app\common\model\Code\CodeModuleCategory as ModelCodeModuleCategory;
use app\common\arw\adjfut\src\Traverse;
use app\Request;
use think\Validate;
use think\exception\ValidateException;
use think\facade\Filesystem;
use app\common\arw\adjfut\src\Excel;
use app\common\arw\adjfut\src\UploadFile;
use think\facade\Db;
use app\common\exception\Tool;
use think\facade\Env;
class CodeModuleCategory extends BaseController
{
/**
* 获取一级类目列表
*/
public function getCodeModuleFirstCategoryList(Request $request)
{
$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('a.code_module_category_parent_guid', 0)->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,
]);
}
}