修改渠道ChannelManage关联部门SystemDepart

This commit is contained in:
2026-03-10 10:09:35 +08:00
parent e94ebd3fe6
commit a6d87d5c0d
8 changed files with 242 additions and 15 deletions

View File

@@ -8,7 +8,6 @@ namespace app\channel\logic\manage;
use plugin\saiadmin\basic\eloquent\BaseLogic;
use plugin\saiadmin\exception\ApiException;
use plugin\saiadmin\utils\Helper;
use app\channel\model\manage\ChannelManage;
/**
@@ -24,4 +23,22 @@ class ChannelManageLogic extends BaseLogic
$this->model = new ChannelManage();
}
/**
* 判断当前用户是否可操作该渠道(仅渠道管理员或超级管理员可操作)
* @param object|array $channel 渠道数据,需包含 admin_id
* @return bool
*/
public function canOperateChannel($channel): bool
{
if (empty($this->adminInfo) || !isset($this->adminInfo['id'])) {
return false;
}
$adminId = (int) ($this->adminInfo['id']);
if ($adminId === 1) {
return true;
}
$channelAdminId = is_array($channel) ? ($channel['admin_id'] ?? null) : ($channel->admin_id ?? null);
return $channelAdminId !== null && (int) $channelAdminId === $adminId;
}
}