流量池字段同步

This commit is contained in:
wong
2025-09-22 18:03:45 +08:00
parent b0d5068192
commit fbfe0ba1fd

View File

@@ -149,7 +149,7 @@ class WorkbenchController extends Controller
$config->startTime = $param['startTime'];
$config->endTime = $param['endTime'];
$config->devices = json_encode($param['deviceGroups'], JSON_UNESCAPED_UNICODE);
$config->pools = json_encode($param['pools'], JSON_UNESCAPED_UNICODE);
$config->pools = json_encode($param['poolGroups'], JSON_UNESCAPED_UNICODE);
$config->account = json_encode($param['accountGroups'], JSON_UNESCAPED_UNICODE);
$config->createTime = time();
$config->updateTime = time();
@@ -159,7 +159,7 @@ class WorkbenchController extends Controller
$config = new WorkbenchImportContact;
$config->workbenchId = $workbench->id;
$config->devices = json_encode($param['deviceGroups'], JSON_UNESCAPED_UNICODE);
$config->pools = json_encode($param['pools'], JSON_UNESCAPED_UNICODE);
$config->pools = json_encode($param['poolGroups'], JSON_UNESCAPED_UNICODE);
$config->num = $param['num'];
$config->clearContact = $param['clearContact'];
$config->remark = $param['remark'];
@@ -314,13 +314,13 @@ class WorkbenchController extends Controller
if (!empty($item->trafficConfig)) {
$item->config = $item->trafficConfig;
$item->config->devices = json_decode($item->config->devices, true);
$item->config->pools = json_decode($item->config->pools, true);
$item->config->poolGroups = json_decode($item->config->pools, true);
$item->config->account = json_decode($item->config->account, true);
$config_item = Db::name('workbench_traffic_config_item')->where(['workbenchId' => $item->id])->order('id DESC')->find();
$item->config->lastUpdated = !empty($config_item) ? date('Y-m-d H:i', $config_item['createTime']) : '--';
//统计
$labels = $item->config->pools;
$labels = $item->config->poolGroups;
$totalUsers = Db::table('s2_wechat_friend')->alias('wf')
->join(['s2_company_account' => 'sa'], 'sa.id = wf.accountId', 'left')
->join(['s2_wechat_account' => 'wa'], 'wa.id = wf.wechatAccountId', 'left')
@@ -352,7 +352,7 @@ class WorkbenchController extends Controller
'dailyAverage' => intval($dailyAverage),
'totalAccounts' => $totalAccounts,
'deviceCount' => count($item->config->devices),
'poolCount' => !empty($item->config->pools) ? count($item->config->pools) : 'ALL',
'poolCount' => !empty($item->config->poolGroups) ? count($item->config->poolGroups) : 'ALL',
'totalUsers' => $totalUsers >> 0
];
}
@@ -363,7 +363,7 @@ class WorkbenchController extends Controller
if (!empty($item->importContact)) {
$item->config = $item->importContact;
$item->config->devices = json_decode($item->config->devices, true);
$item->config->pools = json_decode($item->config->pools, true);
$item->config->poolGroups = json_decode($item->config->pools, true);
}
unset($item->importContact, $item->import_contact);
break;
@@ -505,12 +505,12 @@ class WorkbenchController extends Controller
$workbench->config = $workbench->trafficConfig;
$workbench->config->deviceGroups = json_decode($workbench->config->devices, true);
$workbench->config->accountGroups = json_decode($workbench->config->account, true);
$workbench->config->pools = json_decode($workbench->config->pools, true);
$workbench->config->poolGroups = json_decode($workbench->config->pools, true);
$config_item = Db::name('workbench_traffic_config_item')->where(['workbenchId' => $workbench->id])->order('id DESC')->find();
$workbench->config->lastUpdated = !empty($config_item) ? date('Y-m-d H:i', $config_item['createTime']) : '--';
//统计
$labels = $workbench->config->pools;
$labels = $workbench->config->poolGroups;
$totalUsers = Db::table('s2_wechat_friend')->alias('wf')
->join(['s2_company_account' => 'sa'], 'sa.id = wf.accountId', 'left')
->join(['s2_wechat_account' => 'wa'], 'wa.id = wf.wechatAccountId', 'left')
@@ -549,7 +549,7 @@ class WorkbenchController extends Controller
'dailyAverage' => intval($dailyAverage),
'totalAccounts' => $totalAccounts,
'deviceCount' => count($workbench->config->deviceGroups),
'poolCount' => count($workbench->config->pools),
'poolCount' => count($workbench->config->poolGroups),
'totalUsers' => $totalUsers >> 0
];
unset($workbench->trafficConfig, $workbench->traffic_config);
@@ -559,7 +559,7 @@ class WorkbenchController extends Controller
if (!empty($workbench->importContact)) {
$workbench->config = $workbench->importContact;
$workbench->config->deviceGroups = json_decode($workbench->config->devices, true);
$workbench->config->pools = json_decode($workbench->config->pools, true);
$workbench->config->poolGroups = json_decode($workbench->config->pools, true);
}
unset($workbench->importContact, $workbench->import_contact);
break;
@@ -789,7 +789,7 @@ class WorkbenchController extends Controller
$config->startTime = $param['startTime'];
$config->endTime = $param['endTime'];
$config->devices = json_encode($param['deviceGroups']);
$config->pools = json_encode($param['pools']);
$config->pools = json_encode($param['poolGroups']);
$config->account = json_encode($param['accountGroups']);
$config->updateTime = time();
$config->save();
@@ -799,7 +799,7 @@ class WorkbenchController extends Controller
$config = WorkbenchImportContact::where('workbenchId', $param['id'])->find();;
if ($config) {
$config->devices = json_encode($param['deviceGroups']);
$config->pools = json_encode($param['pools']);
$config->pools = json_encode($param['poolGroups']);
$config->num = $param['num'];
$config->clearContact = $param['clearContact'];
$config->remark = $param['remark'];
@@ -1450,7 +1450,7 @@ class WorkbenchController extends Controller
'startTime' => $param['startTime'],
'endTime' => $param['endTime'],
'targets' => json_encode($param['targets'], JSON_UNESCAPED_UNICODE),
'pools' => json_encode($param['pools'], JSON_UNESCAPED_UNICODE),
'pools' => json_encode($param['poolGroups'], JSON_UNESCAPED_UNICODE),
'createTime' => time(),
'updateTime' => time()
]);