2026-01-29 17:48:51 +08:00
|
|
|
<?php
|
|
|
|
|
namespace app\common\config;
|
|
|
|
|
|
|
|
|
|
class BusinessConfig
|
|
|
|
|
{
|
2026-07-18 16:29:17 +08:00
|
|
|
const BUSINESS_ADMIN = 'admin';
|
|
|
|
|
const BUSINESS_ADMINGHD = 'adminghd';
|
|
|
|
|
const BUSINESS_ADMINCPP = 'admincpp';
|
2026-01-29 17:48:51 +08:00
|
|
|
|
|
|
|
|
public static function getTableMap($businessType)
|
|
|
|
|
{
|
|
|
|
|
$maps = [
|
|
|
|
|
self::BUSINESS_ADMIN => [
|
|
|
|
|
'user' => 'wechat_user',
|
|
|
|
|
'real_time_info' => 'wechat_real_time_info',
|
|
|
|
|
'calculate_record' => 'wechat_calculate_record',
|
|
|
|
|
],
|
|
|
|
|
self::BUSINESS_ADMINGHD => [
|
|
|
|
|
'user' => 'ghd_wechat_user',
|
|
|
|
|
'real_time_info' => 'wechat_real_time_info',
|
|
|
|
|
'calculate_record' => 'wechat_calculate_record',
|
|
|
|
|
],
|
2026-07-18 16:29:17 +08:00
|
|
|
self::BUSINESS_ADMINCPP => [
|
|
|
|
|
'user' => 'wechat_user',
|
|
|
|
|
'real_time_info' => 'wechat_real_time_info',
|
|
|
|
|
'calculate_record' => 'cpp_calculate_record',
|
|
|
|
|
'feedback' => 'cpp_feedback',
|
|
|
|
|
],
|
2026-01-29 17:48:51 +08:00
|
|
|
];
|
|
|
|
|
return isset($maps[$businessType]) ? $maps[$businessType] : $maps[self::BUSINESS_ADMIN];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static function getSessionKey($businessType)
|
|
|
|
|
{
|
|
|
|
|
$keys = [
|
|
|
|
|
self::BUSINESS_ADMIN => 'admin_user_id',
|
|
|
|
|
self::BUSINESS_ADMINGHD => 'adminghd_user_id',
|
2026-07-18 16:29:17 +08:00
|
|
|
self::BUSINESS_ADMINCPP => 'admincpp_user_id',
|
2026-01-29 17:48:51 +08:00
|
|
|
];
|
|
|
|
|
return isset($keys[$businessType]) ? $keys[$businessType] : 'admin_user_id';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static function getLoginTimeKey($businessType)
|
|
|
|
|
{
|
|
|
|
|
$keys = [
|
|
|
|
|
self::BUSINESS_ADMIN => 'admin_user_login_time',
|
|
|
|
|
self::BUSINESS_ADMINGHD => 'adminghd_user_login_time',
|
2026-07-18 16:29:17 +08:00
|
|
|
self::BUSINESS_ADMINCPP => 'admincpp_user_login_time',
|
2026-01-29 17:48:51 +08:00
|
|
|
];
|
|
|
|
|
return isset($keys[$businessType]) ? $keys[$businessType] : 'admin_user_login_time';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static function getBusinessTypeByModule()
|
|
|
|
|
{
|
|
|
|
|
$module = request()->module();
|
2026-07-18 16:29:17 +08:00
|
|
|
if ($module === 'adminghd') return self::BUSINESS_ADMINGHD;
|
|
|
|
|
if ($module === 'admincpp') return self::BUSINESS_ADMINCPP;
|
|
|
|
|
return self::BUSINESS_ADMIN;
|
2026-01-29 17:48:51 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static function getTableName($tableKey, $businessType = null)
|
|
|
|
|
{
|
|
|
|
|
if ($businessType === null) {
|
|
|
|
|
$businessType = self::getBusinessTypeByModule();
|
|
|
|
|
}
|
|
|
|
|
$map = self::getTableMap($businessType);
|
|
|
|
|
return isset($map[$tableKey]) ? $map[$tableKey] : $tableKey;
|
|
|
|
|
}
|
|
|
|
|
}
|