feat: 塔内oms授权绑定

This commit is contained in:
chenping
2026-01-09 17:14:01 +08:00
parent db3a7f4b97
commit 9a0c9e7d2e
3 changed files with 47 additions and 5 deletions

View File

@@ -134,7 +134,23 @@ class base_enterprise {
$signature = base64_encode(json_encode($signature_data, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
// 获取 node_id
$node_id = base_shopnode::node_id('ome');
$base = rtrim(ENTERPRISE_APPLY_URL, '/');
return $base . '/system/apply?signature=' . urlencode($signature);
// 构建URL参数
$params = array('signature' => $signature);
if (!empty($node_id)) {
$params['node_id'] = $node_id;
}
$query_string = http_build_query($params);
// 如果企业已经认证过了ent_id存在返回组织列表URL否则返回认证URL
if (!empty($entId)) {
return $base . '/organization/list?' . $query_string;
}
return $base . '/system/apply?' . $query_string;
}
}

View File

@@ -194,6 +194,26 @@ class entermembercenter_callback
exit;
}
}
// 处理 version_tier 字段
// version_tier 可能的值default老用户此场景不会出现、open开源用户、tn-open塔内开源用户
// version_tier 一直允许被更新,即使有值
if (isset($data['version_tier']) && !empty($data['version_tier'])) {
$newVersionTier = $data['version_tier'];
// 验证 version_tier 的值是否合法
$allowedValues = array('default', 'open', 'tn-open');
if (!in_array($newVersionTier, $allowedValues)) {
echo json_encode(array(
'rsp' => 'fail',
'msg' => 'Invalid version_tier value: ' . $newVersionTier
));
exit;
}
// 直接更新 version_tier总是允许更新
app::get('entermembercenter')->setConf('version_tier', $newVersionTier);
}
echo json_encode(array(
'rsp' => 'succ',

View File

@@ -174,8 +174,13 @@ class ome_ctl_admin_shop extends desktop_controller {
$system_node_id = base_shopnode::node_id('ome');
$system_certificate_id = base_certificate::get('certificate_id');
// 获取 version_tier如果为 tn-open则按照非淘宝逻辑处理
$version_tier = app::get('entermembercenter')->getConf('version_tier');
$is_tn_open = ($version_tier == 'tn-open');
// 判断是否需要奇门授权(淘系店铺:淘宝/天猫同一逻辑)
$is_taobao = in_array($shop['shop_type'], array('taobao', 'tmall'));
// 注意:如果 version_tier=tn-open即使店铺类型是淘宝/天猫,也按照非淘宝逻辑处理
$is_taobao = in_array($shop['shop_type'], array('taobao', 'tmall')) && !$is_tn_open;
$need_qimen = false;
$is_qimen_binded = false;
$secretKeyDisplay = '';
@@ -183,7 +188,7 @@ class ome_ctl_admin_shop extends desktop_controller {
$qimen_channel_id = '';
$is_super = kernel::single('desktop_user')->is_super();
// 只有淘宝店铺才需要奇门授权
// 只有淘宝店铺才需要奇门授权(但 tn-open 版本不需要)
if ($is_taobao) {
// 检查奇门聚石塔内外互通渠道是否已配置
$channelObj = kernel::single('channel_channel');
@@ -216,14 +221,15 @@ class ome_ctl_admin_shop extends desktop_controller {
// 节点绑定状态(只检查 node_id
$is_node_binded = !empty($shop['node_id']);
// 店铺绑定状态:对于淘宝店铺,需要同时满足 node_id 和奇门授权;对于非淘宝店铺,只需要 node_id
// 店铺绑定状态:对于淘宝店铺,需要同时满足 node_id 和奇门授权;对于非淘宝店铺(包括 version_tier=tn-open,只需要 node_id
// 注意步骤3店铺绑定的完成状态只检查 node_id不依赖奇门授权
// 但是最终的"店铺绑定完成"状态需要两者都完成
// 注意version_tier=tn-open 时,即使店铺类型是淘宝/天猫,也按照非淘宝逻辑处理(不需要奇门授权)
if ($is_taobao) {
// 淘宝店铺:需要同时满足 node_id 和奇门授权才算完全绑定完成
$is_shop_binded = $is_node_binded && $is_qimen_binded;
} else {
// 非淘宝店铺:只需要 node_id
// 非淘宝店铺(包括 version_tier=tn-open:只需要 node_id
$is_shop_binded = $is_node_binded;
}