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
97a31205
Commit
97a31205
authored
Jul 19, 2018
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
关系处理
parent
aaee822f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
6 deletions
+12
-6
AppChat.php
application/chat/controller/AppChat.php
+2
-2
ChatService.php
application/chat/service/ChatService.php
+10
-4
No files found.
application/chat/controller/AppChat.php
View file @
97a31205
...
...
@@ -323,8 +323,8 @@ class AppChat extends Basic
{
$params
=
$this
->
params
;
/* $params = array(
"target" => "
user_2",
"is_user" => 1,//
1用户2
经纪人
"target" => "
agent_5739", //当前用户
"is_user" => 1,//
0用户1
经纪人
"relation_list" => '[{"r_id":"2","msg_id":3536},{"r_id":"8","msg_id":3524}]',
);*/
if
(
!
isset
(
$params
[
'target'
])
||
!
isset
(
$params
[
"is_user"
]))
{
...
...
application/chat/service/ChatService.php
View file @
97a31205
...
...
@@ -399,6 +399,7 @@ class ChatService
*/
public
function
getRelationList
(
$target
,
$is_user
,
$relation_list
)
{
//查询出所有关于我的聊天关系
$chatRelationModel
=
new
ChatRelation
();
$params
[
"target"
]
=
$target
;
$params
[
"from"
]
=
$target
;
...
...
@@ -411,12 +412,16 @@ class ChatService
$fields
=
"a.id,a.from_id,a.to_id,b.body,b.type,a.created_at"
;
$msgModel
=
new
ChatMsg
();
foreach
(
$relationList
as
$key
=>
$item
)
{
$result
[
$key
][
"id"
]
=
$item
[
"id"
];
//关系id
//对方的only_id
if
(
$item
[
"from_id"
]
==
$target
)
{
$result
[
$key
][
"relation_id"
]
=
$item
[
"to_id"
];
}
else
{
$result
[
$key
][
"relation_id"
]
=
$item
[
"from_id"
];
}
if
(
$is_user
==
1
)
{
//显示不是当前传入用户的用户信息 对方只能是一个人 如果不是用户则是经纪人
if
(
!
empty
(
$item
[
"user_phone"
]))
{
$result
[
$key
][
"name"
]
=
empty
(
$item
[
"user_nick"
])
?
$item
[
"user_name"
]
:
$item
[
"user_nick"
];
$result
[
$key
][
"img"
]
=
empty
(
$item
[
"user_pic"
])
?
$item
[
"other_pic"
]
:
$item
[
"user_pic"
];
$result
[
$key
][
"phone"
]
=
$item
[
"user_phone"
];
...
...
@@ -425,14 +430,15 @@ class ChatService
$result
[
$key
][
"img"
]
=
$item
[
"img"
];
$result
[
$key
][
"phone"
]
=
$item
[
"phone"
];
}
$result
[
$key
][
"id"
]
=
$item
[
"id"
];
$result
[
$key
][
"only_id"
]
=
$item
[
"only_id"
];
//where
$select_
[
"from"
]
=
$item
[
"from_id"
];
$select_
[
"target"
]
=
$item
[
"to_id"
];
//获取最后一条消息记录
$chat_info
=
$msgModel
->
getChatHistory
(
$select_
,
$fields
,
1
,
1
);
if
(
!
empty
(
$relation_list
))
{
if
(
$select_
[
"target"
]
==
$target
)
{
$where_
[
"to_id"
]
=
$select_
[
"target"
];
$where_
[
"from_id"
]
=
$select_
[
"from"
];
...
...
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