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
20665918
Commit
20665918
authored
Jul 18, 2018
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug
parent
e67d830e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
14 deletions
+20
-14
AppChat.php
application/chat/controller/AppChat.php
+4
-4
ChatService.php
application/chat/service/ChatService.php
+12
-5
ChatMsg.php
application/model/ChatMsg.php
+4
-5
No files found.
application/chat/controller/AppChat.php
View file @
20665918
...
...
@@ -322,10 +322,10 @@ class AppChat extends Basic
public
function
getChatRelation
()
{
$params
=
$this
->
params
;
/*
$params = array(
"target" => "
agent_5739
",
"is_user" =>
1
,//0用户1经纪人
"relation_list" => '[{"r_id":"
13","msg_id":2868},{"r_id":"12","msg_id":2849
}]',
/*
$params = array(
"target" => "
user_2
",
"is_user" =>
0
,//0用户1经纪人
"relation_list" => '[{"r_id":"
2","msg_id":3536},{"r_id":"8","msg_id":3524
}]',
);*/
if
(
!
isset
(
$params
[
'target'
])
||
!
isset
(
$params
[
"is_user"
]))
{
return
$this
->
response
(
"300"
,
"参数不全"
);
...
...
application/chat/service/ChatService.php
View file @
20665918
...
...
@@ -211,12 +211,12 @@ class ChatService
$where
[
'only_id'
]
=
$target
;
if
(
$is_user
)
{
$where
[
'type'
]
=
2
;
$where
[
'type'
]
=
2
;
}
else
{
$where
[
'type'
]
=
1
;
$where
[
'type'
]
=
1
;
}
$info
=
$userExt
->
getChatUserExtByUserId
(
$where
,
'a.id,a.ext_id,a.device_id,a.push_id'
);
$info
=
$userExt
->
getChatUserExtByUserId
(
$where
,
'a.id,a.ext_id,a.device_id,a.push_id'
);
if
(
count
(
$info
)
<=
0
)
{
return
false
;
...
...
@@ -431,14 +431,21 @@ class ChatService
$chat_info
=
$msgModel
->
getChatHistory
(
$select_
,
$fields
,
1
,
1
);
if
(
!
empty
(
$relation_list
))
{
$where_
=
$select_
;
if
(
$select_
[
"target"
]
==
$target
)
{
$where_
[
"to_id"
]
=
$select_
[
"target"
];
$where_
[
"from_id"
]
=
$select_
[
"from"
];
}
else
{
$where_
[
"to_id"
]
=
$select_
[
"from"
];
$where_
[
"from_id"
]
=
$select_
[
"target"
];
}
try
{
$where_
[
"id"
]
=
array
(
"between"
,
array
(
$relation_list
[
$item
[
"id"
]][
0
][
"msg_id"
],
$chat_info
[
0
][
"id"
]
)
);
//计算未读消息个数
$unread_count
=
$msgModel
->
getTotalUnread
(
$where_
,
"id"
);
//dump($unread_count);
$result
[
$key
][
"unread"
]
=
$unread_count
>
0
?
$unread_count
-
1
:
0
;
$result
[
$key
][
"unread"
]
=
$unread_count
>
0
?
$unread_count
-
1
:
0
;
}
catch
(
Exception
$exception
)
{
$result
[
$key
][
"unread"
]
=
0
;
}
...
...
application/model/ChatMsg.php
View file @
20665918
...
...
@@ -81,12 +81,12 @@ class ChatMsg extends Model
public
function
getTotalUnread
(
$params
,
$field
)
{
if
(
isset
(
$params
[
"
from
"
]))
{
$where_
[
"a.
from_id"
]
=
$params
[
"from
"
];
if
(
isset
(
$params
[
"
to_id
"
]))
{
$where_
[
"a.
to_id"
]
=
$params
[
"to_id
"
];
//$where_or["a.to_id"] = $params["from"];
}
if
(
isset
(
$params
[
"
target
"
]))
{
$where_
[
"a.
to_id"
]
=
$params
[
"target
"
];
if
(
isset
(
$params
[
"
from_id
"
]))
{
$where_
[
"a.
from_id"
]
=
$params
[
"from_id
"
];
//$where_or["a.from_id"] = $params["target"];
}
if
(
isset
(
$params
[
"id"
]))
{
...
...
@@ -104,7 +104,6 @@ class ChatMsg extends Model
})*/
->
order
(
"a.created_at desc"
)
->
count
();
//echo $this->getLastSql();
return
$data
;
}
...
...
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