增加注册时根据公司进行自动授权&&调整资源列表返回
This commit is contained in:
@@ -118,6 +118,12 @@ class AuthLogic
|
||||
}
|
||||
// 是否登陆
|
||||
$user->isLogin = false;
|
||||
|
||||
$options = [
|
||||
'corp_id' => $user->corp_id,
|
||||
'user_id' => $user->id
|
||||
];
|
||||
\Webman\RedisQueue\Redis::send('perm-agt', $options);
|
||||
} else {
|
||||
$updated = [
|
||||
'union_id' => $feishuUserInfo['union_id'],
|
||||
|
||||
@@ -487,8 +487,7 @@ class Tree
|
||||
{
|
||||
$extraFields = [];
|
||||
$standardFields = [
|
||||
'id', 'name', 'url', 'icon', 'parent_id', 'type', 'is_hide',
|
||||
'is_hide_tab', 'keep_alive', 'code', 'level'
|
||||
'id', 'name', 'url', 'icon', 'is_hide', 'is_hide_tab', 'keep_alive', 'level'
|
||||
];
|
||||
|
||||
foreach ($item as $key => $value) {
|
||||
|
||||
@@ -106,12 +106,18 @@ class IndexController
|
||||
public function test()
|
||||
{
|
||||
|
||||
$data = [
|
||||
'code' => 'GD20250703-1DC80',
|
||||
'category' => '账号类问题',
|
||||
'content' => '这是一条测试工单内容。'
|
||||
];
|
||||
\app\common\utils\email\MailSend::send('mzl@hnxinyouhe.com', '【XYH】新的工单提醒', replaceTpl($data, 'work_order'));
|
||||
// $data = [
|
||||
// 'code' => 'GD20250703-1DC80',
|
||||
// 'category' => '账号类问题',
|
||||
// 'content' => '这是一条测试工单内容。'
|
||||
// ];
|
||||
// \app\common\utils\email\MailSend::send('mzl@hnxinyouhe.com', '【XYH】新的工单提醒', replaceTpl($data, 'work_order'));
|
||||
|
||||
// $options = [
|
||||
// 'corp_id' => 3,
|
||||
// 'user_id' => 666
|
||||
// ];
|
||||
// \Webman\RedisQueue\Redis::send('perm-agt', $options);
|
||||
|
||||
return 22;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
namespace app\queue\redis;
|
||||
|
||||
use support\Db;
|
||||
use support\exception\BusinessException;
|
||||
use Webman\RedisQueue\Consumer;
|
||||
|
||||
class PermAgt implements Consumer
|
||||
{
|
||||
// 要消费的队列名
|
||||
public $queue = 'perm-agt';
|
||||
|
||||
// 连接名,对应 plugin/webman/redis-queue/redis.php 里的连接`
|
||||
public $connection = 'default';
|
||||
|
||||
// 消费
|
||||
public function consume($data)
|
||||
{
|
||||
try {
|
||||
|
||||
$corpId = $data['corp_id'];
|
||||
$userId = $data['user_id'];
|
||||
|
||||
if ($corpId == 2) {
|
||||
$roles = [
|
||||
[
|
||||
'user_id' => $userId,
|
||||
'role_id' => 1
|
||||
],
|
||||
[
|
||||
'user_id' => $userId,
|
||||
'role_id' => 2
|
||||
],
|
||||
];
|
||||
$systems = [
|
||||
[
|
||||
'user_id' => $userId,
|
||||
'system_id' => 1
|
||||
],
|
||||
[
|
||||
'user_id' => $userId,
|
||||
'system_id' => 2
|
||||
],
|
||||
[
|
||||
'user_id' => $userId,
|
||||
'system_id' => 3
|
||||
],
|
||||
];
|
||||
} else {
|
||||
$roles = [
|
||||
'user_id' => $userId,
|
||||
'role_id' => 2
|
||||
];
|
||||
$systems = [
|
||||
[
|
||||
'user_id' => $userId,
|
||||
'system_id' => 2
|
||||
],
|
||||
[
|
||||
'user_id' => $userId,
|
||||
'system_id' => 3
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
Db::table('user_roles')->insert($roles);
|
||||
Db::table('user_systems')->insert($systems);
|
||||
return true;
|
||||
} catch (\Throwable $th) {
|
||||
throw new BusinessException($th->getFile()."|".$th->getLine()."|".$th->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// 消费失败回调
|
||||
/*
|
||||
$package = [
|
||||
'id' => 1357277951, // 消息ID
|
||||
'time' => 1709170510, // 消息时间
|
||||
'delay' => 0, // 延迟时间
|
||||
'attempts' => 2, // 消费次数
|
||||
'queue' => 'send-mail', // 队列名
|
||||
'data' => ['to' => 'tom@gmail.com', 'content' => 'hello'], // 消息内容
|
||||
'max_attempts' => 5, // 最大重试次数
|
||||
'error' => '错误信息' // 错误信息
|
||||
]
|
||||
*/
|
||||
public function onConsumeFailure(\Throwable $e, $package)
|
||||
{
|
||||
echo "consume failure\n";
|
||||
echo $e->getMessage() . "\n";
|
||||
// 无需反序列化
|
||||
var_export($package);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user