Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hujun
tl_estate
Commits
6cff2598
Commit
6cff2598
authored
Jul 10, 2018
by
zw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
liaotian
parent
bccd9dd1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
3 deletions
+38
-3
AppChat.php
application/chat/controller/AppChat.php
+1
-1
ChatService.php
application/chat/service/ChatService.php
+4
-2
ChatRelation.php
application/model/ChatRelation.php
+33
-0
No files found.
application/chat/controller/AppChat.php
View file @
6cff2598
...
...
@@ -323,7 +323,7 @@ class AppChat extends Basic
{
$params
=
$this
->
params
;
/* $params = array(
"target" => "
121
"
"target" => "
agent_5775
"
);*/
if
(
!
isset
(
$params
[
'target'
]))
{
return
$this
->
response
(
"300"
,
"参数不全"
);
...
...
application/chat/service/ChatService.php
View file @
6cff2598
...
...
@@ -378,8 +378,10 @@ class ChatService
$chatRelationModel
=
new
ChatRelation
();
$params
[
"target"
]
=
$target
;
$params
[
"from"
]
=
$target
;
$field
=
"id,to_id,from_id,create_time"
;
return
$chatRelationModel
->
getChatRelation
(
$params
,
$field
);
$field
=
"a.id,a.to_id,a.from_id,a.create_time,b.type,b.id as user_or_agent_id,b.only_id,
c.name as agent_name,c.img,d.user_name,d.user_phone,d.user_nick,d.user_pic,d.other_pic"
;
return
$chatRelationModel
->
getChatRelationInfo
(
$params
,
$field
);
}
/**
...
...
application/model/ChatRelation.php
View file @
6cff2598
...
...
@@ -56,6 +56,39 @@ class ChatRelation extends Model
}
/**
* 获取关系是否存在
* @param $params
* @param string $field
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getChatRelationInfo
(
$params
,
$field
)
{
$where_
=
$whereOr_
=
[];
$only_id
=
$params
[
"target"
];
if
(
isset
(
$params
[
"target"
]))
{
$where_
[
"a.to_id"
]
=
$params
[
"target"
];
$whereOr_
[
"a.from_id"
]
=
$params
[
"target"
];
}
$where_
[
"disable"
]
=
0
;
$whereOr_
[
"disable"
]
=
0
;
return
$this
->
field
(
$field
)
->
alias
(
"a"
)
->
join
(
"chat_user b"
,
"a.to_id !=
$only_id
and a.to_id=b.only_id or a.from_id=b.only_id"
,
"left"
)
->
join
(
"a_agents c"
,
"b.type = 1 and b.id = c.id"
,
"left"
)
->
join
(
"u_users d"
,
"b.type =2 and b.id=d.id"
,
"left"
)
->
where
(
$where_
)
->
whereOr
(
function
(
$query
)
use
(
$whereOr_
)
{
$query
->
where
(
$whereOr_
);
})
->
select
();
}
public
function
addChatRelation
(
$params
)
{
$where_
=
[];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment