fix:代码一级类目接口修改 feat:新增获取客户信息接口
This commit is contained in:
parent
71a0b282b9
commit
ad9d261325
@ -19,10 +19,29 @@ use think\facade\Env;
|
||||
class CodeModuleCategory extends BaseController
|
||||
{
|
||||
/**
|
||||
* 获取一级类目列表
|
||||
* 获取一级类目列表接口
|
||||
*
|
||||
* @param Request $request
|
||||
* @return array
|
||||
* @date 2023-07-14
|
||||
* @author xjh
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function getCodeModuleFirstCategoryList(Request $request)
|
||||
{
|
||||
$params = $request->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',
|
||||
@ -36,8 +55,8 @@ class CodeModuleCategory extends BaseController
|
||||
->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();
|
||||
->where($con)
|
||||
->scope('auditPass,master')->select();
|
||||
|
||||
return msg(0, "获取一级类目列表成功!", [
|
||||
'count' => $query->count(),
|
||||
|
50
app/api/controller/Customer/Customer.php
Normal file
50
app/api/controller/Customer/Customer.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\controller\Customer;
|
||||
|
||||
use app\BaseController;
|
||||
use app\common\model\Customer\Customer as ModelCustomer;
|
||||
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 app\common\exception\Tool;
|
||||
use think\facade\Db;
|
||||
use app\common\model\Token as ModelToken;
|
||||
use think\facade\Env;
|
||||
|
||||
|
||||
class Customer extends BaseController
|
||||
{
|
||||
/**
|
||||
* 获取客户信息接口
|
||||
*
|
||||
* @param Request $request
|
||||
* @return array
|
||||
* @date 2023-07-14
|
||||
* @author xjh
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getCustomerInfo(Request $request): array
|
||||
{
|
||||
$token = ModelToken::getCurrent();
|
||||
if ($token->token_type != ModelToken::CUSTOMER_TYPE) {
|
||||
throwErrorMsg("当前token不是客户");
|
||||
}
|
||||
$customer = ModelCustomer::field([
|
||||
'customer_guid',
|
||||
'customer_name',
|
||||
'customer_email',
|
||||
'customer_blacklist',
|
||||
'customer_create_time',
|
||||
])->find($token->user_guid);
|
||||
if (!$customer) {
|
||||
throwErrorMsg("客户不存在!", 1);
|
||||
}
|
||||
return msg(0, "获取客户信息成功!", [
|
||||
'data' => $customer
|
||||
]);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user