代码提交

This commit is contained in:
wong
2025-04-21 09:19:50 +08:00
parent ca5ff241af
commit dd1c808015
5 changed files with 587 additions and 47 deletions

View File

@@ -63,6 +63,7 @@ Route::group('v1/', function () {
Route::get('list', 'app\\cunkebao\\controller\\ContentLibraryController@getList'); // 获取内容库列表
Route::post('update', 'app\\cunkebao\\controller\\ContentLibraryController@update'); // 更新内容库
Route::delete('delete', 'app\\cunkebao\\controller\\ContentLibraryController@delete'); // 删除内容库
Route::get('detail', 'app\\cunkebao\\controller\\ContentLibraryController@detail'); // 获取内容库详情
});
// 好友相关

View File

@@ -90,7 +90,7 @@ class ContentLibraryController extends Controller
['userId', '=', $this->request->userInfo['id']],
['isDel', '=', 0] // 只查询未删除的记录
])
->field('id,name,sourceFriends,sourceGroups,keywordInclude,keywordExclude,aiEnabled,aiPrompt,timeEnabled,timeStart,timeEnd,status,userId,companyId,createTime,updateTime')
->field('id,name,sourceType,sourceFriends,sourceGroups,keywordInclude,keywordExclude,aiEnabled,aiPrompt,timeEnabled,timeStart,timeEnd,status,userId,companyId,createTime,updateTime')
->find();
if (empty($library)) {
@@ -103,6 +103,15 @@ class ContentLibraryController extends Controller
$library['keywordInclude'] = json_decode($library['keywordInclude'] ?: '[]', true);
$library['keywordExclude'] = json_decode($library['keywordExclude'] ?: '[]', true);
// 将时间戳转换为日期格式(精确到日)
if (!empty($library['timeStart'])) {
$library['timeStart'] = date('Y-m-d', $library['timeStart']);
}
if (!empty($library['timeEnd'])) {
$library['timeEnd'] = date('Y-m-d', $library['timeEnd']);
}
return json([
'code' => 200,
'msg' => '获取成功',

View File

@@ -21,25 +21,30 @@ class GetFriendListV1Controller extends BaseController
{
$page = $this->request->param('page',1);
$limit = $this->request->param('limit',20);
$keyword = $this->request->param('keyword','');
try {
$where = [];
if ($this->getUserInfo('isAdmin') == 1) {
$where['companyId'] = $this->getUserInfo('companyId');
$where['wf.companyId'] = $this->getUserInfo('companyId');
$where['wf.deleteTime'] = 0;
} else {
$where['companyId'] = $this->getUserInfo('companyId');
$where['wf.companyId'] = $this->getUserInfo('companyId');
$where['wf.deleteTime'] = 0;
//$where['userId'] = $this->getUserInfo('id');
}
print_r($where);
exit;
if($keyword){
$where['wa1.nickname'] = ['like','%'.$keyword.'%'];
}
$data = WechatFriend::alias('wf')
->field(['wa1.nickname','wa1.avatar','wa1.alias','wa1.wechatId','wa2.nickname as ownerNickname','wa2.alias as ownerAlias','wf.createTime'])
->leftJoin('wechat_account wa1','wf.wechatId = wa1.wechatId')
->leftJoin('wechat_account wa2','wf.ownerWechatId = wa2.wechatId')
->field(['wa1.nickname','wa1.avatar','wa1.alias','wf.wechatId','wa2.nickname as ownerNickname','wa2.alias as ownerAlias','wa2.wechatId as ownerWechatId','wf.createTime'])
->Join('wechat_account wa1','wf.wechatId = wa1.wechatId')
->Join('wechat_account wa2','wf.ownerWechatId = wa2.wechatId')
->where($where);
$total = $data->count();