From bea5f445653f715624f387ba0300d68113c47667 Mon Sep 17 00:00:00 2001 From: wong <106998207@qq.com> Date: Thu, 11 Sep 2025 15:16:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/WorkbenchController.php | 42 +++++++++---------- .../cunkebao/validate/Workbench.php | 3 +- .../company/CreateCompanyController.php | 5 ++- 3 files changed, 26 insertions(+), 24 deletions(-) diff --git a/Server/application/cunkebao/controller/WorkbenchController.php b/Server/application/cunkebao/controller/WorkbenchController.php index 19181f3d..0b151812 100644 --- a/Server/application/cunkebao/controller/WorkbenchController.php +++ b/Server/application/cunkebao/controller/WorkbenchController.php @@ -79,7 +79,7 @@ class WorkbenchController extends Controller $config->startTime = $param['startTime']; $config->endTime = $param['endTime']; $config->contentTypes = json_encode($param['contentTypes']); - $config->devices = json_encode($param['deveiceGroups']); + $config->devices = json_encode($param['deviceGroups']); $config->friends = json_encode($param['friendsGroups']); // $config->targetGroups = json_encode($param['targetGroups']); // $config->tagOperator = $param['tagOperator']; @@ -99,7 +99,7 @@ class WorkbenchController extends Controller $config->startTime = $param['startTime']; $config->endTime = $param['endTime']; $config->accountType = $param['accountType']; - $config->devices = json_encode($param['deveiceGroups']); + $config->devices = json_encode($param['deviceGroups']); $config->contentLibraries = json_encode($param['contentGroups'] ?? []); $config->createTime = time(); $config->updateTime = time(); @@ -126,7 +126,7 @@ class WorkbenchController extends Controller case self::TYPE_GROUP_CREATE: // 自动建群 $config = new WorkbenchGroupCreate; $config->workbenchId = $workbench->id; - $config->devices = json_encode($param['deveiceGroups'], JSON_UNESCAPED_UNICODE); + $config->devices = json_encode($param['deviceGroups'], JSON_UNESCAPED_UNICODE); $config->startTime = $param['startTime']; $config->endTime = $param['endTime']; $config->groupSizeMin = $param['groupSizeMin']; @@ -148,7 +148,7 @@ class WorkbenchController extends Controller $config->timeType = $param['timeType']; $config->startTime = $param['startTime']; $config->endTime = $param['endTime']; - $config->devices = json_encode($param['deveiceGroups'], JSON_UNESCAPED_UNICODE); + $config->devices = json_encode($param['deviceGroups'], JSON_UNESCAPED_UNICODE); $config->pools = json_encode($param['pools'], JSON_UNESCAPED_UNICODE); $config->account = json_encode($param['accountGroups'], JSON_UNESCAPED_UNICODE); $config->createTime = time(); @@ -158,7 +158,7 @@ class WorkbenchController extends Controller case self::TYPE_IMPORT_CONTACT: //联系人导入 $config = new WorkbenchImportContact; $config->workbenchId = $workbench->id; - $config->devices = json_encode($param['deveiceGroups'], JSON_UNESCAPED_UNICODE); + $config->devices = json_encode($param['deviceGroups'], JSON_UNESCAPED_UNICODE); $config->pools = json_encode($param['pools'], JSON_UNESCAPED_UNICODE); $config->num = $param['num']; $config->clearContact = $param['clearContact']; @@ -441,7 +441,7 @@ class WorkbenchController extends Controller case self::TYPE_AUTO_LIKE: if (!empty($workbench->autoLike)) { $workbench->config = $workbench->autoLike; - $workbench->config->deveiceGroups = json_decode($workbench->config->devices, true); + $workbench->config->deviceGroups = json_decode($workbench->config->devices, true); $workbench->config->friendsGroups = json_decode($workbench->config->friends, true); //$workbench->config->targetGroups = json_decode($workbench->config->targetGroups, true); $workbench->config->contentTypes = json_decode($workbench->config->contentTypes, true); @@ -469,7 +469,7 @@ class WorkbenchController extends Controller case self::TYPE_MOMENTS_SYNC: if (!empty($workbench->momentsSync)) { $workbench->config = $workbench->momentsSync; - $workbench->config->deveiceGroups = json_decode($workbench->config->devices, true); + $workbench->config->deviceGroups = json_decode($workbench->config->devices, true); $workbench->config->contentGroups = json_decode($workbench->config->contentLibraries, true); //同步记录 @@ -493,7 +493,7 @@ class WorkbenchController extends Controller case self::TYPE_GROUP_CREATE: if (!empty($workbench->groupCreate)) { $workbench->config = $workbench->groupCreate; - $workbench->config->deveiceGroups = json_decode($workbench->config->devices, true); + $workbench->config->deviceGroups = json_decode($workbench->config->devices, true); $workbench->config->poolGroups = json_decode($workbench->config->poolGroups, true); $workbench->config->wechatGroups = json_decode($workbench->config->wechatGroups, true); unset($workbench->groupCreate, $workbench->group_create); @@ -503,7 +503,7 @@ class WorkbenchController extends Controller case self::TYPE_TRAFFIC_DISTRIBUTION: if (!empty($workbench->trafficConfig)) { $workbench->config = $workbench->trafficConfig; - $workbench->config->deveiceGroups = json_decode($workbench->config->devices, true); + $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); $config_item = Db::name('workbench_traffic_config_item')->where(['workbenchId' => $workbench->id])->order('id DESC')->find(); @@ -518,7 +518,7 @@ class WorkbenchController extends Controller ['wf.isDeleted', '=', 0], ['sa.departmentId', '=', $workbench->companyId] ]) - ->whereIn('wa.currentDeviceId', $workbench->config->deveiceGroups) + ->whereIn('wa.currentDeviceId', $workbench->config->deviceGroups) ->field('wf.id,wf.wechatAccountId,wf.wechatId,wf.labels,sa.userName,wa.currentDeviceId as deviceId') ->where(function ($q) use ($labels) { foreach ($labels as $label) { @@ -548,7 +548,7 @@ class WorkbenchController extends Controller $workbench->config->total = [ 'dailyAverage' => intval($dailyAverage), 'totalAccounts' => $totalAccounts, - 'deviceCount' => count($workbench->config->deveiceGroups), + 'deviceCount' => count($workbench->config->deviceGroups), 'poolCount' => count($workbench->config->pools), 'totalUsers' => $totalUsers >> 0 ]; @@ -558,7 +558,7 @@ class WorkbenchController extends Controller case self::TYPE_IMPORT_CONTACT: if (!empty($workbench->importContact)) { $workbench->config = $workbench->importContact; - $workbench->config->devices = json_decode($workbench->config->devices, true); + $workbench->config->deviceGroups = json_decode($workbench->config->devices, true); $workbench->config->pools = json_decode($workbench->config->pools, true); } unset($workbench->importContact, $workbench->import_contact); @@ -578,7 +578,7 @@ class WorkbenchController extends Controller //获取设备信息 - if (!empty($workbench->config->deveiceGroups)) { + if (!empty($workbench->config->deviceGroups)) { $deviceList = DeviceModel::alias('d') ->field([ 'd.id', 'd.imei', 'd.memo', 'd.alive', @@ -587,7 +587,7 @@ class WorkbenchController extends Controller ]) ->leftJoin('device_wechat_login l', 'd.id = l.deviceId and l.alive =' . DeviceWechatLoginModel::ALIVE_WECHAT_ACTIVE . ' and l.companyId = d.companyId') ->leftJoin('wechat_account a', 'l.wechatId = a.wechatId') - ->whereIn('d.id', $workbench->config->deveiceGroups) + ->whereIn('d.id', $workbench->config->deviceGroups) ->order('d.id desc') ->select(); @@ -597,9 +597,9 @@ class WorkbenchController extends Controller } unset($device); - $workbench->config->deveiceGroupsOptions = $deviceList; + $workbench->config->deviceGroupsOptions = $deviceList; } else { - $workbench->config->deveiceGroupsOptions = []; + $workbench->config->deviceGroupsOptions = []; } @@ -704,7 +704,7 @@ class WorkbenchController extends Controller $config->startTime = $param['startTime']; $config->endTime = $param['endTime']; $config->contentTypes = json_encode($param['contentTypes']); - $config->devices = json_encode($param['deveiceGroups']); + $config->devices = json_encode($param['deviceGroups']); $config->friends = json_encode($param['friendsGroups']); // $config->targetGroups = json_encode($param['targetGroups']); // $config->tagOperator = $param['tagOperator']; @@ -737,7 +737,7 @@ class WorkbenchController extends Controller $config->startTime = $param['startTime']; $config->endTime = $param['endTime']; $config->accountType = $param['accountType']; - $config->devices = json_encode($param['deveiceGroups']); + $config->devices = json_encode($param['deviceGroups']); $config->contentLibraries = json_encode($contentLibraries); $config->updateTime = time(); $config->save(); @@ -766,7 +766,7 @@ class WorkbenchController extends Controller case self::TYPE_GROUP_CREATE: $config = WorkbenchGroupCreate::where('workbenchId', $param['id'])->find(); if ($config) { - $config->devices = json_encode($param['deveiceGroups'], JSON_UNESCAPED_UNICODE); + $config->devices = json_encode($param['deviceGroups'], JSON_UNESCAPED_UNICODE); $config->startTime = $param['startTime']; $config->endTime = $param['endTime']; $config->groupSizeMin = $param['groupSizeMin']; @@ -788,7 +788,7 @@ class WorkbenchController extends Controller $config->timeType = $param['timeType']; $config->startTime = $param['startTime']; $config->endTime = $param['endTime']; - $config->devices = json_encode($param['deveiceGroups']); + $config->devices = json_encode($param['deviceGroups']); $config->pools = json_encode($param['pools']); $config->account = json_encode($param['accountGroups']); $config->updateTime = time(); @@ -798,7 +798,7 @@ class WorkbenchController extends Controller case self::TYPE_IMPORT_CONTACT: //联系人导入 $config = WorkbenchImportContact::where('workbenchId', $param['id'])->find();; if ($config) { - $config->devices = json_encode($param['deveiceGroups']); + $config->devices = json_encode($param['deviceGroups']); $config->pools = json_encode($param['pools']); $config->num = $param['num']; $config->clearContact = $param['clearContact']; diff --git a/Server/application/cunkebao/validate/Workbench.php b/Server/application/cunkebao/validate/Workbench.php index 664178be..c382cfe8 100644 --- a/Server/application/cunkebao/validate/Workbench.php +++ b/Server/application/cunkebao/validate/Workbench.php @@ -12,13 +12,14 @@ class Workbench extends Validate const TYPE_GROUP_PUSH = 3; // 群消息推送 const TYPE_GROUP_CREATE = 4; // 自动建群 const TYPE_TRAFFIC_DISTRIBUTION = 5; // 流量分发 + const TYPE_IMPORT_CONTACT = 6; // 流量分发 /** * 验证规则 */ protected $rule = [ 'name' => 'require|max:100', - 'type' => 'require|in:1,2,3,4,5', + 'type' => 'require|in:1,2,3,4,5,6', //'autoStart' => 'require|boolean', // 自动点赞特有参数 'interval' => 'requireIf:type,1|number|min:1', diff --git a/Server/application/superadmin/controller/company/CreateCompanyController.php b/Server/application/superadmin/controller/company/CreateCompanyController.php index ce39b7ce..08703311 100644 --- a/Server/application/superadmin/controller/company/CreateCompanyController.php +++ b/Server/application/superadmin/controller/company/CreateCompanyController.php @@ -266,7 +266,8 @@ class CreateCompanyController extends BaseController */ protected function setDepartmentPrivileges(array $params): void { - $params = ArrHelper::getValue('companyId', $params); + + $params = ArrHelper::getValue('companyId=departmentId', $params); $accountController = new \app\api\controller\AccountController(); $accountController->setPrivileges(['id' => $params['companyId']]); } @@ -289,11 +290,11 @@ class CreateCompanyController extends BaseController // 创建功能账号,不可登录,也非管理员,用户也不可见 $this->createFuncUsers($params); + Db::commit(); // 设置部门权限 $this->setDepartmentPrivileges($params); - Db::commit(); return ResponseHelper::success(); } catch (Exception $e) { Db::rollback();