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
bcba2e0c
Commit
bcba2e0c
authored
Jul 16, 2018
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug
parent
d1a6752d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
12 deletions
+18
-12
AppChat.php
application/chat/controller/AppChat.php
+4
-3
ChatService.php
application/chat/service/ChatService.php
+14
-9
No files found.
application/chat/controller/AppChat.php
View file @
bcba2e0c
...
...
@@ -322,13 +322,14 @@ class AppChat extends Basic
{
$params
=
$this
->
params
;
/* $params = array(
"target" => "agent_5775"
"target" => "agent_5775",
"is_user"=> 0,//0用户1经纪人
);*/
if
(
!
isset
(
$params
[
'target'
]))
{
if
(
!
isset
(
$params
[
'target'
])
||
!
isset
(
$params
[
"is_user"
])
)
{
return
$this
->
response
(
"300"
,
"参数不全"
);
}
$target
=
$params
[
"target"
];
$relationList
=
$this
->
_chat
->
getRelationList
(
$target
);
$relationList
=
$this
->
_chat
->
getRelationList
(
$target
,
$params
[
"is_user"
]
);
return
$this
->
response
(
"200"
,
"success"
,
$relationList
);
...
...
application/chat/service/ChatService.php
View file @
bcba2e0c
...
...
@@ -217,7 +217,7 @@ class ChatService
foreach
(
$info
as
$item
)
{
array_push
(
$target
,
$item
[
"push_id"
]);
}
$rPush
->
send
(
$user_name
,
$target_type
,
$target
,
$msg_content
,
$from
,
$is_user
,
$type
,
$accessToken
,
[
$this
,
'saveSendStatus'
]);
$rPush
->
send
(
$user_name
,
$target_type
,
$target
,
$msg_content
,
$from
,
$is_user
,
$type
,
$accessToken
,
[
$this
,
'saveSendStatus'
]);
return
true
;
}
...
...
@@ -380,12 +380,13 @@ class ChatService
/**获取聊天列表
* @param $target
* @param $is_user
* @return array
* * @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getRelationList
(
$target
)
public
function
getRelationList
(
$target
,
$is_user
)
{
$chatRelationModel
=
new
ChatRelation
();
$params
[
"target"
]
=
$target
;
...
...
@@ -402,15 +403,19 @@ class ChatService
foreach
(
$relationList
as
$key
=>
$item
)
{
if
(
$item
[
"from_id"
]
==
$target
)
{
$result
[
$key
][
"relation_id"
]
=
$item
[
"to_id"
];
}
else
{
}
else
{
$result
[
$key
][
"relation_id"
]
=
$item
[
"from_id"
];
}
$result
[
$key
][
"id"
]
=
$item
[
"id"
];
$result
[
$key
][
"type"
]
=
$item
[
"type"
];
$result
[
$key
][
"id"
]
=
$item
[
"id"
];
$result
[
$key
][
"id"
]
=
$item
[
"id"
];
$select_
[
"from"
]
=
$item
[
"from_id"
];
$select_
[
"target"
]
=
$item
[
"to_id"
];
if
(
$is_user
==
0
)
{
$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"
];
}
else
{
$result
[
$key
][
"name"
]
=
$item
[
"agent_name"
];
$result
[
$key
][
"img"
]
=
$item
[
"img"
];
}
$result
[
$key
][
"only_id"
]
=
$item
[
"only_id"
];
$select_
[
"from"
]
=
$item
[
"from_id"
];
$select_
[
"target"
]
=
$item
[
"to_id"
];
$result
[
$key
][
"chat_info"
]
=
$msgModel
->
getChatHistory
(
$select_
,
$fields
,
1
,
1
);
}
return
$result
;
...
...
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