新版群添加功能

This commit is contained in:
wong
2025-12-29 16:09:22 +08:00
parent 82f9b9371a
commit db0985504a
16 changed files with 2582 additions and 8 deletions

View File

@@ -37,11 +37,12 @@ class DouBaoAI extends Controller
if (empty($params)){
$content = $this->request->param('content', '');
$model = $this->request->param('model', 'doubao-seed-1-8-251215');
if(empty($content)){
return json_encode(['code' => 500, 'msg' => '提示词缺失']);
}
$params = [
'model' => 'doubao-seed-1-8-251215',
'model' => $model,
'messages' => [
['role' => 'system', 'content' => '你现在是存客宝的AI助理你精通中国大陆的法律'],
['role' => 'user', 'content' => $content],

View File

@@ -157,6 +157,11 @@ Route::group('v1/', function () {
Route::get('userInfoStats', 'app\cunkebao\controller\StatsController@userInfoStats');
});
// 常用功能相关
Route::group('common-functions', function () {
Route::get('list', 'app\cunkebao\controller\CommonFunctionsController@getList'); // 获取常用功能列表
});
// 算力相关
Route::group('tokens', function () {
Route::get('list', 'app\cunkebao\controller\TokensController@getList');

View File

@@ -0,0 +1,50 @@
<?php
namespace app\cunkebao\controller;
use app\cunkebao\controller\BaseController;
use library\ResponseHelper;
use think\Db;
/**
* 常用功能控制器
*/
class CommonFunctionsController extends BaseController
{
/**
* 获取常用功能列表
* @return \think\response\Json
*/
public function getList()
{
try {
$companyId = $this->getUserInfo('companyId');
// 从数据库查询常用功能列表
$functions = Db::name('workbench_function')
->where('status', 1)
->order('sort ASC, id ASC')
->select();
// 处理数据判断是否显示New标签创建时间近1个月
$oneMonthAgo = time() - 30 * 24 * 60 * 60; // 30天前的时间戳
foreach ($functions as &$function) {
// 判断是否显示New标签创建时间在近1个月内
$function['isNew'] = ($function['createTime'] >= $oneMonthAgo) ? true : false;
$function['labels'] = json_decode($function['labels'],true);
}
unset($function);
return ResponseHelper::success([
'list' => $functions
]);
} catch (\Exception $e) {
return ResponseHelper::error('获取常用功能列表失败:' . $e->getMessage());
}
}
}