Files
chatwoot-ai-agent/fastadmin/chathub/Chathub.php
T
GreatQiu 91104e58cf v1.8: FastAdmin chathub-addon — register/plan/payment/member-center + 5 channel bindings
- New fastadmin/chathub/ (11 files, 204K): user-facing FastAdmin ThinkPHP 5 addon
- _markOrderPaid() now calls _provisionAsync() on empty embed_code (closes 'paid but no code' gap)
- New reprovision() action — user-initiated resource rebuild
- payReturn() smart redirect: 3 branches (just_paid / provisioning / pending / fallback)
- status badge updated with 'provisioning' state (blue)
- _initialize() whitelist expanded: reprovision (user) + payNotify/payReturn (public webhook)
- 5 chathub_* tables (tenant/log/order/channel_account/gateway_log) + MIGRATIONS.md

Bugfixes during E2E:
- payNotify HTTP 500: tenant.status ENUM missing 'provisioning' value (DBA migration)
- payNotify HTTP 500: chathub_log.status='received' (not in ENUM) — changed to 'success'
- TP5 method signature: function reprovision(\$ids) does not read query string — use \$this->request->param('ids')
2026-06-05 14:20:00 +08:00

69 lines
1.2 KiB
PHP

<?php
namespace addons\chathub;
use app\common\library\Menu;
use think\Addons;
class Chathub extends Addons
{
protected $menu = [
[
'name' => 'chathub',
'title' => 'ChatHub',
'icon' => 'fa fa-headset',
'ismenu' => 1,
'weigh' => 1,
'sublist' => [
["name" => "chathub/index/index", "title" => "租户列表"],
["name" => "chathub/index/dashboard", "title" => "控制面板"],
]
]
];
public function install()
{
Menu::create($this->menu);
return true;
}
public function uninstall()
{
Menu::delete("chathub");
return true;
}
public function enable()
{
Menu::enable("chathub");
return true;
}
public function disable()
{
Menu::disable("chathub");
return true;
}
public function upgrade()
{
Menu::upgrade('chathub', $this->menu);
return true;
}
/**
* config_init 钩子
*/
public function ConfigInit()
{
// nothing to init
}
/**
* 兼容 fallback
*/
public function run()
{
// nothing
}
}