no message

This commit is contained in:
kuaifan 2024-12-10 20:38:25 +08:00
parent 07663dea6c
commit f29bf3640a
8 changed files with 140 additions and 50 deletions

View File

@ -611,7 +611,38 @@ class UsersController extends AbstractController
} }
/** /**
* @api {get} api/users/basic 11. 获取指定会员基础信息 * @api {get} api/users/search/ai 11. 获取AI机器人
*
* @apiDescription 搜索会员列表
* @apiVersion 1.0.0
* @apiGroup users
* @apiName search__ai
*
* @apiParam {String} type AI 类型比如openai
*
* @apiSuccess {Number} ret 返回状态码1正确、0错误
* @apiSuccess {String} msg 返回信息(错误描述)
* @apiSuccess {Object} data 返回数据
*/
public function search__ai()
{
User::auth();
//
$type = trim(Request::input('type'));
$botName = "ai-{$type}";
if (!UserBot::isAiBot("{$botName}@bot.system")) {
return Base::retError('AI机器人不存在');
}
//
$botUser = User::botGetOrCreate($botName);
if (empty($botUser)) {
return Base::retError('AI机器人不存在');
}
return Base::retSuccess('success', $botUser);
}
/**
* @api {get} api/users/basic 12. 获取指定会员基础信息
* *
* @apiDescription 需要token身份 * @apiDescription 需要token身份
* @apiVersion 1.0.0 * @apiVersion 1.0.0
@ -654,7 +685,7 @@ class UsersController extends AbstractController
} }
/** /**
* @api {get} api/users/lists 12. 会员列表(限管理员) * @api {get} api/users/lists 13. 会员列表(限管理员)
* *
* @apiDescription 需要token身份 * @apiDescription 需要token身份
* @apiVersion 1.0.0 * @apiVersion 1.0.0
@ -803,7 +834,7 @@ class UsersController extends AbstractController
} }
/** /**
* @api {get} api/users/operation 13. 操作会员(限管理员) * @api {get} api/users/operation 14. 操作会员(限管理员)
* *
* @apiDescription 需要token身份 * @apiDescription 需要token身份
* @apiVersion 1.0.0 * @apiVersion 1.0.0
@ -1061,7 +1092,7 @@ class UsersController extends AbstractController
} }
/** /**
* @api {get} api/users/email/verification 14. 邮箱验证 * @api {get} api/users/email/verification 15. 邮箱验证
* *
* @apiDescription 不需要token身份 * @apiDescription 不需要token身份
* @apiVersion 1.0.0 * @apiVersion 1.0.0
@ -1109,7 +1140,7 @@ class UsersController extends AbstractController
} }
/** /**
* @api {get} api/users/umeng/alias 15. 设置友盟别名 * @api {get} api/users/umeng/alias 16. 设置友盟别名
* *
* @apiDescription 需要token身份 * @apiDescription 需要token身份
* @apiVersion 1.0.0 * @apiVersion 1.0.0
@ -1172,7 +1203,7 @@ class UsersController extends AbstractController
} }
/** /**
* @api {get} api/users/meeting/open 16. 【会议】创建会议、加入会议 * @api {get} api/users/meeting/open 17. 【会议】创建会议、加入会议
* *
* @apiDescription 需要token身份 * @apiDescription 需要token身份
* @apiVersion 1.0.0 * @apiVersion 1.0.0
@ -1290,7 +1321,7 @@ class UsersController extends AbstractController
} }
/** /**
* @api {get} api/users/meeting/link 17. 【会议】获取分享链接 * @api {get} api/users/meeting/link 18. 【会议】获取分享链接
* *
* @apiDescription 需要token身份 * @apiDescription 需要token身份
* @apiVersion 1.0.0 * @apiVersion 1.0.0
@ -1319,7 +1350,7 @@ class UsersController extends AbstractController
} }
/** /**
* @api {get} api/users/meeting/tourist 18. 【会议】游客信息 * @api {get} api/users/meeting/tourist 19. 【会议】游客信息
* *
* @apiDescription 需要token身份 * @apiDescription 需要token身份
* @apiVersion 1.0.0 * @apiVersion 1.0.0
@ -1342,7 +1373,7 @@ class UsersController extends AbstractController
} }
/** /**
* @api {get} api/users/meeting/invitation 19. 【会议】发送邀请 * @api {get} api/users/meeting/invitation 20. 【会议】发送邀请
* *
* @apiDescription 需要token身份 * @apiDescription 需要token身份
* @apiVersion 1.0.0 * @apiVersion 1.0.0
@ -1389,7 +1420,7 @@ class UsersController extends AbstractController
} }
/** /**
* @api {get} api/users/email/send 20. 发送邮箱验证码 * @api {get} api/users/email/send 21. 发送邮箱验证码
* *
* @apiDescription 需要token身份 * @apiDescription 需要token身份
* @apiVersion 1.0.0 * @apiVersion 1.0.0
@ -1429,7 +1460,7 @@ class UsersController extends AbstractController
} }
/** /**
* @api {get} api/users/email/edit 21. 修改邮箱 * @api {get} api/users/email/edit 22. 修改邮箱
* *
* @apiDescription 需要token身份 * @apiDescription 需要token身份
* @apiVersion 1.0.0 * @apiVersion 1.0.0
@ -1474,7 +1505,7 @@ class UsersController extends AbstractController
} }
/** /**
* @api {get} api/users/delete/account 22. 删除帐号 * @api {get} api/users/delete/account 23. 删除帐号
* *
* @apiDescription 需要token身份 * @apiDescription 需要token身份
* @apiVersion 1.0.0 * @apiVersion 1.0.0
@ -1536,7 +1567,7 @@ class UsersController extends AbstractController
} }
/** /**
* @api {get} api/users/department/list 23. 部门列表(限管理员) * @api {get} api/users/department/list 24. 部门列表(限管理员)
* *
* @apiDescription 需要token身份 * @apiDescription 需要token身份
* @apiVersion 1.0.0 * @apiVersion 1.0.0
@ -1555,7 +1586,7 @@ class UsersController extends AbstractController
} }
/** /**
* @api {get} api/users/department/add 24. 新建、修改部门(限管理员) * @api {get} api/users/department/add 25. 新建、修改部门(限管理员)
* *
* @apiDescription 需要token身份 * @apiDescription 需要token身份
* @apiVersion 1.0.0 * @apiVersion 1.0.0
@ -1638,7 +1669,7 @@ class UsersController extends AbstractController
} }
/** /**
* @api {get} api/users/department/del 25. 删除部门(限管理员) * @api {get} api/users/department/del 26. 删除部门(限管理员)
* *
* @apiDescription 需要token身份 * @apiDescription 需要token身份
* @apiVersion 1.0.0 * @apiVersion 1.0.0
@ -1668,7 +1699,7 @@ class UsersController extends AbstractController
} }
/** /**
* @api {get} api/users/checkin/get 26. 获取签到设置 * @api {get} api/users/checkin/get 27. 获取签到设置
* *
* @apiDescription 需要token身份 * @apiDescription 需要token身份
* @apiVersion 1.0.0 * @apiVersion 1.0.0
@ -1695,7 +1726,7 @@ class UsersController extends AbstractController
} }
/** /**
* @api {post} api/users/checkin/save 27. 保存签到设置 * @api {post} api/users/checkin/save 28. 保存签到设置
* *
* @apiDescription 需要token身份 * @apiDescription 需要token身份
* @apiVersion 1.0.0 * @apiVersion 1.0.0
@ -1770,7 +1801,7 @@ class UsersController extends AbstractController
} }
/** /**
* @api {get} api/users/checkin/list 28. 获取签到数据 * @api {get} api/users/checkin/list 29. 获取签到数据
* *
* @apiDescription 需要token身份 * @apiDescription 需要token身份
* @apiVersion 1.0.0 * @apiVersion 1.0.0
@ -1817,7 +1848,7 @@ class UsersController extends AbstractController
} }
/** /**
* @api {get} api/users/socket/status 29. 获取socket状态 * @api {get} api/users/socket/status 30. 获取socket状态
* *
* @apiDescription 需要token身份 * @apiDescription 需要token身份
* @apiVersion 1.0.0 * @apiVersion 1.0.0
@ -1840,7 +1871,7 @@ class UsersController extends AbstractController
} }
/** /**
* @api {get} api/users/key/client 30. 客户端KEY * @api {get} api/users/key/client 31. 客户端KEY
* *
* @apiDescription 获取客户端KEY用于加密数据发送给服务端 * @apiDescription 获取客户端KEY用于加密数据发送给服务端
* @apiVersion 1.0.0 * @apiVersion 1.0.0
@ -1882,7 +1913,7 @@ class UsersController extends AbstractController
} }
/** /**
* @api {get} api/users/bot/info 31. 机器人信息 * @api {get} api/users/bot/info 32. 机器人信息
* *
* @apiDescription 需要token身份获取我的机器人信息 * @apiDescription 需要token身份获取我的机器人信息
* @apiVersion 1.0.0 * @apiVersion 1.0.0
@ -1933,7 +1964,7 @@ class UsersController extends AbstractController
} }
/** /**
* @api {post} api/users/bot/edit 32. 编辑机器人 * @api {post} api/users/bot/edit 33. 编辑机器人
* *
* @apiDescription 需要token身份编辑 我的机器人 管理员修改系统机器人 信息 * @apiDescription 需要token身份编辑 我的机器人 管理员修改系统机器人 信息
* @apiVersion 1.0.0 * @apiVersion 1.0.0
@ -2019,7 +2050,7 @@ class UsersController extends AbstractController
} }
/** /**
* @api {get} api/users/share/list 33. 获取分享列表 * @api {get} api/users/share/list 34. 获取分享列表
* *
* @apiVersion 1.0.0 * @apiVersion 1.0.0
* @apiGroup users * @apiGroup users
@ -2104,7 +2135,7 @@ class UsersController extends AbstractController
} }
/** /**
* @api {get} api/users/annual/report 34. 年度报告 * @api {get} api/users/annual/report 35. 年度报告
* *
* @apiVersion 1.0.0 * @apiVersion 1.0.0
* @apiGroup users * @apiGroup users

View File

@ -55,6 +55,16 @@ class UserBot extends AbstractModel
return str_ends_with($email, '@bot.system') && self::systemBotName($email); return str_ends_with($email, '@bot.system') && self::systemBotName($email);
} }
/**
* 判断是否系统AI机器人
* @param $email
* @return bool
*/
public static function isAiBot($email)
{
return str_starts_with($email, 'ai-') && self::isSystemBot($email);
}
/** /**
* 系统机器人名称 * 系统机器人名称
* @param $name string 邮箱 邮箱前缀 * @param $name string 邮箱 邮箱前缀

View File

@ -1,7 +1,8 @@
<?php <?php
namespace App\Tasks; namespace App\Tasks;
@error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING);
use App\Models\Setting; use App\Models\Setting;
use App\Models\User; use App\Models\User;
use App\Models\WebSocketDialogMsg; use App\Models\WebSocketDialogMsg;

View File

@ -0,0 +1,53 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\DB;
class AddFulltextIndexToWebSocketDialogMsgsTable extends Migration
{
public function up()
{
$tableName = 'web_socket_dialog_msgs';
$column = 'key'; // 需要添加 FULLTEXT 索引的字段
// 检查 FULLTEXT 索引是否已经存在
if (!$this->fullTextIndexExists($tableName, $column)) {
Schema::table($tableName, function (Blueprint $table) use ($column) {
$table->fullText($column);
});
}
}
public function down()
{
// 删除 FULLTEXT 索引
Schema::table('web_socket_dialog_msgs', function (Blueprint $table) {
$table->dropFullText(['key']);
});
}
private function fullTextIndexExists($tableName, $column)
{
// 获取当前数据库名称
$databaseName = env('DB_DATABASE');
// 查询 information_schema.statistics 表
$indexExists = DB::table(DB::raw('information_schema.statistics'))
->where('table_schema', $databaseName)
->where('table_name', $tableName)
->where('index_type', 'FULLTEXT')
->get();
// 检查返回的索引是否包含指定的列
foreach ($indexExists as $index) {
$indexColumns = explode(',', $index->column_name);
// 如果索引包含指定的列,则返回 true
if (in_array($column, $indexColumns)) {
return true;
}
}
return false;
}
}

View File

@ -801,4 +801,4 @@ webhook地址最长仅支持255个字符。
新增子任务标签 新增子任务标签
更新子任务标签 更新子任务标签
AI机器人不存在

File diff suppressed because one or more lines are too long

View File

@ -5,15 +5,15 @@
<meta name="description" content="APP接口文档"> <meta name="description" content="APP接口文档">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="assets/bootstrap.min.css?v=1733674735537" rel="stylesheet" media="screen"> <link href="assets/bootstrap.min.css?v=1733834470474" rel="stylesheet" media="screen">
<link href="assets/prism.css?v=1733674735537" rel="stylesheet" /> <link href="assets/prism.css?v=1733834470474" rel="stylesheet" />
<link href="assets/prism-toolbar.css?v=1733674735537" rel="stylesheet" /> <link href="assets/prism-toolbar.css?v=1733834470474" rel="stylesheet" />
<link href="assets/prism-diff-highlight.css?v=1733674735537" rel="stylesheet" /> <link href="assets/prism-diff-highlight.css?v=1733834470474" rel="stylesheet" />
<link href="assets/main.css?v=1733674735537" rel="stylesheet" media="screen, print"> <link href="assets/main.css?v=1733834470474" rel="stylesheet" media="screen, print">
<link href="assets/favicon.ico?v=1733674735537" rel="icon" type="image/x-icon"> <link href="assets/favicon.ico?v=1733834470474" rel="icon" type="image/x-icon">
<link href="assets/apple-touch-icon.png?v=1733674735537" rel="apple-touch-icon" sizes="180x180"> <link href="assets/apple-touch-icon.png?v=1733834470474" rel="apple-touch-icon" sizes="180x180">
<link href="assets/favicon-32x32.png?v=1733674735537" rel="icon" type="image/png" sizes="32x32"> <link href="assets/favicon-32x32.png?v=1733834470474" rel="icon" type="image/png" sizes="32x32">
<link href="assets/favicon-16x16.png?v=1733674735537" rel="icon" type="image/png" sizes="16x16"> <link href="assets/favicon-16x16.png?v=1733834470474" rel="icon" type="image/png" sizes="16x16">
</head> </head>
<body class="container-fluid"> <body class="container-fluid">
@ -1042,6 +1042,6 @@
</div> </div>
</div> </div>
<script src="assets/main.bundle.js?v=1733674735537"></script> <script src="assets/main.bundle.js?v=1733834470474"></script>
</body> </body>
</html> </html>

View File

@ -475,9 +475,8 @@ export default {
// //
onGoToChat(type) { onGoToChat(type) {
let dialogId = 0; let dialogId = 0;
let email = `ai-${type}@bot.system`;
this.cacheDialogs.map(h => { this.cacheDialogs.map(h => {
if (h.email == email) { if (h.email == `ai-${type}@bot.system`) {
dialogId = h.id; dialogId = h.id;
} }
}) })
@ -491,15 +490,10 @@ export default {
} else { } else {
this.aibotDialogSearchLoad = type; this.aibotDialogSearchLoad = type;
this.$store.dispatch("call", { this.$store.dispatch("call", {
url: 'dialog/search', url: 'users/search/ai',
data: { key: email }, data: {type},
}).then(({ data }) => { }).then(({data}) => {
if (data?.length < 1) { this.$store.dispatch("openDialogUserid", data.userid).then(_ => {
$A.messageError('机器人暂未开启');
this.aibotDialogSearchLoad = '';
return;
}
this.$store.dispatch("openDialogUserid", data[0]?.dialog_user.userid).then(_ => {
if (this.windowOrientation == 'landscape') { if (this.windowOrientation == 'landscape') {
this.goForward({ name: 'manage-messenger' }) this.goForward({ name: 'manage-messenger' })
} }
@ -509,8 +503,9 @@ export default {
}).finally(_ => { }).finally(_ => {
this.aibotDialogSearchLoad = ''; this.aibotDialogSearchLoad = '';
}); });
}).catch(_ => { }).catch(({msg}) => {
this.aibotDialogSearchLoad = ''; this.aibotDialogSearchLoad = '';
$A.messageError(msg || '机器人暂未开启');
}); });
} }
}, },